# sumehrashaikh/spectra architecture

> Architecture diagram of the GitHub repository sumehrashaikh/spectra, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sumehrashaikh/spectra
- Repository: https://github.com/sumehrashaikh/spectra

## Overview

Spectra is a Python RF/IQ signal-analysis prototype. Its main workflow loads a capture, detects and isolates candidate signals, estimates parameters, synchronizes and classifies them, then demodulates and optionally decodes frames and measures BER. The same analysis is exposed through the CLI and desktop GUI, with batch analysis, reporting, provenance, optional ML assistance and GNU Radio ingest. Pipeline-stage relationships are based on the README’s documented chain; some subsystem details are not shown in source excerpts.

Main entry points: [`prototype/pipeline.py`](https://github.com/sumehrashaikh/spectra/blob/main/prototype/pipeline.py) (Analysis pipeline), [`prototype/cli.py`](https://github.com/sumehrashaikh/spectra/blob/main/prototype/cli.py) (Command line), [`prototype/gui/window.py`](https://github.com/sumehrashaikh/spectra/blob/main/prototype/gui/window.py) (Desktop GUI), [`prototype/io/loaders.py`](https://github.com/sumehrashaikh/spectra/blob/main/prototype/io/loaders.py) (Capture loaders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Signal analysis"]
  node_loaders["Capture loaders<br/>[loaders.py]"]
  node_pipeline["Analysis pipeline<br/>[pipeline.py]"]
  node_preprocess["Preprocessing<br/>[preprocessor.py]"]
  node_detection["Signal detection<br/>[detector.py]"]
  node_isolation["Candidate isolation<br/>[isolator.py]"]
  node_parameters["Parameter estimation<br/>[symbol_rate.py]"]
  node_synchronization["Carrier and timing sync<br/>[synchronization.py]"]
  node_classification["Modulation classification<br/>[classifier.py]"]
end

subgraph group_decoding["Bit and frame decoding"]
  node_demodulation["Demodulation<br/>[demodulator.py]"]
  node_deinterleaving["De-interleaving<br/>[interleaving.py]"]
  node_fec["FEC identification and decoding<br/>[identification.py]"]
  node_frame["Frame and sync-word parsing<br/>[parser.py]"]
  node_ber["BER measurement<br/>[ber.py]"]
end

subgraph group_interfaces["User interfaces"]
  node_cli["Command line<br/>[cli.py]"]
  node_gui["Desktop GUI<br/>[window.py]"]
  node_batch["Batch candidate analysis<br/>[pipeline_batch.py]"]
end

subgraph group_extensions["Optional extensions"]
  node_gnuradio["GNU Radio ingest"]
  node_ml["Optional ML assist<br/>[cnn.py]"]
  node_simulation["Channel simulation<br/>[channel.py]"]
  node_validation["External validation<br/>[evaluate.py]"]
end

subgraph group_results["Results and evidence"]
  node_provenance["Run provenance<br/>[provenance.py]"]
  node_reporting["Result export<br/>[export.py]"]
end

node_engineer(("Analyst"))
node_capture["IQ/WAV capture"]

node_engineer -->|"runs commands"| node_cli
node_engineer -->|"uses desktop app"| node_gui
node_capture -->|"loads samples"| node_loaders
node_loaders -.->|"supplies capture"| node_pipeline
node_cli -->|"runs analysis"| node_pipeline
node_gui -->|"runs analysis"| node_pipeline
node_gui -->|"requests batch analysis"| node_batch
node_batch -->|"analyzes candidates"| node_pipeline
node_pipeline -->|"preprocesses"| node_preprocess
node_pipeline -->|"detects candidates"| node_detection
node_pipeline -->|"isolates candidates"| node_isolation
node_pipeline -->|"estimates parameters"| node_parameters
node_pipeline -->|"synchronizes"| node_synchronization
node_pipeline -->|"classifies modulation"| node_classification
node_pipeline -->|"demodulates"| node_demodulation
node_pipeline -->|"de-interleaves"| node_deinterleaving
node_pipeline -->|"decodes FEC"| node_fec
node_pipeline -->|"parses configured frames"| node_frame
node_pipeline -->|"measures BER"| node_ber
node_pipeline -.->|"adds ML evidence"| node_ml
node_pipeline -->|"records run details"| node_provenance
node_pipeline -.->|"exports results"| node_reporting
node_cli -->|"requests reports"| node_reporting
node_gnuradio -->|"supplies signal"| node_pipeline
node_simulation -->|"benchmarks chain"| node_pipeline
node_validation -->|"evaluates chain"| node_pipeline

click node_loaders "https://github.com/sumehrashaikh/spectra/blob/main/prototype/io/loaders.py"
click node_pipeline "https://github.com/sumehrashaikh/spectra/blob/main/prototype/pipeline.py"
click node_preprocess "https://github.com/sumehrashaikh/spectra/blob/main/prototype/core/preprocessor.py"
click node_detection "https://github.com/sumehrashaikh/spectra/blob/main/prototype/detection/detector.py"
click node_isolation "https://github.com/sumehrashaikh/spectra/blob/main/prototype/core/isolator.py"
click node_parameters "https://github.com/sumehrashaikh/spectra/blob/main/prototype/parameters/symbol_rate.py"
click node_synchronization "https://github.com/sumehrashaikh/spectra/blob/main/prototype/core/synchronization.py"
click node_classification "https://github.com/sumehrashaikh/spectra/blob/main/prototype/modulation/classifier.py"
click node_demodulation "https://github.com/sumehrashaikh/spectra/blob/main/prototype/demodulation/demodulator.py"
click node_deinterleaving "https://github.com/sumehrashaikh/spectra/blob/main/prototype/fec/interleaving.py"
click node_fec "https://github.com/sumehrashaikh/spectra/blob/main/prototype/fec/identification.py"
click node_frame "https://github.com/sumehrashaikh/spectra/blob/main/prototype/protocol/parser.py"
click node_ber "https://github.com/sumehrashaikh/spectra/blob/main/prototype/core/ber.py"
click node_cli "https://github.com/sumehrashaikh/spectra/blob/main/prototype/cli.py"
click node_gui "https://github.com/sumehrashaikh/spectra/blob/main/prototype/gui/window.py"
click node_batch "https://github.com/sumehrashaikh/spectra/blob/main/prototype/pipeline_batch.py"
click node_gnuradio "https://github.com/sumehrashaikh/spectra/tree/main/prototype/io/gnuradio"
click node_ml "https://github.com/sumehrashaikh/spectra/blob/main/prototype/ml/cnn.py"
click node_simulation "https://github.com/sumehrashaikh/spectra/blob/main/prototype/simulation/channel.py"
click node_validation "https://github.com/sumehrashaikh/spectra/blob/main/prototype/external_validation/evaluate.py"
click node_provenance "https://github.com/sumehrashaikh/spectra/blob/main/prototype/core/provenance.py"
click node_reporting "https://github.com/sumehrashaikh/spectra/blob/main/prototype/reporting/export.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_loaders,node_pipeline,node_preprocess,node_detection,node_isolation,node_parameters,node_synchronization,node_classification toneBlue
class node_demodulation,node_deinterleaving,node_fec,node_frame,node_ber toneAmber
class node_cli,node_gui,node_batch toneMint
class node_gnuradio,node_ml,node_simulation,node_validation toneRose
class node_provenance,node_reporting,node_engineer,node_capture toneIndigo
```

## Components

### Signal analysis

- [Capture loaders](https://github.com/sumehrashaikh/spectra/blob/main/prototype/io/loaders.py): `prototype/io/loaders.py`
- [Analysis pipeline](https://github.com/sumehrashaikh/spectra/blob/main/prototype/pipeline.py): `prototype/pipeline.py`
- [Preprocessing](https://github.com/sumehrashaikh/spectra/blob/main/prototype/core/preprocessor.py): `prototype/core/preprocessor.py`
- [Signal detection](https://github.com/sumehrashaikh/spectra/blob/main/prototype/detection/detector.py): `prototype/detection/detector.py`
- [Candidate isolation](https://github.com/sumehrashaikh/spectra/blob/main/prototype/core/isolator.py): `prototype/core/isolator.py`
- [Parameter estimation](https://github.com/sumehrashaikh/spectra/blob/main/prototype/parameters/symbol_rate.py): `prototype/parameters/symbol_rate.py`
- [Carrier and timing sync](https://github.com/sumehrashaikh/spectra/blob/main/prototype/core/synchronization.py): `prototype/core/synchronization.py`
- [Modulation classification](https://github.com/sumehrashaikh/spectra/blob/main/prototype/modulation/classifier.py): `prototype/modulation/classifier.py`

### Bit and frame decoding

- [Demodulation](https://github.com/sumehrashaikh/spectra/blob/main/prototype/demodulation/demodulator.py): `prototype/demodulation/demodulator.py`
- [De-interleaving](https://github.com/sumehrashaikh/spectra/blob/main/prototype/fec/interleaving.py): `prototype/fec/interleaving.py`
- [FEC identification and decoding](https://github.com/sumehrashaikh/spectra/blob/main/prototype/fec/identification.py): `prototype/fec/identification.py`
- [Frame and sync-word parsing](https://github.com/sumehrashaikh/spectra/blob/main/prototype/protocol/parser.py): `prototype/protocol/parser.py`
- [BER measurement](https://github.com/sumehrashaikh/spectra/blob/main/prototype/core/ber.py): `prototype/core/ber.py`

### User interfaces

- [Command line](https://github.com/sumehrashaikh/spectra/blob/main/prototype/cli.py): `prototype/cli.py`
- [Desktop GUI](https://github.com/sumehrashaikh/spectra/blob/main/prototype/gui/window.py): `prototype/gui/window.py`
- [Batch candidate analysis](https://github.com/sumehrashaikh/spectra/blob/main/prototype/pipeline_batch.py): `prototype/pipeline_batch.py`

### Optional extensions

- [GNU Radio ingest](https://github.com/sumehrashaikh/spectra/tree/main/prototype/io/gnuradio): `prototype/io/gnuradio`
- [Optional ML assist](https://github.com/sumehrashaikh/spectra/blob/main/prototype/ml/cnn.py): `prototype/ml/cnn.py`
- [Channel simulation](https://github.com/sumehrashaikh/spectra/blob/main/prototype/simulation/channel.py): `prototype/simulation/channel.py`
- [External validation](https://github.com/sumehrashaikh/spectra/blob/main/prototype/external_validation/evaluate.py): `prototype/external_validation/evaluate.py`

### Results and evidence

- [Run provenance](https://github.com/sumehrashaikh/spectra/blob/main/prototype/core/provenance.py): `prototype/core/provenance.py`
- [Result export](https://github.com/sumehrashaikh/spectra/blob/main/prototype/reporting/export.py): `prototype/reporting/export.py`

### Other components

- **Analyst**
- **IQ/WAV capture**

## Connections

- Analyst → Command line: runs commands (evidence: `README.md`)
- Analyst → Desktop GUI: uses desktop app (evidence: `README.md`)
- IQ/WAV capture → Capture loaders: loads samples (evidence: `README.md`)
- Capture loaders → Analysis pipeline: supplies capture (evidence: `prototype/pipeline.py`)
- Command line → Analysis pipeline: runs analysis (evidence: `README.md`)
- Desktop GUI → Analysis pipeline: runs analysis
- Desktop GUI → Batch candidate analysis: requests batch analysis
- Batch candidate analysis → Analysis pipeline: analyzes candidates (evidence: `prototype/pipeline_batch.py`)
- Analysis pipeline → Preprocessing: preprocesses (evidence: `README.md`)
- Analysis pipeline → Signal detection: detects candidates (evidence: `prototype/pipeline.py`)
- Analysis pipeline → Candidate isolation: isolates candidates (evidence: `README.md`)
- Analysis pipeline → Parameter estimation: estimates parameters (evidence: `README.md`)
- Analysis pipeline → Carrier and timing sync: synchronizes (evidence: `README.md`)
- Analysis pipeline → Modulation classification: classifies modulation (evidence: `README.md`)
- Analysis pipeline → Demodulation: demodulates (evidence: `README.md`)
- Analysis pipeline → De-interleaving: de-interleaves (evidence: `README.md`)
- Analysis pipeline → FEC identification and decoding: decodes FEC (evidence: `README.md`)
- Analysis pipeline → Frame and sync-word parsing: parses configured frames (evidence: `README.md`)
- Analysis pipeline → BER measurement: measures BER (evidence: `README.md`)
- Analysis pipeline → Optional ML assist: adds ML evidence (evidence: `README.md`)
- Analysis pipeline → Run provenance: records run details (evidence: `README.md`)
- Analysis pipeline → Result export: exports results
- Command line → Result export: requests reports (evidence: `README.md`)
- GNU Radio ingest → Analysis pipeline: supplies signal (evidence: `prototype/io/gnuradio/gui_controller.py`)
- Channel simulation → Analysis pipeline: benchmarks chain (evidence: `README.md`)
- External validation → Analysis pipeline: evaluates chain (evidence: `README.md`)
