# mickaelrigault/ztfidr architecture

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

- Interactive diagram: https://gitdiagram.com/mickaelrigault/ztfidr
- Repository: https://github.com/mickaelrigault/ztfidr

## Overview

ztfidr is a Python package for reading and parsing the ZTF SN IDR dataset. Its principal workflow loads release tables into a Sample, lets users filter and inspect the sample, and builds per-target views combining light curves and spectra. The package also provides host-property access, supernova typing, host-mass calculations, spectral-line fitting, SALT2 support, and plotting. The README and excerpts establish the main loading and target-view relationships; links to unsampled internals are omitted rather than inferred.

Main entry points: [`ztfidr/sample.py`](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/sample.py) (Sample and filters), [`ztfidr/lightcurve.py`](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/lightcurve.py) (Light curves), [`ztfidr/spectroscopy.py`](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/spectroscopy.py) (Spectra), [`ztfidr/io.py`](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/io.py) (Release data access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Release data"]
  node_io["Release data access<br/>[io.py]"]
end

subgraph group_domain["Sample and targets"]
  node_sample["Sample and filters<br/>[sample.py]"]
  node_lightcurve["Light curves<br/>[lightcurve.py]"]
  node_spectroscopy["Spectra<br/>[spectroscopy.py]"]
  node_target["Target view<br/>[target.py]"]
end

subgraph group_analysis["Scientific analysis"]
  node_host["Host properties<br/>[host.py]"]
  node_hostmass["Host mass<br/>[hostmass.py]"]
  node_mw["Milky Way corrections<br/>[mw.py]"]
  node_salt2["SALT2 parameters<br/>[salt2.py]"]
  node_linefitter["Spectral line fitting<br/>[linefitter.py]"]
end

subgraph group_views["Classification and views"]
  node_typing["Supernova typing<br/>[typing.py]"]
  node_plotting["Scientific plots<br/>[plotting.py]"]
  node_utils["Flux utilities<br/>[utils.py]"]
end

node_user(("Researcher"))
node_idr[("ZTF IDR files")]

node_user -->|"loads sample"| node_sample
node_sample -->|"loads tables"| node_io
node_io -->|"reads release files"| node_idr
node_user -->|"filters data"| node_sample
node_sample -->|"loads target curve"| node_lightcurve
node_sample -->|"loads target spectra"| node_spectroscopy
node_sample -->|"builds target"| node_target
node_target -->|"uses curve"| node_lightcurve
node_target -->|"uses spectra"| node_spectroscopy
node_lightcurve -->|"resolves file"| node_io
node_spectroscopy -->|"resolves files"| node_io
node_user -.->|"plots results"| node_plotting
node_lightcurve -->|"converts flux"| node_utils
node_plotting -->|"uses helpers"| node_utils
node_sample -.->|"uses calculations"| node_hostmass
node_spectroscopy -.->|"fits lines"| node_linefitter

click node_io "https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/io.py"
click node_sample "https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/sample.py"
click node_lightcurve "https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/lightcurve.py"
click node_spectroscopy "https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/spectroscopy.py"
click node_target "https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/target.py"
click node_host "https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/host.py"
click node_hostmass "https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/hostmass.py"
click node_mw "https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/mw.py"
click node_salt2 "https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/salt2.py"
click node_linefitter "https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/linefitter.py"
click node_typing "https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/typing.py"
click node_plotting "https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/plotting.py"
click node_utils "https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/utils.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_io toneBlue
class node_sample,node_lightcurve,node_spectroscopy,node_target,node_idr toneAmber
class node_host,node_hostmass,node_mw,node_salt2,node_linefitter toneMint
class node_typing,node_plotting,node_utils toneRose
class node_user toneIndigo
```

## Components

### Release data

- [Release data access](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/io.py): `ztfidr/io.py`

### Sample and targets

- [Sample and filters](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/sample.py): `ztfidr/sample.py`
- [Light curves](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/lightcurve.py): `ztfidr/lightcurve.py`
- [Spectra](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/spectroscopy.py): `ztfidr/spectroscopy.py`
- [Target view](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/target.py): `ztfidr/target.py`

### Scientific analysis

- [Host properties](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/host.py): `ztfidr/host.py`
- [Host mass](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/hostmass.py): `ztfidr/hostmass.py`
- [Milky Way corrections](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/mw.py): `ztfidr/mw.py`
- [SALT2 parameters](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/salt2.py): `ztfidr/salt2.py`
- [Spectral line fitting](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/linefitter.py): `ztfidr/linefitter.py`

### Classification and views

- [Supernova typing](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/typing.py): `ztfidr/typing.py`
- [Scientific plots](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/plotting.py): `ztfidr/plotting.py`
- [Flux utilities](https://github.com/mickaelrigault/ztfidr/blob/main/ztfidr/utils.py): `ztfidr/utils.py`

### Other components

- **Researcher**
- **ZTF IDR files**

## Connections

- Researcher → Sample and filters: loads sample (evidence: `README.md`)
- Sample and filters → Release data access: loads tables (evidence: `ztfidr/sample.py`)
- Release data access → ZTF IDR files: reads release files (evidence: `ztfidr/io.py`)
- Researcher → Sample and filters: filters data (evidence: `README.md`)
- Sample and filters → Light curves: loads target curve (evidence: `ztfidr/sample.py`)
- Sample and filters → Spectra: loads target spectra (evidence: `ztfidr/sample.py`)
- Sample and filters → Target view: builds target (evidence: `ztfidr/sample.py`)
- Target view → Light curves: uses curve (evidence: `ztfidr/target.py`)
- Target view → Spectra: uses spectra (evidence: `ztfidr/target.py`)
- Light curves → Release data access: resolves file (evidence: `ztfidr/lightcurve.py`)
- Spectra → Release data access: resolves files (evidence: `ztfidr/spectroscopy.py`)
- Researcher → Scientific plots: plots results (evidence: `README.md`)
- Light curves → Flux utilities: converts flux (evidence: `ztfidr/lightcurve.py`)
- Scientific plots → Flux utilities: uses helpers (evidence: `ztfidr/plotting.py`)
- Sample and filters → Host mass: uses calculations (evidence: `ztfidr/sample.py`)
- Spectra → Spectral line fitting: fits lines (evidence: `ztfidr/spectroscopy.py`)
