Metadata-Version: 2.4
Name: lazuli_astrosim_data
Version: 0.1.0
Summary: Data bank for Lazuli instrument simulations
Author-email: Mickael Rigault <mick.rigault@gmail.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/schmidt-observatories/lazuli-astrosim-data
Keywords: astronomy,astrophysics
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: numpy
Provides-Extra: docs
Requires-Dist: matplotlib; extra == "docs"
Requires-Dist: myst-nb; extra == "docs"
Requires-Dist: sphinx>=7.2; extra == "docs"
Requires-Dist: sphinx-book-theme; extra == "docs"
Requires-Dist: sphinx-copybutton; extra == "docs"
Requires-Dist: sphinx-design; extra == "docs"
Provides-Extra: tests
Requires-Dist: pytest; extra == "tests"
Requires-Dist: pytest-doctestplus; extra == "tests"
Requires-Dist: pytest-cov; extra == "tests"

# lazuli-astrosim-data

Data bank for Lazuli instrument simulations.

This repository has two goals:

1. **Store the reference data** shared across the Lazuli simulators (e.g. `slicersim`),
   so that every simulator uses the same inputs.
2. **Give easy access to that data** through simple top-level I/O functions,
   so simulators never need to hard-code file paths.

The data files are shipped inside the Python package, so once it is installed
they are available wherever the package is imported.

## Installation

```bash
git clone https://github.com/schmidt-observatories/lazuli-astrosim-data.git
cd lazuli-astrosim-data
pip install .
```

or directly:

```bash
pip install git+https://github.com/schmidt-observatories/lazuli-astrosim-data.git
```

## NGC galaxies

### Content

The NGC data are in `src/lazuli_astrosim_data/data/`:

| File | Content |
|---|---|
| `ngc/ngc_XXXX_spec.fits` | Spectral energy distribution of the galaxy, from the Brown et al. (2014) galaxy SED atlas (pysynphot / HST ETC format). Binary table with columns `WAVELENGTH` [Å] and `FLUX` [flam = erg/s/cm²/Å]. |
| `ngc/ngc_XXXX_thumbnails.fits.gz` | *r*-band image of the galaxy alone, from Legacy Surveys DR10 cutouts, made with [ngcs](https://github.com/MickaelRigault/ngcs). Stars are masked, sky is subtracted and pixels outside the galaxy are set to 0. Pixel values are in nanomaggy (AB zero point 22.5). The header holds the WCS, pixel scale, and SGA-2020 galaxy properties. |
| `sga2020_catalog_of_ngcs.parquet` | SGA-2020 (Moustakas et al. 2023) catalog of NGC galaxies: `Name`, `SMASB26`, `gmagSB26`, `rmagSB26`, `zmagSB26`, `RAJ2000`, `DEJ2000`, `z-LEDA`. |

Every galaxy available has a spectrum, but not every galaxy has a thumbnail.

### Access

Use `get_galaxy_filepath` to get file paths from a galaxy name. Names are case
insensitive and can be given as `"NGC4321"`, `"ngc_4321"` or `"NGC 4321"`.

```python
from lazuli_astrosim_data.io import get_galaxy_filepath

specfile = get_galaxy_filepath("NGC4321")                   # spectrum (default)
imagefile = get_galaxy_filepath("NGC4321", which="image")   # thumbnail
specfile, imagefile = get_galaxy_filepath("NGC4321", which="both")
```

A `FileNotFoundError` is raised if the galaxy has no spectrum.
The returned paths can then be read with, e.g., `astropy`:

```python
from astropy.io import fits

spec = fits.getdata(specfile)       # spec["WAVELENGTH"], spec["FLUX"]
image, header = fits.getdata(imagefile, header=True)
```

The package data directory is also exposed as `lazuli_astrosim_data.io.PACKAGE_PATH`,
for example to read the catalog:

```python
import pandas as pd
from lazuli_astrosim_data.io import PACKAGE_PATH

catalog = pd.read_parquet(PACKAGE_PATH / "data" / "sga2020_catalog_of_ngcs.parquet")
```

## Adding data

1. Put the new files in `src/lazuli_astrosim_data/data/` (in a subdirectory if it is a new data set).
2. If you create a new subdirectory, add it to `[tool.setuptools.package-data]` in
   `pyproject.toml`, otherwise it will not be installed.
3. Add an access function in `src/lazuli_astrosim_data/io.py` and document it here.

## References

- Brown, M. J. I. et al. 2014, ApJS, 212, 18 — An Atlas of Galaxy Spectral Energy Distributions
- Moustakas, J. et al. 2023, ApJS, 269, 3 — Siena Galaxy Atlas 2020
- Dey, A. et al. 2019, AJ, 157, 168 — DESI Legacy Imaging Surveys
- Gaia Collaboration, Vallenari, A. et al. 2023, A&A, 674, A1 — Gaia DR3
