# reddtea/astroemperor architecture

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

- Interactive diagram: https://gitdiagram.com/reddtea/astroemperor
- Repository: https://github.com/reddtea/astroemperor

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Core Engine Layer:
- MCMC (Markov Chain Monte Carlo) Sampling Engine
- Parallel Tempering System
- Model Selection Framework

b) Data Processing Layer:
- Data Input/Output Handler
- Parameter Repository
- Model Repository
- Block Repository

c) Analysis Layer:
- Astrometry Processing
- Signal Detection
- Noise Modeling
- Convergence Testing

**[Data Input] → [Core Processing] → [Analysis & Output]**
- ↑              ↑                     ↑
- [Configuration System]────────┘

##### Component Relationships

Key interactions:

- Feedback loops for iterative processes

##### Technical Details to Highlight

- Integration with external libraries (numpy, scipy, emcee)
- Support for multiple parameterization methods
- Parallel processing capabilities
- Data validation and error handling

Create distinct sections for:
a) Configuration Management
- Parameter settings
- Model selection criteria
- Prior definitions

b) Core Processing
- MCMC implementation
- Parallel tempering
- Signal detection

c) Analysis Tools
- Statistical analysis
- Visualization
- Results export

##### Implementation Notes

- Use standardized UML notation where appropriate
- Version information and dependency requirements
- Document the parallel processing options

Remember to include the key file structure elements from the src/astroemperor directory, particularly highlighting the relationship between the core modules (astrometry.py, main_body.py) and support infrastructure (models, priors, and configuration files).

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        DI[Data Input]:::input
        CP[Configuration Parameters]:::config
        click CP "https://github.com/ReddTea/astroemperor/blob/main/src/astroemperor/support/*.scr"
        PD["Prior Definitions"]:::config
        click PD "https://github.com/ReddTea/astroemperor/tree/main/src/astroemperor/support/priors/"
        MT["Model Templates"]:::config
        click MT "https://github.com/ReddTea/astroemperor/tree/main/src/astroemperor/support/models/"
    end

    subgraph "Core Engine"
        MCMC["MCMC/Parallel Tempering Engine"]:::core
        click MCMC "https://github.com/ReddTea/astroemperor/tree/main/src/astroemperor/fpts/"
        MSF["Model Selection Framework"]:::core
        click MSF "https://github.com/ReddTea/astroemperor/blob/main/src/astroemperor/model_repo.py"
        MPE["Main Processing Engine"]:::core
        click MPE "https://github.com/ReddTea/astroemperor/blob/main/src/astroemperor/main_body.py"
    end

    subgraph "Data Processing"
        PR["Parameter Repository"]:::processing
        click PR "https://github.com/ReddTea/astroemperor/blob/main/src/astroemperor/param_repo.py"
        BR["Block Repository"]:::processing
        click BR "https://github.com/ReddTea/astroemperor/blob/main/src/astroemperor/block_repo.py"
        LC["Likelihood Calculations"]:::processing
        click LC "https://github.com/ReddTea/astroemperor/tree/main/src/astroemperor/support/likelihoods/"
    end

    subgraph Analysis
        AP["Astrometry Processing"]:::analysis
        click AP "https://github.com/ReddTea/astroemperor/blob/main/src/astroemperor/astrometry.py"
        SD["Signal Detection"]:::analysis
        NM["Noise Models"]:::analysis
        click NM "https://github.com/ReddTea/astroemperor/tree/main/src/astroemperor/support/models/"
        CT["Convergence Testing"]:::analysis
    end

    subgraph Output
        PV["Plotting/Visualization"]:::output
        click PV "https://github.com/ReddTea/astroemperor/blob/main/src/astroemperor/plot_trace.py"
        PD1["Posterior Distributions"]:::output
        PC["Phase-folded Curves"]:::output
        SA["Statistical Analysis"]:::output
    end

    DI --> PR
    CP --> PR
    PD --> MSF
    MT --> MSF

    PR --> MCMC
    BR --> MCMC
    MCMC --> MSF
    MSF --> MPE
    MPE --> LC
    LC --> AP

    AP --> SD
    SD --> NM
    NM --> CT
    CT --> PV
    CT --> PD1
    CT --> PC
    CT --> SA

    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef input fill:#4CAF50,stroke:#2E7D32,color:white
    classDef config fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef processing fill:#FF9800,stroke:#EF6C00,color:white
    classDef analysis fill:#FFC107,stroke:#FFA000,color:black
    classDef output fill:#00BCD4,stroke:#00838F,color:white

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Input Components]:::input
        L3[Configuration]:::config
        L4[Processing]:::processing
        L5[Analysis]:::analysis
        L6[Output]:::output
    end
```
