# pridelab/pride-pppar architecture

> Architecture diagram of the GitHub repository pridelab/pride-pppar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pridelab/pride-pppar
- Repository: https://github.com/pridelab/pride-pppar

## Overview

##### Project type and purpose
- PRIDE-PPPAR is an open-source scientific computation package (CLI + light GUI) for Precise Point Positioning with Ambiguity Resolution (PPP-AR) in multi-GNSS.
- It is not a web or mobile app—rather it’s a high-performance Fortran/C core wrapped by shell/Python scripts and an optional GUI for early-career users.

##### Top-level architectural components
A. Input & configuration layer
- RINEX observation/navigation files (via “example/data” or user-provided).
- GNSS products: orbit/clock/bias (downloaded by scripts).
- Configuration files and atmospheric grids (under “table/”).
B. Pre-processing & data preparation
- tedit module: RINEX quality checks & editing.
- redig module: cycle-slip detection and flagging of residuals.
- scripts/pdp3.sh: master orchestration script for data download & parameter dispatch.
C. Core computation engines
- spp (single point positioning)
- arsig (phase-bias alignment & ambiguity candidate search)
- lsq (least-squares estimator for parameter adjustment)
- mhm (multipath hemispherical map compensation)
- orbit (kinematic orbit determination for LEO)
- otl (ocean tide loading correction)
- utils (common utilities)
– Each subfolder in src implements one module with its own Makefile.
D. Post-processing & results
- scripts/plot*.sh & plot*.py for visualization.
- CLI outputs: .kin, .res, .amb, .ztd, .htg, etc.
- example/results_ref for regression tests and reference outputs.
E. User interface
- GUI executables in gui/: thin wrapper invoking pdp3.sh under the hood.
- install.sh for environment setup.

##### Relationships & data flows
1. User invokes GUI or pdp3.sh (entry point) →
2. pdp3.sh downloads GNSS products and invokes tedit/redig for raw data cleaning →
3. Pre-processed RINEX + bias products are fed into spp to compute initial position and residuals →
4. arsig reads residuals & bias streams to search/fix ambiguities →
5. lsq performs parameter estimation (epoch by epoch or multi-day) using utilities & lib routines →
6. mhm, orbit, otl modules are called as optional sub-steps (controlled by flags) →
7. Final result files are written; plot scripts can be run.

##### Architectural patterns & design principles
- Modular design: each GNSS correction or estimation step is isolated in its own submodule with a clear interface.
- Pipeline/orchestration: pdp3.sh glues modules in a linear data‐flow pipeline.
- Layered: data‐preparation → core computation → result visualization.
- Reusability: “lib” contains shared numerical routines; “utils” has common helpers; all core modules call them.
- Configurable: behavior is controlled by command-line flags and a “config_template” under table/.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input & Configuration Layer
    subgraph "Input & Configuration"
        RINEX["RINEX Obs & Nav Files"]:::external
        ATM["Config Files & Atmospheric Grids"]:::external
    end

    %% Orchestration Layer
    subgraph "Orchestration Layer"
        PDP["pdp3.sh"]:::shell
    end

    %% Pre-processing Modules
    subgraph "Pre-processing & Data Preparation"
        TEDIT["tedit"]:::shell
        REDIG["redig"]:::shell
    end

    %% Core Computation Engines
    subgraph "Core Computation Engines"
        SPP["spp"]:::engine
        ARS["arsig"]:::engine
        LSQ["lsq"]:::engine
        MHM["mhm"]:::engine
        ORB["orbit"]:::engine
        OTL["otl"]:::engine
    end

    %% Shared Libraries
    subgraph "Shared Libraries"
        LIB["lib"]:::lib
        UTIL["utils"]:::lib
    end

    %% Post-processing & Visualization
    subgraph "Post-processing & Results"
        PLOTS["Post-processing & Visualization Scripts"]:::shell
        RESULTS["Reference Results & Outputs"]:::external
    end

    %% User Interface & Setup
    subgraph "User Interface & Setup"
        GUI["GUI Wrapper"]:::gui
        INSTALL["install.sh"]:::shell
    end

    %% Data Flow Connections
    RINEX --> PDP
    ATM --> PDP
    GUI --> PDP
    INSTALL --> PDP

    PDP --> TEDIT
    TEDIT --> REDIG
    REDIG --> SPP
    SPP --> ARS
    ARS --> LSQ

    LSQ --> MHM
    LSQ --> ORB
    LSQ --> OTL

    LSQ --> RESULTS
    PLOTS --> RESULTS

    %% Library Dependencies
    SPP -->|uses| LIB
    ARS -->|uses| LIB
    LSQ -->|uses| LIB
    MHM -->|uses| UTIL
    ORB -->|uses| UTIL
    OTL -->|uses| UTIL

    %% Click Events
    click RINEX "https://github.com/pridelab/pride-pppar/tree/master/example/data"
    click ATM "https://github.com/pridelab/pride-pppar/tree/master/table/"
    click PDP "https://github.com/pridelab/pride-pppar/blob/master/scripts/pdp3.sh"
    click TEDIT "https://github.com/pridelab/pride-pppar/tree/master/src/tedit/"
    click REDIG "https://github.com/pridelab/pride-pppar/tree/master/src/redig/"
    click SPP "https://github.com/pridelab/pride-pppar/tree/master/src/spp/"
    click ARS "https://github.com/pridelab/pride-pppar/tree/master/src/arsig/"
    click LSQ "https://github.com/pridelab/pride-pppar/tree/master/src/lsq/"
    click MHM "https://github.com/pridelab/pride-pppar/tree/master/src/mhm/"
    click ORB "https://github.com/pridelab/pride-pppar/tree/master/src/orbit/"
    click OTL "https://github.com/pridelab/pride-pppar/tree/master/src/otl/"
    click LIB "https://github.com/pridelab/pride-pppar/tree/master/src/lib/"
    click UTIL "https://github.com/pridelab/pride-pppar/tree/master/src/utils/"
    click PLOTS "https://github.com/pridelab/pride-pppar/blob/master/scripts/plotkin.sh"
    click RESULTS "https://github.com/pridelab/pride-pppar/tree/master/example/results_ref/"
    click GUI "https://github.com/pridelab/pride-pppar/blob/master/gui/pride_pppar_macGUI.zip"
    click INSTALL "https://github.com/pridelab/pride-pppar/blob/master/install.sh"

    %% Styles
    classDef shell fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef engine fill:#90EE90,stroke:#000,stroke-width:1px
    classDef lib fill:#FFA500,stroke:#000,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef gui fill:#DDA0DD,stroke:#000,stroke-width:1px
```
