Metadata-Version: 2.3
Name: snc-sf
Version: 1.1.1
Summary: 
Author: imedan
Author-email: ilija.medan@gmail.com
Requires-Python: >=3.11
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: astropy (>=6.1.0)
Requires-Dist: astroquery (>=0.4.7)
Requires-Dist: gaiaunlimited (>=0.3.2,<0.4.0)
Requires-Dist: healpy (>=1.17.1)
Requires-Dist: jax (>=0.4.27)
Requires-Dist: jaxlib (>=0.4.27)
Requires-Dist: matplotlib (>=3.8.0)
Requires-Dist: notebook (>=7.0.0)
Requires-Dist: numpy (>=2.0.0)
Requires-Dist: numpyro (>=0.14.0)
Requires-Dist: polars (>=1.0.0)
Requires-Dist: pyarrow (>=14.0.0)
Requires-Dist: scipy (>=1.13.0)
Requires-Dist: sdss-semaphore (>=0.2.4,<0.3.0)
Requires-Dist: tqdm (>=4.60.0)
Description-Content-Type: text/markdown

# SDSS-V Solar Neighborhood Census Selection Function and Subpopulation Probabilities

This repository provides the code to calculate the selection function for the SDSS-V Solar Neighborhood Census (SNC) relative to the Gaia Catalog of Nearby Stars ([GCNS](https://ui.adsabs.harvard.edu/abs/2021A%26A...649A...6G/abstract)). With this selection function, the code allows for the forward modeling of subpopulation probabilities across the HR diagram. A use case would be selecting all stars in the SNC with [Fe/H] < -1 and the forward model would evaluate the likely probability of selecting [Fe/H] < -1 stars from the GCNS in discrete bins across the HR diagram.

## Installation

The code can be installed with `pip`:
```
git clone https://github.com/imedan/snc_sf
cd snc_sf
pip install .
```
or in a fresh virtual environment with `poetry` to fully replicate the development environment
```
git clone https://github.com/imedan/snc_sf
cd snc_sf
conda create -n "snc_sf" python=3.11
conda activate snc_sf
pip install poetry
poetry install
```

To fully utilize the code, SDSS-V and GCNS data is need. The SDSS-V DR19 `astra` summary data can be accessed [here](https://data.sdss.org/sas/dr19/spectro/astra/0.6.0/summary/). The required GCNS data will automatically be downloaded when first initializing a `snc_sf.selection_function.SNCSelectionFunction()` object.

## Examples

A number of examples using the code are located in [`notebooks/`](notebooks/). These examples are fully explained in the paper accompanying this work. In summary, the examples included related to the following:
- [`dr19_obs.ipynb`](notebooks/dr19_obs.ipynb): Constructs the base SNC 100 pc dataset and creates the plots in Figure 1 of the paper.
- [`SF_example_plots.ipynb`](notebooks/SF_example_plots.ipynb): Example of the selecrtion function for different regions on the sky, as shown in Figure 2 of the paper.
- [`forward_model_GCNS_mock_proof.py`](notebooks/forward_model_GCNS_mock_proof.py): Script that replicates the example with mock data in Section 4.1 and Figure 3 in the paper.
- [`forward_model_halpha_ex.py`](notebooks/forward_model_halpha_ex.py): Script that replicates the example examing the distribution of H-alpha emitters across the HR diagram in Section 4.2 and Figure 4 in the paper.
- [`forward_model_mass_dens.py`](notebooks/forward_model_mass_dens.py): Script that replicates the example that calculates the stellar number desnity in bins of metallicity and mass in Section 4.3 in the paper.
- [`appendix_example.ipynb`](notebooks/appendix_example.ipynb): Example to demonstrate basic code usage as illustrated in the Appendix of the paper.
