# baklanovp/pystella architecture

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

- Interactive diagram: https://gitdiagram.com/baklanovp/pystella
- Repository: https://github.com/baklanovp/pystella

## Overview

PySTELLA is a research toolkit for reading supernova model outputs and comparing their predicted light curves and spectra with observations. A central workflow starts with a model directory, reads its spectral output, converts it into selected photometric bands, and plots or saves the resulting curves; the shell also dispatches fitting commands. The graph includes model-output readers, photometry and plotting, observation ingestion, and fitting. Edges reflect README statements or the cited source index and excerpts; some model-family capabilities are shown without inferred call paths.

Main entry points: [`pystella/model/stella.py`](https://github.com/baklanovp/pystella/blob/master/pystella/model/stella.py) (Stella model access), [`ubv.py`](https://github.com/baklanovp/pystella/blob/master/ubv.py) (Band conversion), [`pystella/rf/band.py`](https://github.com/baklanovp/pystella/blob/master/pystella/rf/band.py) (Photometric bands), [`pystella/fit/fit_lc.py`](https://github.com/baklanovp/pystella/blob/master/pystella/fit/fit_lc.py) (Light-curve fitting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_shell["Command shell<br/>[pystella.py]"]
  node_convert["Band conversion<br/>[ubv.py]"]
  node_fitcli["Fit command<br/>[fit.py]"]
end

subgraph group_models["Model data"]
  node_stella["Stella model access<br/>[stella.py]"]
  node_eve["EVE profiles<br/>[sn_eve.py]"]
  node_swd["Shock-wave data<br/>[sn_swd.py]"]
  node_tau["Optical-depth data<br/>[sn_tau.py]"]
  node_mesa["MESA models<br/>[mesa.py]"]
  node_hdf["HDF5 model data<br/>[h5stella.py]"]
  node_phys["Physical constants<br/>[phys_var.py]"]
end

subgraph group_photometry["Photometry and plotting"]
  node_spectrum["Spectrum series<br/>[spectrum.py]"]
  node_band["Photometric bands<br/>[band.py]"]
  node_radiometry["Radiative calculations<br/>[rad_func.py]"]
  node_lightcurve["Light-curve data<br/>[lc.py]"]
  node_curvefunc["Curve calculations"]
  node_plot["Curve and model plots"]
end

subgraph group_analysis["Observations and fitting"]
  node_reader["Observation tables<br/>[reader_table.py]"]
  node_obsplugin["Observation callbacks<br/>[lcobsmix.py]"]
  node_velplugin["Velocity observations<br/>[velobs.py]"]
  node_fitcore["Light-curve fitting<br/>[fit_lc.py]"]
  node_fitmcmc["MCMC fitting<br/>[fit_mcmc.py]"]
  node_fitmp["MPFIT fitting<br/>[fit_mpfit.py]"]
  node_mpfit["Least-squares solver<br/>[mpfit.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"starts"| node_shell
node_researcher -->|"runs"| node_convert
node_shell -->|"dispatches"| node_convert
node_shell -->|"dispatches"| node_fitcli
node_convert -->|"converts model output"| node_stella
node_stella -->|"loads profiles"| node_eve
node_stella -->|"reads output"| node_swd
node_stella -->|"reads output"| node_tau
node_stella -.->|"loads spectra"| node_spectrum
node_stella -.->|"supports model data"| node_mesa
node_stella -.->|"supports model data"| node_hdf
node_spectrum -->|"computes curves"| node_band
node_band -->|"uses conversions"| node_radiometry
node_radiometry -->|"uses constants"| node_phys
node_spectrum -->|"supports calculations"| node_curvefunc
node_curvefunc -->|"builds curves"| node_lightcurve
node_plot -->|"uses band data"| node_band
node_convert -->|"plots results"| node_plot
node_reader -->|"builds curves"| node_lightcurve
node_obsplugin -->|"uses curves"| node_lightcurve
node_obsplugin -->|"uses bands"| node_band
node_velplugin -->|"reads tables"| node_reader
node_fitcli -.->|"fits observations"| node_fitcore
node_fitcore -->|"uses plotting"| node_plot
node_fitmcmc -->|"uses fit interface"| node_fitcore
node_fitmp -->|"uses fit interface"| node_fitcore
node_fitmp -->|"calls solver"| node_mpfit

click node_shell "https://github.com/baklanovp/pystella/blob/master/pystella.py"
click node_convert "https://github.com/baklanovp/pystella/blob/master/ubv.py"
click node_fitcli "https://github.com/baklanovp/pystella/blob/master/fit.py"
click node_stella "https://github.com/baklanovp/pystella/blob/master/pystella/model/stella.py"
click node_eve "https://github.com/baklanovp/pystella/blob/master/pystella/model/sn_eve.py"
click node_swd "https://github.com/baklanovp/pystella/blob/master/pystella/model/sn_swd.py"
click node_tau "https://github.com/baklanovp/pystella/blob/master/pystella/model/sn_tau.py"
click node_mesa "https://github.com/baklanovp/pystella/blob/master/pystella/model/mesa.py"
click node_hdf "https://github.com/baklanovp/pystella/blob/master/pystella/model/h5stella.py"
click node_spectrum "https://github.com/baklanovp/pystella/blob/master/pystella/rf/spectrum.py"
click node_band "https://github.com/baklanovp/pystella/blob/master/pystella/rf/band.py"
click node_radiometry "https://github.com/baklanovp/pystella/blob/master/pystella/rf/rad_func.py"
click node_lightcurve "https://github.com/baklanovp/pystella/blob/master/pystella/rf/lc.py"
click node_curvefunc "https://github.com/baklanovp/pystella/blob/master/pystella/rf/light_curve_func.py"
click node_plot "https://github.com/baklanovp/pystella/blob/master/pystella/rf/light_curve_plot.py"
click node_reader "https://github.com/baklanovp/pystella/blob/master/pystella/util/reader_table.py"
click node_obsplugin "https://github.com/baklanovp/pystella/blob/master/plugin/lcobsmix.py"
click node_velplugin "https://github.com/baklanovp/pystella/blob/master/plugin/velobs.py"
click node_fitcore "https://github.com/baklanovp/pystella/blob/master/pystella/fit/fit_lc.py"
click node_fitmcmc "https://github.com/baklanovp/pystella/blob/master/pystella/fit/fit_mcmc.py"
click node_fitmp "https://github.com/baklanovp/pystella/blob/master/pystella/fit/fit_mpfit.py"
click node_mpfit "https://github.com/baklanovp/pystella/blob/master/pystella/fit/mpfit.py"
click node_phys "https://github.com/baklanovp/pystella/blob/master/pystella/util/phys_var.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_shell,node_convert,node_fitcli toneBlue
class node_stella,node_eve,node_swd,node_tau,node_mesa,node_hdf,node_phys toneAmber
class node_spectrum,node_band,node_radiometry,node_lightcurve,node_curvefunc,node_plot toneMint
class node_reader,node_obsplugin,node_velplugin,node_fitcore,node_fitmcmc,node_fitmp,node_mpfit toneRose
class node_researcher toneIndigo
```

## Components

### User interface

- [Command shell](https://github.com/baklanovp/pystella/blob/master/pystella.py): `pystella.py`
- [Band conversion](https://github.com/baklanovp/pystella/blob/master/ubv.py): `ubv.py`
- [Fit command](https://github.com/baklanovp/pystella/blob/master/fit.py): `fit.py`

### Model data

- [Stella model access](https://github.com/baklanovp/pystella/blob/master/pystella/model/stella.py): `pystella/model/stella.py`
- [EVE profiles](https://github.com/baklanovp/pystella/blob/master/pystella/model/sn_eve.py): `pystella/model/sn_eve.py`
- [Shock-wave data](https://github.com/baklanovp/pystella/blob/master/pystella/model/sn_swd.py): `pystella/model/sn_swd.py`
- [Optical-depth data](https://github.com/baklanovp/pystella/blob/master/pystella/model/sn_tau.py): `pystella/model/sn_tau.py`
- [MESA models](https://github.com/baklanovp/pystella/blob/master/pystella/model/mesa.py): `pystella/model/mesa.py`
- [HDF5 model data](https://github.com/baklanovp/pystella/blob/master/pystella/model/h5stella.py): `pystella/model/h5stella.py`
- [Physical constants](https://github.com/baklanovp/pystella/blob/master/pystella/util/phys_var.py): `pystella/util/phys_var.py`

### Photometry and plotting

- [Spectrum series](https://github.com/baklanovp/pystella/blob/master/pystella/rf/spectrum.py): `pystella/rf/spectrum.py`
- [Photometric bands](https://github.com/baklanovp/pystella/blob/master/pystella/rf/band.py): `pystella/rf/band.py`
- [Radiative calculations](https://github.com/baklanovp/pystella/blob/master/pystella/rf/rad_func.py): `pystella/rf/rad_func.py`
- [Light-curve data](https://github.com/baklanovp/pystella/blob/master/pystella/rf/lc.py): `pystella/rf/lc.py`
- [Curve calculations](https://github.com/baklanovp/pystella/blob/master/pystella/rf/light_curve_func.py): `pystella/rf/light_curve_func.py`
- [Curve and model plots](https://github.com/baklanovp/pystella/blob/master/pystella/rf/light_curve_plot.py): `pystella/rf/light_curve_plot.py`

### Observations and fitting

- [Observation tables](https://github.com/baklanovp/pystella/blob/master/pystella/util/reader_table.py): `pystella/util/reader_table.py`
- [Observation callbacks](https://github.com/baklanovp/pystella/blob/master/plugin/lcobsmix.py): `plugin/lcobsmix.py`
- [Velocity observations](https://github.com/baklanovp/pystella/blob/master/plugin/velobs.py): `plugin/velobs.py`
- [Light-curve fitting](https://github.com/baklanovp/pystella/blob/master/pystella/fit/fit_lc.py): `pystella/fit/fit_lc.py`
- [MCMC fitting](https://github.com/baklanovp/pystella/blob/master/pystella/fit/fit_mcmc.py): `pystella/fit/fit_mcmc.py`
- [MPFIT fitting](https://github.com/baklanovp/pystella/blob/master/pystella/fit/fit_mpfit.py): `pystella/fit/fit_mpfit.py`
- [Least-squares solver](https://github.com/baklanovp/pystella/blob/master/pystella/fit/mpfit.py): `pystella/fit/mpfit.py`

### Other components

- **Researcher**

## Connections

- Researcher → Command shell: starts
- Researcher → Band conversion: runs
- Command shell → Band conversion: dispatches (evidence: `pystella.py`)
- Command shell → Fit command: dispatches (evidence: `pystella.py`)
- Band conversion → Stella model access: converts model output
- Stella model access → EVE profiles: loads profiles (evidence: `pystella/model/stella.py`)
- Stella model access → Shock-wave data: reads output (evidence: `pystella/model/stella.py`)
- Stella model access → Optical-depth data: reads output (evidence: `pystella/model/stella.py`)
- Stella model access → Spectrum series: loads spectra
- Stella model access → MESA models: supports model data
- Stella model access → HDF5 model data: supports model data
- Spectrum series → Photometric bands: computes curves (evidence: `pystella/rf/spectrum.py`)
- Photometric bands → Radiative calculations: uses conversions (evidence: `pystella/rf/band.py`)
- Radiative calculations → Physical constants: uses constants (evidence: `pystella/rf/rad_func.py`)
- Spectrum series → Curve calculations: supports calculations (evidence: `pystella/rf/light_curve_func.py`)
- Curve calculations → Light-curve data: builds curves (evidence: `pystella/rf/light_curve_func.py`)
- Curve and model plots → Photometric bands: uses band data (evidence: `pystella/rf/light_curve_plot.py`)
- Band conversion → Curve and model plots: plots results
- Observation tables → Light-curve data: builds curves (evidence: `pystella/util/reader_table.py`)
- Observation callbacks → Light-curve data: uses curves (evidence: `plugin/lcobsmix.py`)
- Observation callbacks → Photometric bands: uses bands (evidence: `plugin/lcobsmix.py`)
- Velocity observations → Observation tables: reads tables (evidence: `plugin/velobs.py`)
- Fit command → Light-curve fitting: fits observations
- Light-curve fitting → Curve and model plots: uses plotting
- MCMC fitting → Light-curve fitting: uses fit interface (evidence: `pystella/fit/fit_mcmc.py`)
- MPFIT fitting → Light-curve fitting: uses fit interface (evidence: `pystella/fit/fit_mpfit.py`)
- MPFIT fitting → Least-squares solver: calls solver (evidence: `pystella/fit/fit_mpfit.py`)
