# harshgounder/lunar-tie-r0 architecture

> Architecture diagram of the GitHub repository harshgounder/lunar-tie-r0, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshgounder/lunar-tie-r0
- Repository: https://github.com/harshgounder/lunar-tie-r0

## Overview

lunar-tie-r0 is a classical Chandrayaan-2 lunar image-registration pipeline that produces subpixel tie points and tier-stamped quality results. The principal workflow is to prepare an image pair, detect and match features, estimate and refine their geometry, assess spatial coverage, and issue conformal accept/reject/abstain decisions; `pipeline.py` is the documented runtime entry point. The README documents these capabilities, while sampled source confirms selected ingest, geometry, and algorithm details. Wiring for unsampled modules is shown only where the README describes the pipeline spine or module role.

Main entry points: [`src/lunar_tie/pipeline.py`](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/pipeline.py) (Pair pipeline), [`src/lunar_tie/realdata.py`](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/realdata.py) (Crop-pair ingest), [`src/lunar_tie/ch2_ingest.py`](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/ch2_ingest.py) (Product ZIP ingest), [`src/lunar_tie/geometry.py`](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/geometry.py) (Geometry lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Ingest and Georeference"]
  node_pds3["PDS3 labels<br/>[pds3label.py]"]
  node_pds4["PDS4 labels<br/>[pds4label.py]"]
  node_ingestzip["Product ZIP ingest<br/>[ch2_ingest.py]"]
  node_realdata["Crop-pair ingest<br/>[realdata.py]"]
  node_geometry["Geometry lookup<br/>[geometry.py]"]
  node_sunangles["Sun-angle parsing<br/>[sun_angles.py]"]
  node_spiceangles["SPICE angles<br/>[spice_angles.py]"]
end

subgraph group_prepare["Image Preparation"]
  node_masking["Image masks<br/>[masking.py]"]
  node_tiling["Memory-map tiling<br/>[tiling.py]"]
  node_photometric["Photometric normalization<br/>[photometric.py]"]
  node_resample["Common-GSD resampling<br/>[resample.py]"]
end

subgraph group_register["Tie Registration"]
  node_pipeline["Pair pipeline<br/>[pipeline.py]"]
  node_detect["Feature detect and match<br/>[detect.py]"]
  node_consensus["Geometric consensus<br/>[consensus.py]"]
  node_subpixel["Subpixel refinement<br/>[subpixel.py]"]
end

subgraph group_assess["Quality and Results"]
  node_coverage["Coverage and ANMS<br/>[coverage.py]"]
  node_conformal["Conformal quality gates<br/>[conformal.py]"]
  node_artifacts["Panel and ties"]
end

node_user(("Pipeline user"))
node_product["CH-2 products"]
node_geometrydata["Geometry CSV"]
node_spice["SPICE kernels"]

node_user -->|"runs pair"| node_pipeline
node_product -->|"provides archive"| node_ingestzip
node_ingestzip -->|"parses label"| node_pds4
node_realdata -->|"discovers products"| node_ingestzip
node_realdata -->|"queries geometry"| node_geometry
node_geometrydata -->|"supplies grid"| node_geometry
node_realdata -->|"writes pair manifest"| node_pipeline
node_pipeline -->|"uses labels"| node_pds3
node_pipeline -->|"runs masking"| node_masking
node_pipeline -->|"runs tiling"| node_tiling
node_pipeline -->|"normalizes images"| node_photometric
node_pipeline -->|"matches shapes"| node_resample
node_pipeline -->|"matches features"| node_detect
node_pipeline -->|"fits geometry"| node_consensus
node_pipeline -->|"refines ties"| node_subpixel
node_pipeline -->|"checks spread"| node_coverage
node_pipeline -->|"gates metrics"| node_conformal
node_pipeline -.->|"uses sun data"| node_sunangles
node_spice -.->|"provides kernels"| node_spiceangles
node_pipeline -.->|"extracts angles"| node_spiceangles
node_pipeline -->|"writes results"| node_artifacts

click node_pds3 "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/pds3label.py"
click node_pds4 "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/pds4label.py"
click node_ingestzip "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/ch2_ingest.py"
click node_realdata "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/realdata.py"
click node_geometry "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/geometry.py"
click node_sunangles "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/sun_angles.py"
click node_spiceangles "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/spice_angles.py"
click node_pipeline "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/pipeline.py"
click node_masking "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/masking.py"
click node_tiling "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/tiling.py"
click node_photometric "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/photometric.py"
click node_resample "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/resample.py"
click node_detect "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/detect.py"
click node_consensus "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/consensus.py"
click node_subpixel "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/subpixel.py"
click node_coverage "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/coverage.py"
click node_conformal "https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/conformal.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pds3,node_pds4,node_ingestzip,node_realdata,node_geometry,node_sunangles,node_spiceangles,node_user toneBlue
class node_masking,node_tiling,node_photometric,node_resample toneAmber
class node_pipeline,node_detect,node_consensus,node_subpixel toneMint
class node_coverage,node_conformal,node_artifacts toneRose
class node_product,node_geometrydata,node_spice toneIndigo
```

## Components

### Ingest and Georeference

- [PDS3 labels](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/pds3label.py): `src/lunar_tie/pds3label.py`
- [PDS4 labels](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/pds4label.py): `src/lunar_tie/pds4label.py`
- [Product ZIP ingest](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/ch2_ingest.py): `src/lunar_tie/ch2_ingest.py`
- [Crop-pair ingest](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/realdata.py): `src/lunar_tie/realdata.py`
- [Geometry lookup](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/geometry.py): `src/lunar_tie/geometry.py`
- [Sun-angle parsing](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/sun_angles.py): `src/lunar_tie/sun_angles.py`
- [SPICE angles](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/spice_angles.py): `src/lunar_tie/spice_angles.py`

### Image Preparation

- [Image masks](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/masking.py): `src/lunar_tie/masking.py`
- [Memory-map tiling](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/tiling.py): `src/lunar_tie/tiling.py`
- [Photometric normalization](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/photometric.py): `src/lunar_tie/photometric.py`
- [Common-GSD resampling](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/resample.py): `src/lunar_tie/resample.py`

### Tie Registration

- [Pair pipeline](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/pipeline.py): `src/lunar_tie/pipeline.py`
- [Feature detect and match](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/detect.py): `src/lunar_tie/detect.py`
- [Geometric consensus](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/consensus.py): `src/lunar_tie/consensus.py`
- [Subpixel refinement](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/subpixel.py): `src/lunar_tie/subpixel.py`

### Quality and Results

- [Coverage and ANMS](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/coverage.py): `src/lunar_tie/coverage.py`
- [Conformal quality gates](https://github.com/harshgounder/lunar-tie-r0/blob/main/src/lunar_tie/conformal.py): `src/lunar_tie/conformal.py`
- **Panel and ties**

### Other components

- **Pipeline user**
- **CH-2 products**
- **Geometry CSV**
- **SPICE kernels**

## Connections

- Pipeline user → Pair pipeline: runs pair
- CH-2 products → Product ZIP ingest: provides archive
- Product ZIP ingest → PDS4 labels: parses label
- Crop-pair ingest → Product ZIP ingest: discovers products
- Crop-pair ingest → Geometry lookup: queries geometry
- Geometry CSV → Geometry lookup: supplies grid
- Crop-pair ingest → Pair pipeline: writes pair manifest
- Pair pipeline → PDS3 labels: uses labels
- Pair pipeline → Image masks: runs masking
- Pair pipeline → Memory-map tiling: runs tiling
- Pair pipeline → Photometric normalization: normalizes images
- Pair pipeline → Common-GSD resampling: matches shapes
- Pair pipeline → Feature detect and match: matches features
- Pair pipeline → Geometric consensus: fits geometry
- Pair pipeline → Subpixel refinement: refines ties
- Pair pipeline → Coverage and ANMS: checks spread
- Pair pipeline → Conformal quality gates: gates metrics
- Pair pipeline → Sun-angle parsing: uses sun data
- SPICE kernels → SPICE angles: provides kernels
- Pair pipeline → SPICE angles: extracts angles
- Pair pipeline → Panel and ties: writes results
