# julioanzaldo/telemetry-anomdet architecture

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

- Interactive diagram: https://gitdiagram.com/julioanzaldo/telemetry-anomdet
- Repository: https://github.com/julioanzaldo/telemetry-anomdet

## Overview

telemetry-anomdet is a spacecraft-telemetry anomaly detection toolkit. Its principal workflow loads telemetry, cleans and windows it, scores nominally trained detectors, and flags unusual windows using a learned or operator-supplied threshold. It also combines detector scores, supports event-aware evaluation, and can distill KANGDN into C for embedded deployment. The graph reflects the documented pipeline and sampled implementation; some subsystem wiring, especially unsampled deep-model internals and deployment handoff, is documented but not directly verified in the excerpts.

Main entry points: [`src/telemetry_anomdet/models/deep`](https://github.com/julioanzaldo/telemetry-anomdet/tree/main/src/telemetry_anomdet/models/deep) (Graph deep detectors), [`src/telemetry_anomdet/evaluation.py`](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/evaluation.py) (Event evaluation), [`src/telemetry_anomdet/models/ensemble.py`](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/models/ensemble.py) (Score ensemble), [`src/telemetry_anomdet/models/unsupervised`](https://github.com/julioanzaldo/telemetry-anomdet/tree/main/src/telemetry_anomdet/models/unsupervised) (Classical detectors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Telemetry Data"]
  node_smap["SMAP / MSL loader<br/>[smap.py]"]
  node_csv["CSV loader<br/>[csv_loader.py]"]
  node_ccsds["CCSDS loader<br/>[ccsds_loader.py]"]
  node_dataset["Telemetry dataset<br/>[dataset.py]"]
  node_preprocessing["Cleaning and resampling<br/>[preprocessing.py]"]
  node_features["Windowing and features<br/>[features.py]"]
end

subgraph group_detection["Detection"]
  node_base["Detector interface<br/>[base.py]"]
  node_classical["Classical detectors"]
  node_deep["Graph deep detectors"]
  node_ensemble["Score ensemble<br/>[ensemble.py]"]
end

subgraph group_operations["Alarms and Evaluation"]
  node_threshold["Alarm thresholds<br/>[thresholding.py]"]
  node_evaluation["Event evaluation<br/>[evaluation.py]"]
end

subgraph group_deployment["Flight Deployment"]
  node_distill["KANGDN distillation<br/>[distill.py]"]
  node_codegen["C code generation<br/>[codegen.py]"]
  node_host["Host C target<br/>[main.c]"]
  node_esp["ESP32-S3 target<br/>[main.c]"]
end

node_operator(("Toolkit user"))
node_labels["Benchmark labels"]

node_operator -->|"loads benchmark data"| node_smap
node_operator -->|"loads telemetry"| node_csv
node_operator -.->|"loads packets"| node_ccsds
node_smap -->|"creates dataset"| node_dataset
node_csv -->|"creates dataset"| node_dataset
node_ccsds -.->|"creates dataset"| node_dataset
node_operator -->|"applies cleaning"| node_preprocessing
node_dataset -->|"provides telemetry"| node_preprocessing
node_preprocessing -->|"prepares series"| node_features
node_operator -->|"requests windows"| node_features
node_features -->|"provides windows"| node_base
node_classical -->|"implements interface"| node_base
node_deep -->|"implements interface"| node_base
node_operator -->|"fits and scores"| node_ensemble
node_ensemble -->|"calls detectors"| node_classical
node_ensemble -->|"calls detectors"| node_deep
node_operator -->|"fits or scores"| node_classical
node_operator -->|"fits or scores"| node_deep
node_base -->|"selects alarm cutoff"| node_threshold
node_operator -->|"sets operating point"| node_threshold
node_operator -->|"evaluates scores"| node_evaluation
node_ensemble -->|"provides scores"| node_evaluation
node_classical -->|"provides scores"| node_evaluation
node_deep -->|"provides scores"| node_evaluation
node_labels -->|"provides ground truth"| node_evaluation
node_operator -->|"distills fitted model"| node_distill
node_deep -->|"provides KANGDN model"| node_distill
node_distill -->|"provides specification"| node_codegen
node_codegen -->|"emits C detector"| node_host
node_codegen -->|"emits C detector"| node_esp

click node_smap "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/ingest/smap.py"
click node_csv "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/ingest/csv_loader.py"
click node_ccsds "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/ingest/ccsds_loader.py"
click node_dataset "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/ingest/dataset.py"
click node_preprocessing "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/preprocessing/preprocessing.py"
click node_features "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/feature_extraction/features.py"
click node_base "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/models/base.py"
click node_classical "https://github.com/julioanzaldo/telemetry-anomdet/tree/main/src/telemetry_anomdet/models/unsupervised"
click node_deep "https://github.com/julioanzaldo/telemetry-anomdet/tree/main/src/telemetry_anomdet/models/deep"
click node_ensemble "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/models/ensemble.py"
click node_threshold "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/thresholding.py"
click node_evaluation "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/evaluation.py"
click node_distill "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/models/deep/distill.py"
click node_codegen "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/models/deep/codegen.py"
click node_host "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/targets/host/main.c"
click node_esp "https://github.com/julioanzaldo/telemetry-anomdet/blob/main/targets/esp32s3/main/main.c"

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_smap,node_csv,node_ccsds,node_dataset,node_preprocessing,node_features,node_operator toneBlue
class node_base,node_classical,node_deep,node_ensemble toneAmber
class node_threshold,node_evaluation toneMint
class node_distill,node_codegen,node_host,node_esp toneRose
class node_labels toneIndigo
```

## Components

### Telemetry Data

- [SMAP / MSL loader](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/ingest/smap.py): `src/telemetry_anomdet/ingest/smap.py`
- [CSV loader](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/ingest/csv_loader.py): `src/telemetry_anomdet/ingest/csv_loader.py`
- [CCSDS loader](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/ingest/ccsds_loader.py): `src/telemetry_anomdet/ingest/ccsds_loader.py`
- [Telemetry dataset](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/ingest/dataset.py): `src/telemetry_anomdet/ingest/dataset.py`
- [Cleaning and resampling](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/preprocessing/preprocessing.py): `src/telemetry_anomdet/preprocessing/preprocessing.py`
- [Windowing and features](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/feature_extraction/features.py): `src/telemetry_anomdet/feature_extraction/features.py`

### Detection

- [Detector interface](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/models/base.py): `src/telemetry_anomdet/models/base.py`
- [Classical detectors](https://github.com/julioanzaldo/telemetry-anomdet/tree/main/src/telemetry_anomdet/models/unsupervised): `src/telemetry_anomdet/models/unsupervised`
- [Graph deep detectors](https://github.com/julioanzaldo/telemetry-anomdet/tree/main/src/telemetry_anomdet/models/deep): `src/telemetry_anomdet/models/deep`
- [Score ensemble](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/models/ensemble.py): `src/telemetry_anomdet/models/ensemble.py`

### Alarms and Evaluation

- [Alarm thresholds](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/thresholding.py): `src/telemetry_anomdet/thresholding.py`
- [Event evaluation](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/evaluation.py): `src/telemetry_anomdet/evaluation.py`

### Flight Deployment

- [KANGDN distillation](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/models/deep/distill.py): `src/telemetry_anomdet/models/deep/distill.py`
- [C code generation](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/src/telemetry_anomdet/models/deep/codegen.py): `src/telemetry_anomdet/models/deep/codegen.py`
- [Host C target](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/targets/host/main.c): `targets/host/main.c`
- [ESP32-S3 target](https://github.com/julioanzaldo/telemetry-anomdet/blob/main/targets/esp32s3/main/main.c): `targets/esp32s3/main/main.c`

### Other components

- **Toolkit user**
- **Benchmark labels**

## Connections

- Toolkit user → SMAP / MSL loader: loads benchmark data
- Toolkit user → CSV loader: loads telemetry
- Toolkit user → CCSDS loader: loads packets
- SMAP / MSL loader → Telemetry dataset: creates dataset
- CSV loader → Telemetry dataset: creates dataset
- CCSDS loader → Telemetry dataset: creates dataset
- Toolkit user → Cleaning and resampling: applies cleaning
- Telemetry dataset → Cleaning and resampling: provides telemetry
- Cleaning and resampling → Windowing and features: prepares series
- Toolkit user → Windowing and features: requests windows
- Windowing and features → Detector interface: provides windows
- Classical detectors → Detector interface: implements interface
- Graph deep detectors → Detector interface: implements interface
- Toolkit user → Score ensemble: fits and scores
- Score ensemble → Classical detectors: calls detectors
- Score ensemble → Graph deep detectors: calls detectors
- Toolkit user → Classical detectors: fits or scores
- Toolkit user → Graph deep detectors: fits or scores
- Detector interface → Alarm thresholds: selects alarm cutoff
- Toolkit user → Alarm thresholds: sets operating point
- Toolkit user → Event evaluation: evaluates scores
- Score ensemble → Event evaluation: provides scores
- Classical detectors → Event evaluation: provides scores
- Graph deep detectors → Event evaluation: provides scores
- Benchmark labels → Event evaluation: provides ground truth
- Toolkit user → KANGDN distillation: distills fitted model
- Graph deep detectors → KANGDN distillation: provides KANGDN model
- KANGDN distillation → C code generation: provides specification
- C code generation → Host C target: emits C detector
- C code generation → ESP32-S3 target: emits C detector
