Metadata-Version: 2.4
Name: evstats
Version: 0.2
Summary: Calculate extreme value statistics of the halo and galaxy mass distributions
Author-email: Chris Lovell <chris.lovell.astro@gmail.com>
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/christopherlovell/evstats
Project-URL: Repository, https://github.com/christopherlovell/evstats
Project-URL: Paper, https://academic.oup.com/mnras/article/518/2/2511/6823705
Keywords: astronomy,cosmology,extreme-value-statistics,halo-mass-function
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.0
Requires-Dist: scipy>=1.6
Requires-Dist: hmf<3.7,>=3.6
Requires-Dist: astropy
Provides-Extra: examples
Requires-Dist: matplotlib; extra == "examples"
Requires-Dist: h5py; extra == "examples"
Provides-Extra: observables
Requires-Dist: evstats[examples]; extra == "observables"
Requires-Dist: unyt; extra == "observables"
Requires-Dist: cosmos-synthesizer; extra == "observables"
Dynamic: license-file

# evstats
A python module for calculating extreme value statistics of the halo and galaxy stellar mass distributions. Full details provided in [Lovell et al. 2023](https://academic.oup.com/mnras/article/518/2/2511/6823705).

<img src="https://www.christopherlovell.co.uk/assets/img/evs-1400.webp" alt="drawing" width="400"/>

### Installation

```
pip install evstats
```

or, from a clone of this repository, `pip install .`. You can then use evstats as so:

```
from evstats import evs
from evstats import stats
from evstats import stellar
```

evstats requires Python 3.12 or newer. The core package needs only numpy, scipy, astropy and [hmf](https://github.com/halomod/hmf). hmf is held at 3.6, since other versions shift the halo mass function and the tabulated EVS in `example/data/` were computed with it.

Optional dependencies are installed as extras:

```
pip install "evstats[examples]"     # matplotlib and h5py: plotting, and the scripts in example/
pip install "evstats[observables]"  # also Synthesizer and unyt: the photometry in example/observables/
```

The star-formation-history module (`evstats.sfr`) provides
`mass_growth_track` / `plot_mass_growth_track`, which project an observed
stellar mass back in redshift for an assumed (parametric or binned) star
formation history, for comparison against the EVS contours. Plotting needs
the `examples` extra, and `average_sfr_over_window` needs the `observables` extra.

### An example
A notebook showing a simple example of how to create contours in the stellar mass -- redshift plane, for arbitrary survey areas, is available [here](https://nbviewer.org/github/christopherlovell/evstats/blob/main/example/example.ipynb).

### Observables
The scripts in `example/observables/` turn the stellar mass EVS into JWST fluxes using [Synthesizer](https://github.com/synthesizer-project/synthesizer), so need the `observables` extra. They read flux tables that are not distributed with this repository; to make them:

1. Get the Synthesizer grid for the fiducial model, `bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps`, and set `GRID_DIR` in `evs_file_generator.py` to the directory containing it.
2. From `example/observables/`, generate the flux tables for every star formation history with that grid, at the fiducial metallicity:
   ```
   python evs_file_generator.py "" bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy 0.01
   ```
3. Plot the EVS flux predictions for each star formation history:
   ```
   python evs_sfh.py
   ```

Running `evs_file_generator.py` with no arguments makes the tables for every SFH, SPS model and metallicity, which the other scripts need; this is slow.

### The paper
All of the plots and analysis in [Lovell et al. 2023](https://academic.oup.com/mnras/article/518/2/2511/6823705) can be recreated using the scripts in `example/paper/`.
