# aima0749/ligoproject architecture

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

- Interactive diagram: https://gitdiagram.com/aima0749/ligoproject
- Repository: https://github.com/aima0749/ligoproject

## Overview

This repository develops and evaluates autoencoder-based anomaly scores for gravitational-wave data, comparing image-based CNNs with dense, convolutional, and recurrent models on short strain slices. The main workflow is to load prepared dataset splits, train against training data with validation-based stopping, score validation glitches, and report detection metrics; CNN test evaluation is an explicit option. Separate scripts explore latent-density, strain-energy, and reconstruction-score alternatives. The README is empty, so product context and relationships here rely on the sampled source and source index; the dataset itself is not included in the tree.

Main entry points: [`src/train_dense.py`](https://github.com/aima0749/ligoproject/blob/master/src/train_dense.py) (Dense and slice training), [`src/train_cnn.py`](https://github.com/aima0749/ligoproject/blob/master/src/train_cnn.py) (CNN training), [`src/common.py`](https://github.com/aima0749/ligoproject/blob/master/src/common.py) (Data loading and scaling), [`src/score_latent.py`](https://github.com/aima0749/ligoproject/blob/master/src/score_latent.py) (Latent-density scoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model training"]
  node_dense_trainer["Dense and slice training<br/>[train_dense.py]"]
  node_cnn_trainer["CNN training<br/>[train_cnn.py]"]
  node_cnn_model["CNN autoencoder<br/>[models.py]"]
  node_configs["Model configurations"]
end

subgraph group_shared["Shared data and evaluation"]
  node_shared_data["Data loading and scaling<br/>[common.py]"]
  node_shared_eval["Scoring and reporting<br/>[common.py]"]
end

subgraph group_analysis["Score analysis"]
  node_latent_analysis["Latent-density scoring<br/>[score_latent.py]"]
  node_strain_analysis["Strain-energy control<br/>[score_strain.py]"]
  node_variant_analysis["CNN score variants<br/>[score_variants.py]"]
end

subgraph group_state["Run state"]
  node_run_log[("Run log<br/>[run_log.csv]")]
end

node_researcher(("Researcher"))
node_dataset[("Prepared GW dataset")]

node_researcher -->|"runs training"| node_dense_trainer
node_researcher -->|"runs training"| node_cnn_trainer
node_researcher -->|"runs analysis"| node_latent_analysis
node_researcher -->|"runs analysis"| node_strain_analysis
node_researcher -->|"runs analysis"| node_variant_analysis
node_dense_trainer -->|"reads config"| node_configs
node_cnn_trainer -->|"reads config"| node_configs
node_dense_trainer -->|"loads splits"| node_shared_data
node_cnn_trainer -->|"loads splits"| node_shared_data
node_shared_data -->|"reads files"| node_dataset
node_cnn_trainer -->|"instantiates"| node_cnn_model
node_dense_trainer -->|"reports metrics"| node_shared_eval
node_cnn_trainer -->|"reports metrics"| node_shared_eval
node_dense_trainer -->|"appends run"| node_run_log
node_cnn_trainer -->|"appends run"| node_run_log
node_latent_analysis -->|"uses encoder"| node_dense_trainer
node_latent_analysis -->|"loads splits"| node_shared_data
node_latent_analysis -->|"reports scores"| node_shared_eval
node_strain_analysis -->|"uses slice helpers"| node_dense_trainer
node_strain_analysis -->|"loads pictures"| node_shared_data
node_strain_analysis -->|"reports scores"| node_shared_eval
node_variant_analysis -->|"scores model"| node_cnn_model
node_variant_analysis -->|"loads splits"| node_shared_data
node_variant_analysis -->|"reports scores"| node_shared_eval

click node_dense_trainer "https://github.com/aima0749/ligoproject/blob/master/src/train_dense.py"
click node_cnn_trainer "https://github.com/aima0749/ligoproject/blob/master/src/train_cnn.py"
click node_cnn_model "https://github.com/aima0749/ligoproject/blob/master/src/models.py"
click node_configs "https://github.com/aima0749/ligoproject/tree/master/config"
click node_shared_data "https://github.com/aima0749/ligoproject/blob/master/src/common.py"
click node_shared_eval "https://github.com/aima0749/ligoproject/blob/master/src/common.py"
click node_latent_analysis "https://github.com/aima0749/ligoproject/blob/master/src/score_latent.py"
click node_strain_analysis "https://github.com/aima0749/ligoproject/blob/master/src/score_strain.py"
click node_variant_analysis "https://github.com/aima0749/ligoproject/blob/master/src/score_variants.py"
click node_run_log "https://github.com/aima0749/ligoproject/blob/master/runs/run_log.csv"

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_dense_trainer,node_cnn_trainer,node_cnn_model,node_configs toneBlue
class node_shared_data,node_shared_eval,node_dataset toneAmber
class node_latent_analysis,node_strain_analysis,node_variant_analysis toneMint
class node_run_log toneRose
class node_researcher toneIndigo
```

## Components

### Model training

- [Dense and slice training](https://github.com/aima0749/ligoproject/blob/master/src/train_dense.py): `src/train_dense.py`
- [CNN training](https://github.com/aima0749/ligoproject/blob/master/src/train_cnn.py): `src/train_cnn.py`
- [CNN autoencoder](https://github.com/aima0749/ligoproject/blob/master/src/models.py): `src/models.py`
- [Model configurations](https://github.com/aima0749/ligoproject/tree/master/config): `config`

### Shared data and evaluation

- [Data loading and scaling](https://github.com/aima0749/ligoproject/blob/master/src/common.py): `src/common.py`
- [Scoring and reporting](https://github.com/aima0749/ligoproject/blob/master/src/common.py): `src/common.py`

### Score analysis

- [Latent-density scoring](https://github.com/aima0749/ligoproject/blob/master/src/score_latent.py): `src/score_latent.py`
- [Strain-energy control](https://github.com/aima0749/ligoproject/blob/master/src/score_strain.py): `src/score_strain.py`
- [CNN score variants](https://github.com/aima0749/ligoproject/blob/master/src/score_variants.py): `src/score_variants.py`

### Run state

- [Run log](https://github.com/aima0749/ligoproject/blob/master/runs/run_log.csv): `runs/run_log.csv`

### Other components

- **Researcher**
- **Prepared GW dataset**

## Connections

- Researcher → Dense and slice training: runs training (evidence: `src/train_dense.py`)
- Researcher → CNN training: runs training (evidence: `src/train_cnn.py`)
- Researcher → Latent-density scoring: runs analysis (evidence: `src/score_latent.py`)
- Researcher → Strain-energy control: runs analysis (evidence: `src/score_strain.py`)
- Researcher → CNN score variants: runs analysis (evidence: `src/score_variants.py`)
- Dense and slice training → Model configurations: reads config (evidence: `src/train_dense.py`)
- CNN training → Model configurations: reads config (evidence: `src/train_cnn.py`)
- Dense and slice training → Data loading and scaling: loads splits (evidence: `src/train_dense.py`)
- CNN training → Data loading and scaling: loads splits (evidence: `src/train_cnn.py`)
- Data loading and scaling → Prepared GW dataset: reads files (evidence: `src/common.py`)
- CNN training → CNN autoencoder: instantiates (evidence: `src/train_cnn.py`)
- Dense and slice training → Scoring and reporting: reports metrics (evidence: `src/train_dense.py`)
- CNN training → Scoring and reporting: reports metrics (evidence: `src/train_cnn.py`)
- Dense and slice training → Run log: appends run (evidence: `src/train_dense.py`)
- CNN training → Run log: appends run (evidence: `src/train_cnn.py`)
- Latent-density scoring → Dense and slice training: uses encoder (evidence: `src/score_latent.py`)
- Latent-density scoring → Data loading and scaling: loads splits (evidence: `src/score_latent.py`)
- Latent-density scoring → Scoring and reporting: reports scores (evidence: `src/score_latent.py`)
- Strain-energy control → Dense and slice training: uses slice helpers (evidence: `src/score_strain.py`)
- Strain-energy control → Data loading and scaling: loads pictures (evidence: `src/score_strain.py`)
- Strain-energy control → Scoring and reporting: reports scores (evidence: `src/score_strain.py`)
- CNN score variants → CNN autoencoder: scores model (evidence: `src/score_variants.py`)
- CNN score variants → Data loading and scaling: loads splits (evidence: `src/score_variants.py`)
- CNN score variants → Scoring and reporting: reports scores (evidence: `src/score_variants.py`)
