# jikrant3/sed-analysis-tools architecture

> Architecture diagram of the GitHub repository jikrant3/sed-analysis-tools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jikrant3/sed-analysis-tools
- Repository: https://github.com/jikrant3/sed-analysis-tools

## Overview

##### Project Type and Purpose
- This is an open-source Python library (sed_analysis_tools) for modeling, fitting, and analyzing single and binary spectral energy distributions (SEDs).
- It provides programmatic APIs, downloads required astrophysical models and filter curves into a local cache, and renders plots/notebooks to explore results.

##### File Structure
- Top-level:
- sed_analysis_tools/            ← main Python package
- tests/                         ← unit tests
- examples/                      ← Jupyter notebooks demonstrating usage
- docs/                          ← Sphinx-generated documentation site
- dist/, .github/workflows/      ← packaging artifacts & CI pipeline
- setup.py, sed_analysis_tools.egg-info/, LICENSE, README.md
- Inside sed_analysis_tools/:
- __init__.py
- sed_analysis_tools.py         ← core modules: data download, SED grid generator, fitter, utilities

##### Extract README Insights
- Dependencies: astropy, numpy, pandas, scipy, matplotlib, tqdm.
- On-demand download of isochrone & filter data into user’s ~/.sed_analysis_tools/ cache.
- Example workflows in examples/; publication code & plots.

a. Main Components
1) Client Layer
- User scripts or notebooks (examples/) invoking library APIs
2) Library Core
- sed_analysis_tools Package
- DataManager: download & cache remote astrophysical models & filters
- GridGenerator: build SED grids for single/binary stars
- Fitter: fit observed SED to grid, estimate parameters & errors
- Plotter/Utils: visualization routines (matplotlib-backed)
3) External Dependencies
- astropy, numpy, pandas, scipy, tqdm, matplotlib
4) Data Cache
- Local folder (~/.sed_analysis_tools/) for downloaded models
5) External Data Sources
- Remote repositories of isochrones, filter curves
6) CI/Distribution
- GitHub Actions workflow (python-publish.yml) for build & publishing to PyPI
- Packaging via setup.py → dist/

b. Relationships & Interactions
- Notebooks → call Library Core APIs
- Library Core ↔ DataManager ↔ Local Cache ↔ External Data Sources
- Core modules use Dependencies for computation & plotting
- CI pipeline picks up code, runs tests, builds wheel & sdist, publishes to PyPI

c. Architectural Patterns & Principles
- Modular package structure: separation of concerns (data I/O, computation, visualization)
- Lazy data provisioning: DataManager fetches on demand into cache
- Reusable core functions exposed via clean API for scripts & notebooks
- Test suite ensures correctness (DRY, single responsibility)

d. Key Technologies & Frameworks
- Python ≥3.10
- Sphinx for docs
- GitHub Actions for CI/CD
- PyPI packaging (setup.py, wheel, sdist)
- Jupyter notebooks for examples

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Client Layer"
        NB["User Notebooks\n(examples/)"]:::client
    end

    subgraph "Core Package"
        ROOT["Package Root\n(__init__.py)"]:::core
        MODULE["Core Modules\n(DataManager, GridGenerator, Fitter, Plotter)"]:::core
        TEST["Unit Tests\n(tests/test.py)"]:::core
        DOC_SRC["Docs Source\n(docs/_sources/)"]:::core
        EGG["Egg-Info Metadata\n(sed_analysis_tools.egg-info/)"]:::core
    end

    subgraph "External Systems"
        EXT_DEP["External Dependencies\n(astropy, numpy, pandas, scipy, matplotlib, tqdm)"]:::external
        EXT_DATA["Astro Data Sources"]:::external
        CACHE["Local Cache\n(~/.sed_analysis_tools/)"]:::external
        DOC_HTML["Built Documentation\n(docs/)"]:::external
    end

    subgraph "CI & Packaging"
        CI["CI Pipeline\n(python-publish.yml)"]:::ci
        SETUP["Packaging Script\n(setup.py)"]:::ci
        DIST["Distribution Artifacts\n(dist/)"]:::ci
        PYPI["PyPI"]:::external
    end

    NB -->|"import API"| ROOT
    ROOT -->|"implements modules"| MODULE
    MODULE -->|"uses"| EXT_DEP
    MODULE -->|"read/write cache"| CACHE
    CACHE -->|"download models"| EXT_DATA
    MODULE -->|"generate docs"| DOC_SRC
    DOC_SRC -->|"build HTML"| DOC_HTML
    TEST -->|"tests APIs"| MODULE
    CI -->|"runs tests"| TEST
    CI -->|"builds package"| SETUP
    SETUP -->|"creates artifacts"| DIST
    DIST -->|"publish"| PYPI

    click NB "https://github.com/jikrant3/sed-analysis-tools/tree/main/examples/"
    click ROOT "https://github.com/jikrant3/sed-analysis-tools/blob/main/sed_analysis_tools/__init__.py"
    click MODULE "https://github.com/jikrant3/sed-analysis-tools/blob/main/sed_analysis_tools/sed_analysis_tools.py"
    click TEST "https://github.com/jikrant3/sed-analysis-tools/blob/main/tests/test.py"
    click CI "https://github.com/jikrant3/sed-analysis-tools/blob/main/.github/workflows/python-publish.yml"
    click SETUP "https://github.com/jikrant3/sed-analysis-tools/blob/main/setup.py"
    click DIST "https://github.com/jikrant3/sed-analysis-tools/tree/main/dist/"
    click DOC_SRC "https://github.com/jikrant3/sed-analysis-tools/tree/main/docs/_sources/"
    click DOC_HTML "https://github.com/jikrant3/sed-analysis-tools/tree/main/docs/"
    click EGG "https://github.com/jikrant3/sed-analysis-tools/tree/main/sed_analysis_tools.egg-info/"

    classDef client fill:#D0E8FF,stroke:#0066CC
    classDef core fill:#DFF2D8,stroke:#228B22
    classDef external fill:#FFE5B4,stroke:#FF8C00
    classDef ci fill:#F0F0F0,stroke:#A9A9A9
```
