diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..ab6a683 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,32 @@ +# Build the docs on every PR, and publish them to GitHub Pages on merge to main. +name: docs + +on: + push: + branches: [main] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10 + - run: uv run --python 3.12 --extra docs sphinx-build -W --keep-going docs docs/_build/html + - uses: actions/upload-pages-artifact@v5 + with: + path: docs/_build/html + + deploy: + if: github.ref == 'refs/heads/main' + needs: build + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - id: deployment + uses: actions/deploy-pages@v5 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0d62829 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,42 @@ +# Publish to PyPI on every merge to main that bumps the version in pyproject.toml. +# Merges that leave the version unchanged are skipped, since PyPI never +# accepts the same version twice. +name: publish + +on: + push: + branches: [main] + +jobs: + publish: + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write # PyPI trusted publishing, no token needed + contents: write # tag and GitHub release + steps: + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10 + + - name: Check whether this version is new + id: version + run: | + v=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") + echo "version=$v" >> "$GITHUB_OUTPUT" + if curl -sfo /dev/null "https://pypi.org/pypi/evstats/$v/json"; then + echo "evstats $v is already on PyPI, skipping" + echo "new=false" >> "$GITHUB_OUTPUT" + else + echo "new=true" >> "$GITHUB_OUTPUT" + fi + + - if: steps.version.outputs.new == 'true' + run: uv build + + - if: steps.version.outputs.new == 'true' + run: uv publish + + - if: steps.version.outputs.new == 'true' + run: gh release create "v${{ steps.version.outputs.version }}" dist/* --generate-notes + env: + GH_TOKEN: ${{ github.token }} diff --git a/.gitignore b/.gitignore index e39979c..5713fe2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ example/paper/plots/*.pdf example/paper/plots/*.gif example/paper/plots/*.png example/observables/data/*.txt +# fiducial-model flux tables, used in the docs +!example/observables/data/flux_per_mass_*_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/README.md b/README.md index 8011aac..db934fd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # 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). +A python package for extreme value statistics (EVS) in astrophysics: the probability distribution of the most extreme object, such as the most massive or the brightest, expected in a survey of a given area and redshift range. EVS applies to physical distribution functions, such as the halo and galaxy stellar mass functions, and to observed ones, such as the distribution of galaxy fluxes in a given band. An observed object far beyond this distribution is in tension with the model behind it. The method is described in [Lovell et al. 2023](https://academic.oup.com/mnras/article/518/2/2511/6823705). drawing @@ -9,46 +9,15 @@ A python module for calculating extreme value statistics of the halo and galaxy pip install evstats ``` -or, from a clone of this repository, `pip install .`. You can then use evstats as so: +evstats requires Python 3.12 or newer. Optional dependencies are installed as extras: ``` -from evstats import evs -from evstats import stats -from evstats import stellar +pip install "evstats[examples]" # matplotlib and h5py, for plotting and the examples +pip install "evstats[observables]" # also Synthesizer and unyt, for making new flux tables ``` -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. +### Documentation +Worked examples for the halo mass, stellar mass and flux distributions, and the API reference, are at https://www.christopherlovell.co.uk/evstats/. ### 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/`. diff --git a/docs/api.rst b/docs/api.rst new file mode 100644 index 0000000..9b5b1e3 --- /dev/null +++ b/docs/api.rst @@ -0,0 +1,20 @@ +API +=== + +evstats.evs +----------- + +.. automodule:: evstats.evs + :members: + +evstats.stats +------------- + +.. automodule:: evstats.stats + :members: + +evstats.stellar +--------------- + +.. automodule:: evstats.stellar + :members: diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..709bdca --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,21 @@ +project = "evstats" +author = "Chris Lovell" +copyright = "2023, Chris Lovell" + +extensions = ["myst_nb", "sphinx.ext.autodoc", "sphinx.ext.napoleon"] +exclude_patterns = ["_build"] +myst_enable_extensions = ["dollarmath"] + +# Run the notebooks on every build, so the docs fail if the examples break +nb_execution_mode = "force" +nb_execution_raise_on_error = True +nb_execution_timeout = 600 + +autodoc_member_order = "bysource" + +html_theme = "shibuya" +html_title = "evstats" +html_theme_options = { + "github_url": "https://github.com/christopherlovell/evstats", + "show_ai_links": False, +} diff --git a/docs/halo.ipynb b/docs/halo.ipynb new file mode 100644 index 0000000..d327baf --- /dev/null +++ b/docs/halo.ipynb @@ -0,0 +1,148 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "be82c7f7", + "metadata": {}, + "source": [ + "# Halo mass EVS\n", + "\n", + "For $N$ haloes drawn independently from a mass distribution with PDF $f(m)$ and CDF $F(m)$, the PDF of the most massive is\n", + "\n", + "$$\\Phi(m_{\\rm max}) = N \\, f(m_{\\rm max}) \\, F(m_{\\rm max})^{N-1}.$$\n", + "\n", + "evstats finds $N$, $f$ and $F$ by integrating a halo mass function from [hmf](https://github.com/halomod/hmf) over the comoving volume of a redshift shell, for a survey covering a fraction $f_{\\rm sky}$ of the sky. Masses are in $M_\\odot$, without factors of $h$." + ] + }, + { + "cell_type": "markdown", + "id": "cc345578", + "metadata": {}, + "source": [ + "## A single redshift shell\n", + "\n", + "`evs_bin_pdf` computes the PDF for one shell, here $4 < z < 4.4$ over the whole sky ($f_{\\rm sky} = 1$). The `hmf.MassFunction` sets the mass function fit and cosmology; here the Behroozi et al. (2013) fit and Planck 2015 cosmology of Lovell et al. (2023). `dz` and `dm` set the resolution of the redshift and $\\log_{10}$ mass grids used for the integration." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "577bca21", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import h5py\n", + "import matplotlib.pyplot as plt\n", + "import astropy.units as u\n", + "from astropy.cosmology import Planck15\n", + "import hmf\n", + "\n", + "from evstats import evs\n", + "from evstats.stats import compute_conf_ints" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4b1c3ac8", + "metadata": {}, + "outputs": [], + "source": [ + "# True is the hmf default; set here to silence its warning\n", + "mf = hmf.MassFunction(hmf_model='Behroozi', cosmo_model=Planck15,\n", + " transfer_params={'extrapolate_with_eh': True})\n", + "\n", + "pdf, log10m = evs.evs_bin_pdf(mf=mf, zmin=4.0, zmax=4.4, dz=0.01,\n", + " mmin=11, mmax=16, dm=0.01, fsky=1.0)\n", + "\n", + "fig, ax = plt.subplots()\n", + "ax.plot(log10m, pdf)\n", + "ax.set_xlim(13.5, 14)\n", + "ax.set_xlabel(r'$\\log_{10}(M^{200}_{\\rm max} \\,/\\, M_\\odot)$')\n", + "ax.set_ylabel(r'$\\Phi(M^{200}_{\\rm max})$');" + ] + }, + { + "cell_type": "markdown", + "id": "e4398ce9", + "metadata": {}, + "source": [ + "## Any survey area, across redshift\n", + "\n", + "The sky fraction only enters by scaling the whole-sky $N$, $f$ and $F$, which `apply_fsky` does. So these terms can be tabulated once, in contiguous redshift shells, and then give the PDF for any survey area almost instantly. `example/data/evs_all.h5` holds them for 140 shells of width $\\Delta z = 0.2$ over $0 < z < 28$, for the same mass function and cosmology as above. Here we take a 90 arcmin$^2$ survey." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5035da94", + "metadata": {}, + "outputs": [], + "source": [ + "with h5py.File('../example/data/evs_all.h5', 'r') as hf:\n", + " log10m = hf['log10m'][:]\n", + " f = hf['f'][:]\n", + " F = hf['F'][:]\n", + " N = hf['N'][:]\n", + " z = hf['z'][:]\n", + "\n", + "fsky = float(90 * u.arcmin**2 / (4 * np.pi * u.sr))\n", + "phi_max = evs.apply_fsky(N, f, F, fsky)" + ] + }, + { + "cell_type": "markdown", + "id": "8d3a6e8d", + "metadata": {}, + "source": [ + "`compute_conf_ints` gives, at each redshift, the masses at the $-3\\sigma$, $-2\\sigma$, $-1\\sigma$, median, $+1\\sigma$, $+2\\sigma$ and $+3\\sigma$ points of the CDF." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ca24a370", + "metadata": {}, + "outputs": [], + "source": [ + "CI = compute_conf_ints(phi_max, log10m)\n", + "\n", + "fig, ax = plt.subplots(figsize=(5, 5))\n", + "for i, c in enumerate(['brown', 'lightcoral', 'mistyrose']):\n", + " ax.fill_between(z, CI[:, i], CI[:, 6 - i], color=c, label=rf'${3 - i}\\sigma$')\n", + "ax.plot(z, CI[:, 3], ':k', label='median')\n", + "ax.set_xlim(0.1, 19.8)\n", + "ax.set_xlabel('$z$')\n", + "ax.set_ylabel(r'$\\log_{10}(M^{200}_{\\rm max} \\,/\\, M_\\odot)$')\n", + "ax.legend(frameon=False, title=r'$A = 90\\ \\mathrm{arcmin}^2$');" + ] + }, + { + "cell_type": "markdown", + "id": "87ecc841", + "metadata": {}, + "source": [ + "## Other mass functions and cosmologies\n", + "\n", + "To use a different mass function fit or cosmology, regenerate the table with `example/run_lightcone.py`. It writes the same HDF5 format to `example/data/`, which can then be used as above:\n", + "\n", + "```bash\n", + "cd example\n", + "python run_lightcone.py -o my_evs.h5 --procs 8\n", + "```\n", + "\n", + "`--model` takes a preset (`behroozi`, the default, or `yung` for the Yung et al. 2024 fit) or any hmf model name, and `--cosmology` any astropy cosmology name; see `python run_lightcone.py --help` for the grid options. The table above was made with hmf 3.6; other hmf versions shift the mass function by up to ~0.2 dex at high redshift." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..7de885a --- /dev/null +++ b/docs/index.md @@ -0,0 +1,51 @@ +# evstats + +evstats is a python package for extreme value statistics (EVS) in astrophysics: the probability distribution of the most extreme object, such as the most massive or the brightest, expected in a survey of a given area and redshift range. EVS applies to physical distribution functions, such as the halo and galaxy stellar mass functions, and to observed ones, such as the distribution of galaxy fluxes in a given band. An observed object far beyond this distribution is in tension with the model behind it. The method is described in [Lovell et al. 2023](https://academic.oup.com/mnras/article/518/2/2511/6823705). + +```{image} https://www.christopherlovell.co.uk/assets/img/evs-1400.webp +:width: 400px +``` + +## Installation + +```bash +pip install evstats +``` + +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: + +```bash +pip install "evstats[examples]" # matplotlib and h5py +pip install "evstats[observables]" # also Synthesizer and unyt +``` + +The examples in these pages need the `examples` extra, and making new flux tables needs `observables`. The examples also read tabulated data from the `example/` directory of the repository, which is not part of the pip package; to run them, clone the repository and run the notebooks from `docs/`: + +```bash +git clone https://github.com/christopherlovell/evstats +cd evstats +pip install ".[examples]" +``` + +## Overview + +1. [Halo mass EVS](halo.ipynb): the PDF of the most massive halo in a redshift shell and survey area, from the halo mass function. +2. [Stellar mass EVS](stellar.ipynb): the PDF of the most massive galaxy's stellar mass, from the baryon fraction and a distribution of stellar fractions. +3. [Observables](observables.ipynb): the flux of the most massive galaxy, for a stellar population model. + +All of the plots and analysis in Lovell et al. 2023 can be recreated with the scripts in `example/paper/`. + +## Citing + +If you use evstats, please cite [Lovell et al. 2023](https://academic.oup.com/mnras/article/518/2/2511/6823705). + +```{toctree} +:hidden: + +halo +stellar +observables +api +``` diff --git a/docs/observables.ipynb b/docs/observables.ipynb new file mode 100644 index 0000000..c6aedbc --- /dev/null +++ b/docs/observables.ipynb @@ -0,0 +1,126 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "da05b705", + "metadata": {}, + "source": [ + "# Observables\n", + "\n", + "For a given stellar population model (star formation history shape, stellar population synthesis model, metallicity), a galaxy's flux in any band is proportional to its stellar mass. A table of the flux per unit stellar mass formed, $\\mathcal{F}(z)$, therefore maps the stellar mass EVS to fluxes: the most massive galaxy has flux $M_\\star \\mathcal{F}(z)$. This is monotonic in $M_\\star$, so the stellar mass confidence intervals map directly onto flux confidence intervals, which `compute_conf_ints` returns when given the flux at each mass as `y`. Mass loss from stellar evolution is neglected, so $M_\\star$ is taken as the mass formed.\n", + "\n", + "`example/observables/data/` includes these tables for a fiducial model, made with [Synthesizer](https://synthesizer-project.github.io/synthesizer/):\n", + "\n", + "- an exponentially rising star formation history, $\\tau = 100$ Myr, starting at the Big Bang;\n", + "- BPASS v2.2.1 binary stellar populations with a Chabrier (2003) IMF over $0.1$–$300 \\, M_\\odot$, plus nebular emission from Cloudy, with no escape of ionising photons;\n", + "- metallicity $Z = 0.01$;\n", + "- Madau (1996) IGM absorption and no dust;\n", + "- JWST NIRCam F115W, F150W, F200W, F277W, F356W and F444W, and MIRI F770W;\n", + "- the Planck 2015 cosmology and the redshifts of `example/data/evs_all.h5`.\n", + "\n", + "First, the stellar mass PDFs for a 90 arcmin$^2$ survey, as in [Stellar mass EVS](stellar.ipynb):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "15f4bdfc", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import h5py\n", + "import matplotlib.pyplot as plt\n", + "import astropy.units as u\n", + "\n", + "from evstats import evs\n", + "from evstats.stats import compute_conf_ints\n", + "from evstats.stellar import apply_fs_distribution" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2e73d3c5", + "metadata": {}, + "outputs": [], + "source": [ + "with h5py.File('../example/data/evs_all.h5', 'r') as hf:\n", + " log10m = hf['log10m'][:]\n", + " f = hf['f'][:]\n", + " F = hf['F'][:]\n", + " N = hf['N'][:]\n", + " z = hf['z'][:]\n", + "\n", + "fsky = float(90 * u.arcmin**2 / (4 * np.pi * u.sr))\n", + "phi_max = evs.apply_fsky(N, f, F, fsky)\n", + "mstar_pdf = np.vstack([apply_fs_distribution(p, log10m, f_b=0.16) for p in phi_max])" + ] + }, + { + "cell_type": "markdown", + "id": "9c646bb6", + "metadata": {}, + "source": [ + "## Flux confidence intervals\n", + "\n", + "For each band, the flux of a galaxy at each redshift and mass is the mass times the tabulated flux per unit mass (nJy / $M_\\odot$), converted below to AB magnitudes. F150W drops out above $z \\approx 12$, where the Lyman break passes through it." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f72d2873", + "metadata": {}, + "outputs": [], + "source": [ + "model = 'Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps'\n", + "\n", + "fig, axes = plt.subplots(1, 3, figsize=(12, 4.5), sharey=True)\n", + "for ax, band in zip(axes, ['NIRCam.F150W', 'NIRCam.F277W', 'NIRCam.F444W']):\n", + " fpm = np.loadtxt(f'../example/observables/data/flux_per_mass_{band}_{model}.txt')\n", + " flux = 10**log10m * fpm[:, None] # nJy, at each (z, log10m)\n", + " CI = compute_conf_ints(mstar_pdf, log10m, flux)\n", + " with np.errstate(divide='ignore'): # zero flux beyond the Lyman break\n", + " mag = -2.5 * np.log10(CI) + 31.4\n", + "\n", + " for i, c in enumerate(['brown', 'lightcoral', 'mistyrose']):\n", + " ax.fill_between(z, mag[:, i], mag[:, 6 - i], color=c, label=rf'${3 - i}\\sigma$')\n", + " ax.plot(z, mag[:, 3], ':k', label='median')\n", + " ax.set_title(band.split('.')[1])\n", + " ax.set_xlim(2, 15)\n", + " ax.set_xlabel('$z$')\n", + "\n", + "axes[0].set_ylim(33, 15)\n", + "axes[0].set_ylabel(r'$m_{\\rm AB}$ of the most massive galaxy')\n", + "axes[0].legend(frameon=False, title=r'$A = 90\\ \\mathrm{arcmin}^2$');" + ] + }, + { + "cell_type": "markdown", + "id": "a89d6e0d", + "metadata": {}, + "source": [ + "## Other models\n", + "\n", + "`example/observables/evs_file_generator.py` makes the flux tables for other star formation histories (exponential, lognormal and double power law, each over a range of parameters), stellar population synthesis models (BC03 with three IMFs, FSPS and BPASS, with and without nebular emission) and metallicities. It needs the `observables` extra (`pip install \"evstats[observables]\"`) and the Synthesizer grids for these models; set `GRID_DIR` in the script to their location. Its arguments filter the star formation history, grid and metallicity, for example the fiducial grid for every star formation history:\n", + "\n", + "```bash\n", + "cd example/observables\n", + "python evs_file_generator.py \"\" bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy 0.01\n", + "```\n", + "\n", + "With no arguments it makes every table, which is slow. `evs_sfh.py` and `evs_sps_imf_z.py` then compare the flux predictions across these models, and `evs_burstiness.py` the effect of bursty star formation." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/stellar.ipynb b/docs/stellar.ipynb new file mode 100644 index 0000000..1154373 --- /dev/null +++ b/docs/stellar.ipynb @@ -0,0 +1,129 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "34d3941c", + "metadata": {}, + "source": [ + "# Stellar mass EVS\n", + "\n", + "A galaxy's stellar mass is $M_\\star = f_{\\rm b} \\, f_\\star \\, M_{\\rm halo}$, where $f_{\\rm b}$ is the baryon fraction and $f_\\star$ the fraction of those baryons in stars. Following Lovell et al. (2023) we fix $f_{\\rm b} = 0.16$ and draw $f_\\star$ from a distribution. In log space the product is a sum, so the stellar mass PDF is the halo mass PDF convolved with the PDF of $\\log_{10} f_\\star$, shifted by $\\log_{10} f_{\\rm b}$.\n", + "\n", + "First, the halo mass PDFs for a 90 arcmin$^2$ survey, as in [Halo mass EVS](halo.ipynb):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0d44b6c4", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import h5py\n", + "import matplotlib.pyplot as plt\n", + "import astropy.units as u\n", + "\n", + "from evstats import evs\n", + "from evstats.stats import compute_conf_ints\n", + "from evstats.stellar import apply_fs_distribution, log10_fs_pdf" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1ae711e7", + "metadata": {}, + "outputs": [], + "source": [ + "with h5py.File('../example/data/evs_all.h5', 'r') as hf:\n", + " log10m = hf['log10m'][:]\n", + " f = hf['f'][:]\n", + " F = hf['F'][:]\n", + " N = hf['N'][:]\n", + " z = hf['z'][:]\n", + "\n", + "fsky = float(90 * u.arcmin**2 / (4 * np.pi * u.sr))\n", + "phi_max = evs.apply_fsky(N, f, F, fsky)" + ] + }, + { + "cell_type": "markdown", + "id": "7b80dbc8", + "metadata": {}, + "source": [ + "## Stellar fraction distributions\n", + "\n", + "`log10_fs_pdf` gives the PDF of $\\log_{10} f_\\star$ for each of the available distributions, truncated to $0 < f_\\star \\le 1$:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dfbb24d9", + "metadata": {}, + "outputs": [], + "source": [ + "v = np.linspace(-4, 0, 400)\n", + "\n", + "fig, ax = plt.subplots()\n", + "for method in ['lognormal', 'normal', 'uniform', 'exponential']:\n", + " ax.plot(v, log10_fs_pdf(v, method), label=method)\n", + "ax.set_xlabel(r'$\\log_{10} f_\\star$')\n", + "ax.set_ylabel('PDF')\n", + "ax.legend(frameon=False);" + ] + }, + { + "cell_type": "markdown", + "id": "1cb611b4", + "metadata": {}, + "source": [ + "## Stellar mass confidence intervals\n", + "\n", + "`apply_fs_distribution` does the convolution, here with the default lognormal $f_\\star$ distribution. Taking $f_\\star = 1$, every baryon in stars, the $+3\\sigma$ halo mass scaled by $f_{\\rm b}$ gives a conservative upper limit that is independent of the $f_\\star$ distribution (dashed line)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "45fd60a6", + "metadata": {}, + "outputs": [], + "source": [ + "f_b = 0.16\n", + "mstar_pdf = np.vstack([apply_fs_distribution(p, log10m, method='lognormal', f_b=f_b)\n", + " for p in phi_max])\n", + "CI = compute_conf_ints(mstar_pdf, log10m)\n", + "fstar_1 = compute_conf_ints(phi_max, log10m)[:, 6] + np.log10(f_b)\n", + "\n", + "fig, ax = plt.subplots(figsize=(5, 5))\n", + "for i, c in enumerate(['brown', 'lightcoral', 'mistyrose']):\n", + " ax.fill_between(z, CI[:, i], CI[:, 6 - i], color=c, label=rf'${3 - i}\\sigma$')\n", + "ax.plot(z, CI[:, 3], ':k', label='median')\n", + "ax.plot(z, fstar_1, '--k', label=r'$f_\\star = 1$, $+3\\sigma$')\n", + "ax.set_xlim(0.1, 19.8)\n", + "ax.set_xlabel('$z$')\n", + "ax.set_ylabel(r'$\\log_{10}(M^\\star_{\\rm max} \\,/\\, M_\\odot)$')\n", + "ax.legend(frameon=False, title=r'$A = 90\\ \\mathrm{arcmin}^2$');" + ] + }, + { + "cell_type": "markdown", + "id": "7ac4adb3", + "metadata": {}, + "source": [ + "`apply_halo_dependent_fs` is an alternative that draws $f_\\star$ from the Andreon (2010) stellar–halo mass relation for the most massive haloes, by Monte Carlo sampling." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/evstats/stats.py b/evstats/stats.py index 1b3e898..273311f 100644 --- a/evstats/stats.py +++ b/evstats/stats.py @@ -9,17 +9,22 @@ def compute_conf_ints(pdf, x, y=None, lims = [0.0013498980, 0.0227501319, 0.1586 Parameters ---------- - x (array): x coordinates - pdf (array): probability density function evaluated at x - y (array): optional monotonic function of x, evaluated at x. If given the + pdf : array + probability density function evaluated at x + x : array + x coordinates + y : array, optional + monotonic function of x, evaluated at x. If given the intervals are returned in these coordinates instead, e.g. the flux at each stellar mass. The cdf is always integrated over x, so no Jacobian is needed; quantiles are preserved under a monotonic transform. - lims (array): confidence intervals to compute + lims : array + confidence intervals to compute Returns ------- - CI (array): confidence intervals + CI : array + confidence intervals """ @@ -48,13 +53,21 @@ def eddington_bias(m, m_err, mf = None): where epsilon is the slope of the halo mass function. - Args: - m (array): object masses in log base 10 - m_err (array): object mass errors in log base 10 - mf: mass function, from `hmf` package (default: `hmf.MassFunction()`) + Parameters + ---------- + m : array + object masses in log base 10 + m_err : array + object mass errors in log base 10 + mf : hmf.MassFunction, optional + mass function (default: `hmf.MassFunction()`) - Returns: - (array): corrected masses + Returns + ------- + array + corrected masses + array + slope of the halo mass function, epsilon """ if mf is None: mf = hmf.MassFunction() diff --git a/evstats/stellar.py b/evstats/stellar.py index 231d37b..d94af34 100644 --- a/evstats/stellar.py +++ b/evstats/stellar.py @@ -19,12 +19,15 @@ def log10_fs_pdf(v, method='lognormal'): Parameters ---------- - v (array): log10 stellar fraction, uniformly spaced and <= 0 - method (str): parametric form of f_s pdf, one of 'lognormal', 'normal', 'uniform' or 'exponential' + v : array + log10 stellar fraction, uniformly spaced and <= 0 + method : str + parametric form of f_s pdf, one of 'lognormal', 'normal', 'uniform' or 'exponential' Returns ------- - (array): normalised pdf of v + array + normalised pdf of v """ f_s = 10**v @@ -49,15 +52,21 @@ def apply_fs_distribution(pdf, _x, method='lognormal', f_b=0.16, vmin=-8.): Parameters ---------- - pdf (array): probability density function on x - _x (array): log10 halo mass coordinates of pdf, uniformly spaced - method (str): parametric form of f_s pdf, see `log10_fs_pdf` - f_b (float): additional normalisation constant to apply (e.g. baryon fraction) - vmin (float): lower limit on log10(f_s) to include in the convolution + pdf : array + probability density function on x + _x : array + log10 halo mass coordinates of pdf, uniformly spaced + method : str + parametric form of f_s pdf, see `log10_fs_pdf` + f_b : float + additional normalisation constant to apply (e.g. baryon fraction) + vmin : float + lower limit on log10(f_s) to include in the convolution Returns ------- - pdf (array): stellar mass pdf, on the same coordinates _x + pdf : array + stellar mass pdf, on the same coordinates _x """ dx = _x[1] - _x[0] @@ -127,6 +136,7 @@ def apply_halo_dependent_fs( N=int(1e3), f_b=0.16 ): + """Stellar mass PDF with `halo_dependent_fs` stellar fractions, by Monte Carlo sampling of the halo EVS PDF.""" # Sample _N haloes halom = sample_halo_evs_pdf(pdf, log10m, N) diff --git a/example/observables/data/flux_per_mass_MIRI.F770W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt b/example/observables/data/flux_per_mass_MIRI.F770W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt new file mode 100644 index 0000000..61556ec --- /dev/null +++ b/example/observables/data/flux_per_mass_MIRI.F770W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt @@ -0,0 +1,140 @@ +1.263909071101653174e-04 +1.508277557195765316e-05 +5.728035145982249001e-06 +2.709981038667780795e-06 +1.885015745758728490e-06 +1.463476801917361949e-06 +1.082216549568119808e-06 +9.138420551034747351e-07 +7.780270814315982121e-07 +6.787349799299449782e-07 +6.364792656532596813e-07 +5.974688182373775585e-07 +6.093832048013883503e-07 +6.130954460348245966e-07 +5.863923339362927939e-07 +5.573026926160278640e-07 +5.203610734581661134e-07 +4.761211846080803584e-07 +4.023906891683327137e-07 +3.633266397642326665e-07 +3.316972756936659330e-07 +3.014260691759116974e-07 +2.731918092939184449e-07 +2.507828777254479126e-07 +2.310136733309939116e-07 +2.252073184769077677e-07 +2.131062657192134365e-07 +2.001807546669585522e-07 +1.888109809963473752e-07 +1.803628645291265480e-07 +1.773598371988548403e-07 +1.743856043960659921e-07 +1.698223061141309880e-07 +1.623323956232467144e-07 +1.562319892329785351e-07 +1.421601394187319270e-07 +1.362013493878084616e-07 +1.311791184643664283e-07 +1.256185658195266823e-07 +1.212047876958009327e-07 +1.152063524736569586e-07 +1.028994311821095712e-07 +9.958842548800588089e-08 +9.256923907337222400e-08 +9.486629423215682009e-08 +1.072732254944011862e-07 +1.088627789515044049e-07 +1.094604065610259521e-07 +1.062996003904128086e-07 +1.049837620502375299e-07 +1.024916597416362896e-07 +9.986379874102748384e-08 +9.778379727684904162e-08 +9.523021186880922217e-08 +9.328029451417035338e-08 +9.078318253221437025e-08 +8.839579509990977652e-08 +8.643268361444555351e-08 +8.466927679410016164e-08 +8.293005064459728560e-08 +8.862971511032734371e-08 +8.438598073925507774e-08 +8.085435920987646962e-08 +8.256225025608716548e-08 +8.119000106967430121e-08 +8.280348371860130745e-08 +8.189458411657623746e-08 +8.173304656678180272e-08 +8.022818963883484898e-08 +7.979255912003108707e-08 +7.864289191021951385e-08 +7.895919919081143602e-08 +7.874734920980392573e-08 +7.804182693435638859e-08 +7.748548769660225335e-08 +7.746030667727543971e-08 +7.667252471424892069e-08 +7.609836774647590105e-08 +7.524872292462402239e-08 +7.494914996234875666e-08 +7.431408876912209032e-08 +6.546261262722465887e-08 +5.780513083659398306e-08 +5.666508438633782703e-08 +5.585860369113565314e-08 +5.336493083660696356e-08 +5.343406373109617697e-08 +5.258749525868880727e-08 +5.195244064454371479e-08 +5.170766354119408995e-08 +5.142712391328244208e-08 +5.095144144784977381e-08 +5.064255661365197398e-08 +5.019228158127612576e-08 +4.982659390923221709e-08 +4.899573472160526005e-08 +4.810168600869859363e-08 +4.774569145090891724e-08 +4.755296643934539997e-08 +4.726095210272644199e-08 +4.670562277657143297e-08 +4.609414484816240143e-08 +4.575975864935725168e-08 +4.542846662959326791e-08 +4.488981716709987871e-08 +4.444213757495932317e-08 +4.400623712202918118e-08 +4.326772798783396656e-08 +4.281484805308075671e-08 +4.246958496466061996e-08 +4.210725398269311447e-08 +4.053219610165592283e-08 +3.916755568497533890e-08 +3.891287579857520047e-08 +3.871333668218845595e-08 +3.852700027137142119e-08 +3.842810813481137473e-08 +3.823543953914588315e-08 +3.801700953341437470e-08 +3.788927007345032574e-08 +3.775143104326081160e-08 +3.761554109878853950e-08 +3.747664223476034663e-08 +3.731951003411957434e-08 +3.719664777594425343e-08 +3.706260049902966333e-08 +3.692420628756009517e-08 +3.685168913252643231e-08 +3.678400970288214721e-08 +3.668498650789158555e-08 +3.657231656571179844e-08 +3.649083369340309623e-08 +3.643792376915523961e-08 +3.636206600846770184e-08 +3.630507972255575990e-08 +3.624888320582691007e-08 +3.622114442652926738e-08 +3.621237620661535156e-08 +3.620544801486862724e-08 +3.618983108477870468e-08 diff --git a/example/observables/data/flux_per_mass_NIRCam.F115W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt b/example/observables/data/flux_per_mass_NIRCam.F115W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt new file mode 100644 index 0000000..6137518 --- /dev/null +++ b/example/observables/data/flux_per_mass_NIRCam.F115W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt @@ -0,0 +1,140 @@ +4.531321791836857090e-04 +4.718363458506940038e-05 +1.384461431120281813e-05 +9.514056788741023012e-06 +6.092475098471251641e-06 +4.215899508059227999e-06 +3.346281532548184447e-06 +2.844279295199818023e-06 +1.545134450896909703e-06 +1.328800853694525206e-06 +1.115406272611313455e-06 +9.341981887796549494e-07 +7.164663911563614287e-07 +6.415826176474674011e-07 +5.723899435039565032e-07 +5.196918964351955880e-07 +4.756517803322165384e-07 +4.423732408627046024e-07 +4.032796165855785781e-07 +3.770589303592689179e-07 +3.542410615460110019e-07 +3.327604907782738307e-07 +3.139763280842825614e-07 +2.955910548596243835e-07 +2.783239436669511781e-07 +2.637833199248332075e-07 +2.495815448323106987e-07 +2.369560511284915041e-07 +2.228902829360540420e-07 +2.136141066865161905e-07 +2.051730962894921290e-07 +1.960606071641020737e-07 +1.885838393401866574e-07 +1.811966071697100737e-07 +1.756009241229128195e-07 +1.703507787567532938e-07 +1.620219547242858941e-07 +1.466534729892366249e-07 +1.284552834764528982e-07 +1.119326681614963743e-07 +9.628147651148704564e-08 +8.213975730890724963e-08 +6.677097731881685399e-08 +5.078981828853800326e-08 +3.731400908996696793e-08 +2.385367578609667442e-08 +1.014276418194075911e-08 +7.874475917931044589e-10 +1.453835759335814448e-11 +5.752805586789623791e-12 +3.385121554566638086e-12 +1.864878858972013069e-12 +9.787123277697572369e-13 +4.955986016372654135e-13 +2.439427690525425727e-13 +1.029877987238228107e-13 +2.933340053242900808e-14 +1.480536619366591444e-15 +1.310418502424788128e-17 +1.036004526120880193e-18 +5.247178372759565606e-20 +6.151806988917503425e-22 +6.743493577192308539e-24 +2.991883573373704108e-26 +5.366526430387739901e-29 +2.653774435216797833e-35 +9.665752729019568671e-42 +3.259766843850597245e-48 +2.289013651877778739e-60 +3.856992595659545180e-68 +6.161785956557921062e-75 +1.893837970534654260e-81 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 diff --git a/example/observables/data/flux_per_mass_NIRCam.F150W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt b/example/observables/data/flux_per_mass_NIRCam.F150W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt new file mode 100644 index 0000000..708763f --- /dev/null +++ b/example/observables/data/flux_per_mass_NIRCam.F150W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt @@ -0,0 +1,140 @@ +4.262881974431843423e-04 +4.445686213390920782e-05 +1.746239181449768611e-05 +8.142921067221983486e-06 +4.186753049580737357e-06 +3.939395596794712189e-06 +2.907139029213833993e-06 +2.176459210848150913e-06 +1.824401678302697180e-06 +1.655693807159042470e-06 +1.457110350685803245e-06 +1.288712271761191223e-06 +7.674108957139226510e-07 +7.291993073895303013e-07 +6.400651588879024443e-07 +5.705021841209049150e-07 +5.067398838022702164e-07 +4.155379917105487736e-07 +3.768106458200615200e-07 +3.537575520625913671e-07 +3.290641830742934085e-07 +3.075389771923468435e-07 +2.899685101058353275e-07 +2.743780986551377737e-07 +2.612499752070298892e-07 +2.449304191674826018e-07 +2.350238592277975654e-07 +2.252137267916847502e-07 +2.157522457492482880e-07 +2.067276519198377596e-07 +1.989101487503789241e-07 +1.900926803597391121e-07 +1.826752335235183326e-07 +1.754509075078953885e-07 +1.687264599070066608e-07 +1.631365784396931533e-07 +1.568594210530340104e-07 +1.515507962478607988e-07 +1.445233557211192436e-07 +1.395351843420375331e-07 +1.360255623554264357e-07 +1.319419939016691455e-07 +1.284181784247828567e-07 +1.247203456958828843e-07 +1.214934546496150516e-07 +1.186888395706160367e-07 +1.162434632707843922e-07 +1.140567234557227057e-07 +1.121570149297500697e-07 +1.092661237774993674e-07 +9.960677228988164058e-08 +8.943295572071305744e-08 +8.028655687234741391e-08 +7.065956431971657501e-08 +6.200171106638771481e-08 +5.412372926500477772e-08 +4.556834747310292345e-08 +3.809056057551230626e-08 +3.081560833811154138e-08 +2.338395674321445687e-08 +1.620973710549017455e-08 +9.986569747195028579e-09 +4.222855467586197552e-09 +2.041868040831386420e-10 +2.143295099078110402e-12 +2.328150239225134406e-17 +8.409811440419905300e-18 +3.011279848935236349e-18 +1.028580670329898468e-18 +3.330066065618952938e-19 +1.049378833694755561e-19 +3.261531626418895621e-20 +9.635414238105126895e-21 +2.663431844079811206e-21 +6.570709809339200740e-22 +1.115517922385184540e-22 +2.058788518728008638e-24 +9.146986510203454291e-27 +7.758108126543195505e-33 +6.532947716136799330e-34 +5.846257862834707884e-36 +2.319452968751275007e-38 +8.040377542967909579e-41 +5.104432326354478455e-48 +7.114283876262939112e-51 +1.946067559336378350e-54 +1.599625836351249272e-68 +1.416813288359711934e-82 +1.738049084904037500e-96 +6.788356823469043550e-116 +1.958405957823020729e-120 +8.984043629919477661e-136 +6.334059822664737058e-150 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 diff --git a/example/observables/data/flux_per_mass_NIRCam.F200W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt b/example/observables/data/flux_per_mass_NIRCam.F200W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt new file mode 100644 index 0000000..72e8c26 --- /dev/null +++ b/example/observables/data/flux_per_mass_NIRCam.F200W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt @@ -0,0 +1,140 @@ +5.075086541881893443e-04 +4.756315866522651105e-05 +1.523015477724361012e-05 +7.805408153908422595e-06 +5.004725885333719444e-06 +3.302986702600244193e-06 +2.373971055068132561e-06 +1.562018335952599036e-06 +1.675954747649116271e-06 +1.416077935644411429e-06 +1.187130266811153189e-06 +1.003866158530234037e-06 +7.915651061150755885e-07 +8.650455736454697201e-07 +7.882985625908586415e-07 +7.376833853181931369e-07 +6.810266725310295208e-07 +4.678090170150268268e-07 +4.154612547906644782e-07 +3.989745780685293746e-07 +3.719224072875251825e-07 +3.385459740941894065e-07 +3.124812069258977334e-07 +2.889503122233157600e-07 +2.656003910560998241e-07 +2.283185667717546760e-07 +2.201455083481301510e-07 +2.090178959385841747e-07 +1.990995834650608180e-07 +1.901210737494614079e-07 +1.823655644691701333e-07 +1.752455576239490734e-07 +1.688729359046968148e-07 +1.636795362335765134e-07 +1.582269941421812658e-07 +1.511410119102908270e-07 +1.472242228658060362e-07 +1.427424589840700823e-07 +1.390840841180742655e-07 +1.350297867848132984e-07 +1.310979564805099056e-07 +1.276847279033398434e-07 +1.243122297983079777e-07 +1.206746777376237461e-07 +1.175407618433134404e-07 +1.144941367540539650e-07 +1.113046010410062794e-07 +1.086801217706440816e-07 +1.062488845530092593e-07 +1.034644049785330147e-07 +1.009407762898186079e-07 +9.849860488263426507e-08 +9.505703307263058976e-08 +9.290216918070283056e-08 +9.121414718473038418e-08 +8.971473381708279257e-08 +8.809676365973496911e-08 +8.652038031331880923e-08 +8.476874833972750661e-08 +8.344154256665135014e-08 +8.226953540605542097e-08 +8.095984130935851867e-08 +7.984003691190435896e-08 +7.888390899989162703e-08 +7.816782985385774712e-08 +7.726938533602347148e-08 +7.567522000087277314e-08 +7.219107868845499186e-08 +6.767504672831563860e-08 +6.296142175991651751e-08 +5.804607112685446187e-08 +5.344874464198576786e-08 +4.892114281393485432e-08 +4.460987593793190777e-08 +4.026470114914274650e-08 +3.644372315338271100e-08 +3.243797023506346763e-08 +2.854366785794706646e-08 +2.475018426455058337e-08 +2.103061767647204234e-08 +1.737938066018643747e-08 +1.395693302845256031e-08 +1.050156319414971059e-08 +7.165939783853178956e-09 +4.064505314193689541e-09 +1.396675180667910515e-09 +8.340838448260442468e-11 +1.881033621372988089e-12 +1.069964375336418228e-31 +1.522042392223749066e-32 +2.059609352049452241e-33 +2.654170309794535693e-34 +3.229027261402404706e-35 +3.773984435852855980e-36 +4.077264366608347462e-37 +4.329631908045261111e-38 +4.217984793180207861e-39 +3.863123423165105570e-40 +3.387176139864238435e-41 +2.818892981150435713e-42 +2.155743038333134987e-43 +1.583662646308427542e-44 +7.672062611572126915e-46 +7.266515756717590928e-48 +2.773857082966173078e-50 +8.781391014707952911e-53 +1.455443137695011726e-73 +1.382977127713258361e-75 +4.039498155632278806e-78 +3.019819155989959973e-81 +8.429135350888773558e-85 +8.799278906979463806e-88 +5.656003932699768118e-109 +2.995665835492040493e-113 +5.645884538508774768e-117 +6.982330644612467094e-125 +1.186294650446211967e-160 +1.254107383813953491e-165 +1.334542368849000195e-201 +1.478182529644083118e-236 +1.583531464316406036e-243 +3.855470047220505960e-284 +4.775399910987118612e-292 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 +-0.000000000000000000e+00 diff --git a/example/observables/data/flux_per_mass_NIRCam.F277W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt b/example/observables/data/flux_per_mass_NIRCam.F277W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt new file mode 100644 index 0000000..f2eebfc --- /dev/null +++ b/example/observables/data/flux_per_mass_NIRCam.F277W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt @@ -0,0 +1,140 @@ +2.730922060263486577e-04 +4.194752972757090722e-05 +1.803286949570388073e-05 +8.519059902345068426e-06 +4.905740600640447746e-06 +3.095855039079286029e-06 +2.308387911914829126e-06 +1.689602320213335029e-06 +1.517274614532213765e-06 +1.194435727309155225e-06 +9.723131434529135150e-07 +7.760205408426219537e-07 +6.294955079041634923e-07 +6.871471309379275504e-07 +6.724225924371006729e-07 +6.059898584421968884e-07 +5.433306525451269706e-07 +4.787880659023191945e-07 +4.229148733515714684e-07 +4.280291812952547170e-07 +4.314373417697350433e-07 +4.121058733711684217e-07 +3.881060192029302054e-07 +3.734390867600832225e-07 +3.503829452856157318e-07 +3.280065948705831266e-07 +2.540293156068771457e-07 +2.303394144316081281e-07 +2.222682129488128930e-07 +2.114727303071341239e-07 +2.018859562453101230e-07 +1.896564867481559099e-07 +1.809604139180471735e-07 +1.713477878439074768e-07 +1.623196258361005079e-07 +1.530983822178932913e-07 +1.455908009918155864e-07 +1.311781069134584083e-07 +1.279054697789982949e-07 +1.239018741517340009e-07 +1.199192539304601550e-07 +1.163844060706706145e-07 +1.129429742200062128e-07 +1.098924866241174122e-07 +1.071063768544867516e-07 +1.044274440115171155e-07 +1.019292440477863670e-07 +9.987094863078644635e-08 +9.788111351474516567e-08 +9.608841908995245495e-08 +9.410222836291846377e-08 +9.143707719764263278e-08 +8.975681206550582958e-08 +8.825120094069739874e-08 +8.678737234593660123e-08 +8.529105351354526259e-08 +8.384153431257016024e-08 +8.244783163087575789e-08 +8.102541033617914890e-08 +7.971013568159463148e-08 +7.845177560427847716e-08 +7.725568300465357446e-08 +7.605317059009335835e-08 +7.487642394600807293e-08 +7.375939929548783777e-08 +7.259562320459014700e-08 +7.158345172143547887e-08 +7.058019441040295075e-08 +6.954775405213195577e-08 +6.857723113325168633e-08 +6.766256928743701757e-08 +6.666017038914519741e-08 +6.564851935319616557e-08 +6.440375548502690463e-08 +6.327180590168696046e-08 +6.235794219770784915e-08 +6.176204039655724822e-08 +6.120785018173666250e-08 +6.061881043401148385e-08 +6.004962606924568950e-08 +5.961342307545471901e-08 +5.900344365283318854e-08 +5.845630228614467797e-08 +5.794948374230608821e-08 +5.750717093050392945e-08 +5.711498060878071015e-08 +5.679382419983016237e-08 +5.639841511716466423e-08 +5.597633569856281727e-08 +5.569480888473057384e-08 +5.546966056019723433e-08 +5.525626264189278341e-08 +5.488711658494105239e-08 +5.410790080979325463e-08 +5.247100870065155522e-08 +5.027422044723650110e-08 +4.805839977563567729e-08 +4.614652051230183395e-08 +4.420503723618871146e-08 +4.199526041356579196e-08 +3.960498408126852101e-08 +3.736231257676718099e-08 +3.531251274643300462e-08 +3.313755445484486609e-08 +3.095721777004768131e-08 +2.893835675112899683e-08 +2.698301811250589383e-08 +2.503114424706301725e-08 +2.308612393018572689e-08 +2.124917970619590036e-08 +1.936088954394348694e-08 +1.744836128526440885e-08 +1.567570029807769807e-08 +1.390968476777567601e-08 +1.213220108034001321e-08 +1.053003107385733127e-08 +8.990494976250898892e-09 +7.417748609115591479e-09 +5.956191429104911835e-09 +4.530999117275610731e-09 +3.157089231909746193e-09 +1.903083836944286614e-09 +7.817258713983599459e-10 +2.232640497487031616e-10 +7.441084458550022932e-11 +3.056501015342691327e-11 +1.136257966371750247e-11 +3.978649955017062650e-12 +5.275137001600024549e-13 +2.838483808316909703e-88 +2.561635674489444806e-90 +2.100940111110261458e-92 +1.586029848842389928e-94 +1.086327352454989994e-96 +6.911368060124012904e-99 +3.958743472386610530e-101 +2.046480491186559935e-103 +9.600171930871975279e-106 +4.144163939467360278e-108 +1.633470196853028371e-110 diff --git a/example/observables/data/flux_per_mass_NIRCam.F356W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt b/example/observables/data/flux_per_mass_NIRCam.F356W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt new file mode 100644 index 0000000..5a9a689 --- /dev/null +++ b/example/observables/data/flux_per_mass_NIRCam.F356W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt @@ -0,0 +1,140 @@ +2.054733569608498112e-04 +2.552414597618235268e-05 +1.084388241148065254e-05 +7.541051956515073423e-06 +5.318188749495498941e-06 +3.783969942898680486e-06 +2.471298542125097408e-06 +1.784331324721310946e-06 +1.366420806083499914e-06 +1.141732326649064579e-06 +9.424904927444170255e-07 +8.260771204731256362e-07 +7.781819683494261206e-07 +6.532380265347307657e-07 +5.750421609600321649e-07 +5.123630695946725358e-07 +4.098376813678419785e-07 +3.587101899640678714e-07 +3.424107917834914118e-07 +4.081713801948786284e-07 +3.869172684290215152e-07 +3.622647529550143968e-07 +3.422174104637632224e-07 +3.187103670550602991e-07 +2.989122666987948052e-07 +2.235068510778048000e-07 +2.502604944419985316e-07 +2.677964198836064891e-07 +2.614105412315951793e-07 +2.559854287848701949e-07 +2.516655876745958947e-07 +2.491930034741743488e-07 +2.424090343386624612e-07 +2.356347212247005023e-07 +2.083712874298353021e-07 +1.599090847650788764e-07 +1.457097177354318879e-07 +1.481309893795017875e-07 +1.436371607175875218e-07 +1.401367526746488317e-07 +1.358625933575211552e-07 +1.290418464286390863e-07 +1.255254408109377652e-07 +1.210680013602360578e-07 +1.169023363022216184e-07 +1.125825626078827194e-07 +1.078618066911352240e-07 +1.033954404379943860e-07 +9.513426329997548531e-08 +8.933529554919655912e-08 +8.741193289320113348e-08 +8.637230578536112229e-08 +8.442166386518627444e-08 +8.260893106164911917e-08 +8.091607579865541701e-08 +7.927277375440987624e-08 +7.773948462521075557e-08 +7.638949395974431114e-08 +7.515336968506977881e-08 +7.395022496910860852e-08 +7.277295249547493722e-08 +7.172536242089394543e-08 +7.080380175168498553e-08 +6.995817673466051400e-08 +6.911591965515832477e-08 +6.803706104427442402e-08 +6.644011478262235963e-08 +6.557040781884372209e-08 +6.499348135076710625e-08 +6.430756645441944813e-08 +6.360441204209146659e-08 +6.302769291652899103e-08 +6.247780926100552052e-08 +6.182668985495631692e-08 +6.121534200397453573e-08 +6.060189695251186466e-08 +5.999070280338546053e-08 +5.946024145719603071e-08 +5.895678928488432362e-08 +5.841361935437966963e-08 +5.781445989077066624e-08 +5.722238129814753093e-08 +5.670951747431200498e-08 +5.618655000412682487e-08 +5.566468071328643799e-08 +5.517063919983231623e-08 +5.460301032254710810e-08 +5.412970242383926592e-08 +5.371779102740886902e-08 +5.333479812055145879e-08 +5.295068362799359902e-08 +5.248544268434489584e-08 +5.204879422359758582e-08 +5.163311435702524733e-08 +5.124199621142083504e-08 +5.084798114319373579e-08 +5.028610601160185509e-08 +4.961469118278805766e-08 +4.919197824873359497e-08 +4.886706748649015216e-08 +4.859558576558556504e-08 +4.837783392404515753e-08 +4.814643943471389593e-08 +4.794670734743537381e-08 +4.776158814479904039e-08 +4.747425494739229642e-08 +4.725774579468353856e-08 +4.697413382660242025e-08 +4.668525211000656280e-08 +4.649433350831076110e-08 +4.633446308954335534e-08 +4.617172056834546396e-08 +4.601094446782909115e-08 +4.583763673452869416e-08 +4.566830570332620794e-08 +4.558363477583390100e-08 +4.547477085711891403e-08 +4.542487762898040393e-08 +4.542651996926336431e-08 +4.537753661741628013e-08 +4.529654932188317112e-08 +4.521231252870148327e-08 +4.492298690824717809e-08 +4.428789820135350230e-08 +4.335894552982776116e-08 +4.233263402509696593e-08 +4.110401953421866855e-08 +3.984038758285610199e-08 +3.845756901758961614e-08 +3.703415082910141275e-08 +3.562446463581745763e-08 +3.421133698802835328e-08 +3.283695386924923153e-08 +3.158640808492270283e-08 +3.012576248342782020e-08 +2.886977874257966834e-08 +2.745259136062168627e-08 +2.615835400259426875e-08 +2.493209144952425671e-08 +2.351827045718068897e-08 diff --git a/example/observables/data/flux_per_mass_NIRCam.F444W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt b/example/observables/data/flux_per_mass_NIRCam.F444W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt new file mode 100644 index 0000000..5ab36e8 --- /dev/null +++ b/example/observables/data/flux_per_mass_NIRCam.F444W_Exponential_tau-0.1_bpass-2.2.1-bin_chabrier03-0.1,300.0_cloudy-c23.01-sps.txt @@ -0,0 +1,140 @@ +1.753297767054612605e-04 +2.044923437383722249e-05 +8.546344275912907135e-06 +4.690204791927333066e-06 +3.454724059776510534e-06 +3.108455518961646428e-06 +2.535694497010024606e-06 +2.071262152527035233e-06 +1.529120895209457471e-06 +1.200493968562165092e-06 +9.739222406689746586e-07 +8.048672844472303534e-07 +6.790914782215132930e-07 +6.218746079782694052e-07 +5.403909558307331285e-07 +5.123536708799751477e-07 +4.843578503164058358e-07 +4.428439905864973999e-07 +3.832827042142236221e-07 +3.467020263155741864e-07 +3.155183927047513167e-07 +2.732169180285852420e-07 +2.496641049612040796e-07 +2.269533706547998253e-07 +2.487232512630517533e-07 +2.814381108460336442e-07 +2.661536597082673207e-07 +2.500197778728835952e-07 +2.362890476680848932e-07 +2.207165693016757095e-07 +2.044027219649202940e-07 +1.917085653626377771e-07 +1.763733344782975960e-07 +1.594078768029568671e-07 +1.900743592307165188e-07 +1.948975498638779256e-07 +1.909524652909077690e-07 +1.840875809268420712e-07 +1.785627682145764621e-07 +1.726361672049986047e-07 +1.690610527178192732e-07 +1.621376168625166060e-07 +1.562354686335391658e-07 +1.500441204695383167e-07 +1.388803758749386534e-07 +1.153698504903366317e-07 +1.070857545659192866e-07 +1.085250637652692846e-07 +1.059392133274679650e-07 +1.029742674857576410e-07 +1.005532309290464899e-07 +9.791079859160734714e-08 +9.509301299111779819e-08 +9.169079126406379831e-08 +8.922933355879320860e-08 +8.684204873242345340e-08 +8.416625946953725653e-08 +8.174724660044831856e-08 +7.929771163999248240e-08 +7.689676052240532679e-08 +7.441689125821047548e-08 +7.204464260487434653e-08 +6.810979437882665759e-08 +6.568230851576604877e-08 +6.551031080204416392e-08 +6.473320173927736226e-08 +6.366913020359055715e-08 +6.269466378736227035e-08 +6.183984091630005101e-08 +6.098551236774013912e-08 +6.012297745444239866e-08 +5.935075343556346975e-08 +5.866359633551383867e-08 +5.801644385847971785e-08 +5.738989209878224462e-08 +5.674794919663088345e-08 +5.613187445745664923e-08 +5.557234204760844575e-08 +5.511665131201692210e-08 +5.472466895424819600e-08 +5.432300487851881369e-08 +5.395035346420635489e-08 +5.357461710604782551e-08 +5.311975040360659519e-08 +5.250902548164928638e-08 +5.198623814595699470e-08 +5.169813348276074736e-08 +5.135455823285930024e-08 +5.105269512657352893e-08 +5.076122741278040046e-08 +5.049430177267994718e-08 +5.022405885001295366e-08 +4.988180295049453371e-08 +4.959374856322933678e-08 +4.931105640542924503e-08 +4.899034144876662186e-08 +4.868691258068338029e-08 +4.840316936137115950e-08 +4.816461636568184966e-08 +4.791119435886923857e-08 +4.760183329122409660e-08 +4.733949203389463475e-08 +4.711290445031930484e-08 +4.685852988268127017e-08 +4.661374855938128177e-08 +4.638373468636154542e-08 +4.617296447836158667e-08 +4.591549858244968379e-08 +4.565451333253623575e-08 +4.546585215138659622e-08 +4.529696709329770589e-08 +4.511582001852514060e-08 +4.490208836785338810e-08 +4.469636072480144846e-08 +4.449529342303856158e-08 +4.429225983790983696e-08 +4.410011477374096752e-08 +4.388293863035140756e-08 +4.362886232230759922e-08 +4.340248644822324336e-08 +4.309547383858105233e-08 +4.262379840728189623e-08 +4.227514637127169312e-08 +4.205172413410284151e-08 +4.190757077574890007e-08 +4.181013219852176302e-08 +4.175672864435880191e-08 +4.167711403003369043e-08 +4.158413238767542529e-08 +4.151564630672304350e-08 +4.143436236290595433e-08 +4.136071543646200314e-08 +4.132536345593766656e-08 +4.125080992774486913e-08 +4.108891267785648932e-08 +4.097313769257208179e-08 +4.092848470843994376e-08 +4.089173499371124166e-08 +4.085124154771083363e-08 +4.081221013487967616e-08 diff --git a/pyproject.toml b/pyproject.toml index d3682bb..31c3778 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,9 +45,17 @@ observables = [ "unyt", "cosmos-synthesizer", ] +# Building the documentation in docs/ +docs = [ + "evstats[examples]", + "sphinx", + "myst-nb", + "shibuya", +] [project.urls] Homepage = "https://github.com/christopherlovell/evstats" +Documentation = "https://www.christopherlovell.co.uk/evstats/" Repository = "https://github.com/christopherlovell/evstats" Paper = "https://academic.oup.com/mnras/article/518/2/2511/6823705"