diffsky 0.1.1__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {diffsky-0.1.1 → diffsky-0.1.2}/.github/workflows/linting.yml +1 -1
- diffsky-0.1.2/.github/workflows/monthly-warning-test.yml +58 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/.github/workflows/tests.yml +6 -2
- diffsky-0.1.2/.github/workflows/tests_cron.yml +88 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/CHANGES.rst +5 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/PKG-INFO +6 -6
- {diffsky-0.1.1 → diffsky-0.1.2}/README.rst +1 -1
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/__init__.py +2 -0
- diffsky-0.1.2/diffsky/_version.py +1 -0
- diffsky-0.1.2/diffsky/burstpop/__init__.py +11 -0
- diffsky-0.1.2/diffsky/burstpop/diagnostics/plot_fburstpop.py +60 -0
- diffsky-0.1.2/diffsky/burstpop/diagnostics/tests/test_plot_fburstpop.py +15 -0
- diffsky-0.1.2/diffsky/burstpop/diffburstpop.py +87 -0
- diffsky-0.1.2/diffsky/burstpop/diffqburstpop.py +97 -0
- diffsky-0.1.2/diffsky/burstpop/fburstpop.py +139 -0
- diffsky-0.1.2/diffsky/burstpop/freqburst.py +141 -0
- diffsky-0.1.2/diffsky/burstpop/freqburst_mono.py +156 -0
- diffsky-0.1.2/diffsky/burstpop/tburstpop.py +172 -0
- diffsky-0.1.2/diffsky/burstpop/tests/test_diffburstpop.py +116 -0
- diffsky-0.1.2/diffsky/burstpop/tests/test_diffqburstpop.py +129 -0
- diffsky-0.1.2/diffsky/burstpop/tests/test_fburstpop.py +114 -0
- diffsky-0.1.2/diffsky/burstpop/tests/test_freqburst.py +121 -0
- diffsky-0.1.2/diffsky/burstpop/tests/test_freqburst_mono.py +162 -0
- diffsky-0.1.2/diffsky/burstpop/tests/test_tburstpop.py +268 -0
- diffsky-0.1.2/diffsky/dustpop/__init__.py +3 -0
- diffsky-0.1.2/diffsky/dustpop/avpop.py +128 -0
- diffsky-0.1.2/diffsky/dustpop/avpop_flex.py +248 -0
- diffsky-0.1.2/diffsky/dustpop/avpop_mono.py +210 -0
- diffsky-0.1.2/diffsky/dustpop/deltapop.py +130 -0
- diffsky-0.1.2/diffsky/dustpop/diagnostics/plot_avpop_flex.py +175 -0
- diffsky-0.1.2/diffsky/dustpop/diagnostics/plot_funopop_simple.py +60 -0
- diffsky-0.1.2/diffsky/dustpop/diagnostics/tests/test_plot_avpop_flex.py +18 -0
- diffsky-0.1.2/diffsky/dustpop/diagnostics/tests/test_plot_funopop_simple.py +15 -0
- diffsky-0.1.2/diffsky/dustpop/funopop.py +298 -0
- diffsky-0.1.2/diffsky/dustpop/funopop_simple.py +147 -0
- diffsky-0.1.2/diffsky/dustpop/funopop_ssfr.py +101 -0
- diffsky-0.1.2/diffsky/dustpop/sbl18_dust.py +33 -0
- diffsky-0.1.2/diffsky/dustpop/sbl18_dust_kernels.py +121 -0
- diffsky-0.1.2/diffsky/dustpop/sbl18_dustpop.py +174 -0
- diffsky-0.1.2/diffsky/dustpop/tests/test_avpop.py +115 -0
- diffsky-0.1.2/diffsky/dustpop/tests/test_avpop_flex.py +162 -0
- diffsky-0.1.2/diffsky/dustpop/tests/test_avpop_mono.py +246 -0
- diffsky-0.1.2/diffsky/dustpop/tests/test_deltapop.py +112 -0
- diffsky-0.1.2/diffsky/dustpop/tests/test_funopop_model.py +130 -0
- diffsky-0.1.2/diffsky/dustpop/tests/test_funopop_simple.py +104 -0
- diffsky-0.1.2/diffsky/dustpop/tests/test_funopop_ssfr.py +103 -0
- diffsky-0.1.2/diffsky/dustpop/tests/test_sbl18_dustpop.py +37 -0
- diffsky-0.1.2/diffsky/dustpop/tests/test_tw_dust_kernels.py +17 -0
- diffsky-0.1.2/diffsky/dustpop/tests/test_tw_dustpop.py +37 -0
- diffsky-0.1.2/diffsky/dustpop/tests/test_tw_dustpop_new.py +143 -0
- diffsky-0.1.2/diffsky/dustpop/tw_dust.py +33 -0
- diffsky-0.1.2/diffsky/dustpop/tw_dust_kernels.py +141 -0
- diffsky-0.1.2/diffsky/dustpop/tw_dustpop.py +174 -0
- diffsky-0.1.2/diffsky/dustpop/tw_dustpop_new.py +174 -0
- diffsky-0.1.2/diffsky/experimental/__init__.py +0 -0
- diffsky-0.1.2/diffsky/experimental/dspspop/__init__.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/burstshapepop.py +11 -10
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/dust_deltapop.py +3 -6
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/dustpop.py +5 -3
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/lgavpop.py +3 -7
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/lgfburstpop.py +3 -6
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/photpop.py +8 -4
- diffsky-0.1.2/diffsky/experimental/dspspop/tests/__init__.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/tests/test_burstshapepop.py +18 -11
- diffsky-0.1.2/diffsky/experimental/tests/__init__.py +0 -0
- diffsky-0.1.2/diffsky/mass_functions/__init__.py +6 -0
- diffsky-0.1.2/diffsky/mass_functions/ccshmf_model.py +97 -0
- diffsky-0.1.2/diffsky/mass_functions/fitting_utils/README.rst +1 -0
- diffsky-0.1.2/diffsky/mass_functions/fitting_utils/__init__.py +0 -0
- diffsky-0.1.2/diffsky/mass_functions/fitting_utils/fit_ccshmf.py +53 -0
- diffsky-0.1.2/diffsky/mass_functions/fitting_utils/fit_ccshmf_kernels.py +45 -0
- diffsky-0.1.2/diffsky/mass_functions/fitting_utils/fit_hmf_kernels.py +44 -0
- diffsky-0.1.2/diffsky/mass_functions/fitting_utils/fit_hmf_model.py +51 -0
- diffsky-0.1.2/diffsky/mass_functions/fitting_utils/fitting_helpers.py +182 -0
- diffsky-0.1.2/diffsky/mass_functions/fitting_utils/tests/__init__.py +0 -0
- diffsky-0.1.2/diffsky/mass_functions/fitting_utils/tests/test_fit_ccshmf.py +57 -0
- diffsky-0.1.2/diffsky/mass_functions/fitting_utils/tests/test_fit_ccshmf_kernels.py +28 -0
- diffsky-0.1.2/diffsky/mass_functions/fitting_utils/tests/test_fit_hmf_kernels.py +28 -0
- diffsky-0.1.2/diffsky/mass_functions/fitting_utils/tests/test_fit_hmf_model.py +84 -0
- diffsky-0.1.2/diffsky/mass_functions/hmf_model.py +146 -0
- diffsky-0.1.2/diffsky/mass_functions/io_utils/README.txt +2 -0
- diffsky-0.1.2/diffsky/mass_functions/io_utils/__init__.py +0 -0
- diffsky-0.1.2/diffsky/mass_functions/io_utils/loader.py +33 -0
- diffsky-0.1.2/diffsky/mass_functions/io_utils/smdpl_helpers.py +38 -0
- diffsky-0.1.2/diffsky/mass_functions/kernels/__init__.py +0 -0
- diffsky-0.1.2/diffsky/mass_functions/kernels/ccshmf_kernels.py +44 -0
- diffsky-0.1.2/diffsky/mass_functions/kernels/hmf_kernels.py +42 -0
- diffsky-0.1.2/diffsky/mass_functions/kernels/tests/__init__.py +0 -0
- diffsky-0.1.2/diffsky/mass_functions/kernels/tests/test_ccshmf_kernels.py +12 -0
- diffsky-0.1.2/diffsky/mass_functions/kernels/tests/test_hmf_kernels.py +12 -0
- diffsky-0.1.2/diffsky/mass_functions/mc_diffmah_tpeak.py +192 -0
- diffsky-0.1.2/diffsky/mass_functions/mc_hosts.py +79 -0
- diffsky-0.1.2/diffsky/mass_functions/mc_subhalo_catalog.py +129 -0
- diffsky-0.1.2/diffsky/mass_functions/mc_subs.py +104 -0
- diffsky-0.1.2/diffsky/mass_functions/mc_tinfall.py +65 -0
- diffsky-0.1.2/diffsky/mass_functions/measure_ccshmf.py +63 -0
- diffsky-0.1.2/diffsky/mass_functions/measure_hmf.py +22 -0
- diffsky-0.1.2/diffsky/mass_functions/smhm_kernels/__init__.py +0 -0
- diffsky-0.1.2/diffsky/mass_functions/smhm_kernels/tests/__init__.py +0 -0
- diffsky-0.1.2/diffsky/mass_functions/smhm_kernels/tests/test_threeroll_smhm.py +112 -0
- diffsky-0.1.2/diffsky/mass_functions/smhm_kernels/threeroll_kernels.py +102 -0
- diffsky-0.1.2/diffsky/mass_functions/smhm_kernels/threeroll_smhm.py +77 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/__init__.py +0 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/test_ccshmf.py +92 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/test_hmf_model.py +74 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/test_mc_diffmah_tpeak.py +26 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/test_mc_hosts.py +41 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/test_mc_subhalo_catalog.py +21 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/test_mc_subs.py +130 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/test_mc_tinfall.py +56 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/test_measure_hmf.py +32 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/README.txt +2 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/__init__.py +0 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/smdpl_cshmf_cuml_redshift_0.00_lgmhost_12.32.txt +50 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/smdpl_cshmf_cuml_redshift_0.00_lgmhost_13.00.txt +50 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/smdpl_cshmf_cuml_redshift_0.00_lgmhost_13.55.txt +50 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/smdpl_cshmf_cuml_redshift_0.00_lgmhost_14.08.txt +50 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/smdpl_cshmf_cuml_redshift_1.00_lgmhost_12.31.txt +50 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/smdpl_cshmf_cuml_redshift_1.00_lgmhost_12.99.txt +50 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/smdpl_cshmf_cuml_redshift_1.00_lgmhost_13.51.txt +50 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/smdpl_cshmf_cuml_redshift_1.00_lgmhost_14.05.txt +50 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/smdpl_hmf_cuml_redshift_0.05.txt +48 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/smdpl_hmf_cuml_redshift_1.00.txt +47 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/smdpl_hmf_cuml_redshift_2.14.txt +44 -0
- diffsky-0.1.2/diffsky/mass_functions/tests/testing_data/smdpl_hmf_cuml_redshift_3.95.txt +45 -0
- diffsky-0.1.2/diffsky/mass_functions/upweighting/__init__.py +0 -0
- diffsky-0.1.2/diffsky/mass_functions/upweighting/namedtuple_cat_utils.py +40 -0
- diffsky-0.1.2/diffsky/mass_functions/upweighting/tests/__init__.py +0 -0
- diffsky-0.1.2/diffsky/mass_functions/upweighting/tests/test_mc_gen_upweighting.py +203 -0
- diffsky-0.1.2/diffsky/mass_functions/upweighting/upweighting.py +56 -0
- diffsky-0.1.2/diffsky/mass_functions/utils.py +29 -0
- diffsky-0.1.2/diffsky/sbl18_photgrad.py +282 -0
- diffsky-0.1.2/diffsky/sumstats/__init__.py +0 -0
- diffsky-0.1.2/diffsky/sumstats/diffndhist.py +168 -0
- diffsky-0.1.2/diffsky/sumstats/smhm.py +43 -0
- diffsky-0.1.2/diffsky/sumstats/tests/__init__.py +0 -0
- diffsky-0.1.2/diffsky/sumstats/tests/test_smhm.py +19 -0
- diffsky-0.1.2/diffsky/systematics/__init__.py +0 -0
- diffsky-0.1.2/diffsky/systematics/ssp_errors.py +110 -0
- diffsky-0.1.2/diffsky/systematics/tests/__init__.py +0 -0
- diffsky-0.1.2/diffsky/systematics/tests/test_ssp_errors.py +108 -0
- diffsky-0.1.2/diffsky/tests/__init__.py +0 -0
- diffsky-0.1.2/diffsky/tests/test_dependencies.py +9 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/tests/test_diffsky_setup.py +1 -1
- diffsky-0.1.2/diffsky/tests/test_sbl18_photgrad.py +31 -0
- diffsky-0.1.2/diffsky/tests/test_tw_photgrad.py +205 -0
- diffsky-0.1.2/diffsky/tests/test_utils.py +26 -0
- diffsky-0.1.2/diffsky/tests/testing_data/__init__.py +0 -0
- diffsky-0.1.2/diffsky/tw_photgrad.py +258 -0
- diffsky-0.1.2/diffsky/tw_utils.py +145 -0
- diffsky-0.1.2/diffsky/utils.py +69 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky.egg-info/PKG-INFO +6 -6
- diffsky-0.1.2/diffsky.egg-info/SOURCES.txt +191 -0
- diffsky-0.1.2/diffsky.egg-info/requires.txt +6 -0
- diffsky-0.1.2/docs/source/demo_diffmahpop_t_peak.ipynb +169 -0
- diffsky-0.1.2/docs/source/demos.rst +8 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/docs/source/index.rst +1 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/docs/source/installation.rst +1 -1
- {diffsky-0.1.1 → diffsky-0.1.2}/docs/source/rtd_environment.yaml +2 -2
- {diffsky-0.1.1 → diffsky-0.1.2}/pyproject.toml +7 -5
- diffsky-0.1.2/requirements.txt +6 -0
- diffsky-0.1.1/diffsky/_version.py +0 -1
- diffsky-0.1.1/diffsky/tests/test_utils.py +0 -13
- diffsky-0.1.1/diffsky/utils.py +0 -16
- diffsky-0.1.1/diffsky.egg-info/SOURCES.txt +0 -55
- diffsky-0.1.1/diffsky.egg-info/requires.txt +0 -6
- diffsky-0.1.1/requirements.txt +0 -6
- {diffsky-0.1.1 → diffsky-0.1.2}/.coveragerc +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/.git_archival.txt +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/.gitattributes +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/.gitignore +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/.readthedocs.yml +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/LICENSE.rst +0 -0
- {diffsky-0.1.1/diffsky/experimental → diffsky-0.1.2/diffsky/burstpop/diagnostics}/__init__.py +0 -0
- {diffsky-0.1.1/diffsky/experimental/dspspop → diffsky-0.1.2/diffsky/burstpop/diagnostics/tests}/__init__.py +0 -0
- {diffsky-0.1.1/diffsky/experimental/dspspop → diffsky-0.1.2/diffsky/burstpop}/tests/__init__.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/diffndhist.py +0 -0
- {diffsky-0.1.1/diffsky/experimental/tests → diffsky-0.1.2/diffsky/dustpop/diagnostics}/__init__.py +0 -0
- {diffsky-0.1.1/diffsky → diffsky-0.1.2/diffsky/dustpop/diagnostics}/tests/__init__.py +0 -0
- {diffsky-0.1.1/diffsky/tests/testing_data → diffsky-0.1.2/diffsky/dustpop/tests}/__init__.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/boris_dust.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/nagaraj22_dust.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/tests/test_attavpop.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/tests/test_boris_dust.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/tests/test_dustdeltapop.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/tests/test_lgfburstpop.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/dspspop/tests/test_photpop.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/photometry_interpolation.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/experimental/tests/test_photometry_interpolation.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky/tests/test_diffndhist.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky.egg-info/dependency_links.txt +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/diffsky.egg-info/top_level.txt +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/docs/Makefile +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/docs/make.bat +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/docs/source/citation.rst +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/docs/source/conf.py +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/setup.cfg +0 -0
- {diffsky-0.1.1 → diffsky-0.1.2}/setup.py +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name: Test for Warnings
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch: null
|
|
5
|
+
schedule:
|
|
6
|
+
# Runs "First of every month at 3:15am Central"
|
|
7
|
+
- cron: '15 8 1 * *'
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
tests:
|
|
11
|
+
name: tests
|
|
12
|
+
runs-on: "ubuntu-latest"
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v2
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
|
|
19
|
+
- uses: conda-incubator/setup-miniconda@v2
|
|
20
|
+
with:
|
|
21
|
+
python-version: 3.11
|
|
22
|
+
channels: conda-forge,defaults
|
|
23
|
+
channel-priority: strict
|
|
24
|
+
show-channel-urls: true
|
|
25
|
+
miniforge-version: latest
|
|
26
|
+
miniforge-variant: Mambaforge
|
|
27
|
+
use-mamba: true
|
|
28
|
+
|
|
29
|
+
- name: configure conda and install code
|
|
30
|
+
# Test against current main branch of all diff+ dependencies
|
|
31
|
+
shell: bash -l {0}
|
|
32
|
+
run: |
|
|
33
|
+
conda config --set always_yes yes
|
|
34
|
+
mamba install --quiet \
|
|
35
|
+
--file=requirements.txt
|
|
36
|
+
mamba install -y -q \
|
|
37
|
+
flake8 \
|
|
38
|
+
pytest \
|
|
39
|
+
pytest-xdist \
|
|
40
|
+
pytest-cov \
|
|
41
|
+
pip \
|
|
42
|
+
setuptools \
|
|
43
|
+
"setuptools_scm>=7,<8" \
|
|
44
|
+
matplotlib \
|
|
45
|
+
python-build
|
|
46
|
+
pip uninstall diffmah --yes
|
|
47
|
+
pip uninstall diffstar --yes
|
|
48
|
+
pip uninstall dsps --yes
|
|
49
|
+
pip install --no-deps git+https://github.com/ArgonneCPAC/diffmah.git
|
|
50
|
+
pip install --no-deps git+https://github.com/ArgonneCPAC/diffstar.git
|
|
51
|
+
pip install --no-deps git+https://github.com/ArgonneCPAC/dsps.git
|
|
52
|
+
python -m pip install --no-build-isolation --no-deps -e .
|
|
53
|
+
|
|
54
|
+
- name: test that no warnings are raised
|
|
55
|
+
shell: bash -l {0}
|
|
56
|
+
run: |
|
|
57
|
+
export PYTHONWARNINGS=error
|
|
58
|
+
pytest -v diffsky --cov --cov-report=xml
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: test-latest-diffstuff-releases
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
@@ -18,7 +18,7 @@ jobs:
|
|
|
18
18
|
|
|
19
19
|
- uses: conda-incubator/setup-miniconda@v2
|
|
20
20
|
with:
|
|
21
|
-
python-version: 3.
|
|
21
|
+
python-version: 3.11
|
|
22
22
|
channels: conda-forge,defaults
|
|
23
23
|
channel-priority: strict
|
|
24
24
|
show-channel-urls: true
|
|
@@ -27,6 +27,7 @@ jobs:
|
|
|
27
27
|
use-mamba: true
|
|
28
28
|
|
|
29
29
|
- name: configure conda and install code
|
|
30
|
+
# Test against conda-forge for all dependencies except use main branch for dsps
|
|
30
31
|
shell: bash -l {0}
|
|
31
32
|
run: |
|
|
32
33
|
conda config --set always_yes yes
|
|
@@ -40,7 +41,10 @@ jobs:
|
|
|
40
41
|
pip \
|
|
41
42
|
setuptools \
|
|
42
43
|
"setuptools_scm>=7,<8" \
|
|
44
|
+
matplotlib \
|
|
43
45
|
python-build
|
|
46
|
+
pip uninstall dsps --yes
|
|
47
|
+
pip install --no-deps git+https://github.com/ArgonneCPAC/dsps.git
|
|
44
48
|
python -m pip install --no-build-isolation --no-deps -e .
|
|
45
49
|
|
|
46
50
|
- name: test
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
name: test-main-branch-diffstuff
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch: null
|
|
5
|
+
schedule:
|
|
6
|
+
# Runs "every Monday & Thursday at 3:05am Central"
|
|
7
|
+
- cron: '5 8 * * 1,4'
|
|
8
|
+
push:
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
pull_request: null
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
tests:
|
|
15
|
+
name: tests
|
|
16
|
+
runs-on: "ubuntu-latest"
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v2
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
|
|
23
|
+
- uses: conda-incubator/setup-miniconda@v2
|
|
24
|
+
with:
|
|
25
|
+
python-version: 3.11
|
|
26
|
+
channels: conda-forge,defaults
|
|
27
|
+
channel-priority: strict
|
|
28
|
+
show-channel-urls: true
|
|
29
|
+
miniforge-version: latest
|
|
30
|
+
miniforge-variant: Mambaforge
|
|
31
|
+
use-mamba: true
|
|
32
|
+
|
|
33
|
+
- name: configure conda and install code
|
|
34
|
+
# Test against current main branch of all diff+ dependencies
|
|
35
|
+
shell: bash -l {0}
|
|
36
|
+
run: |
|
|
37
|
+
conda config --set always_yes yes
|
|
38
|
+
mamba install --quiet \
|
|
39
|
+
--file=requirements.txt
|
|
40
|
+
mamba install -y -q \
|
|
41
|
+
flake8 \
|
|
42
|
+
pytest \
|
|
43
|
+
pytest-xdist \
|
|
44
|
+
pytest-cov \
|
|
45
|
+
pip \
|
|
46
|
+
setuptools \
|
|
47
|
+
"setuptools_scm>=7,<8" \
|
|
48
|
+
matplotlib \
|
|
49
|
+
python-build
|
|
50
|
+
pip uninstall diffmah --yes
|
|
51
|
+
pip uninstall diffstar --yes
|
|
52
|
+
pip uninstall dsps --yes
|
|
53
|
+
pip install --no-deps git+https://github.com/ArgonneCPAC/diffmah.git
|
|
54
|
+
pip install --no-deps git+https://github.com/ArgonneCPAC/diffstar.git
|
|
55
|
+
pip install --no-deps git+https://github.com/ArgonneCPAC/dsps.git
|
|
56
|
+
python -m pip install --no-build-isolation --no-deps -e .
|
|
57
|
+
|
|
58
|
+
- name: test
|
|
59
|
+
shell: bash -l {0}
|
|
60
|
+
run: |
|
|
61
|
+
pytest -v diffsky --cov --cov-report=xml
|
|
62
|
+
|
|
63
|
+
- name: Upload coverage reports to Codecov
|
|
64
|
+
uses: codecov/codecov-action@v3
|
|
65
|
+
|
|
66
|
+
- name: test versions
|
|
67
|
+
shell: bash -el {0}
|
|
68
|
+
run: |
|
|
69
|
+
pip uninstall diffsky --yes
|
|
70
|
+
[[ $(python setup.py --version) != "0.0.0" ]] || exit 1
|
|
71
|
+
|
|
72
|
+
rm -rf dist/*
|
|
73
|
+
python setup.py sdist
|
|
74
|
+
pip install --no-deps --no-build-isolation dist/*.tar.gz
|
|
75
|
+
pushd ..
|
|
76
|
+
python -c "import diffsky; assert diffsky.__version__ != '0.0.0'"
|
|
77
|
+
popd
|
|
78
|
+
pip uninstall diffsky --yes
|
|
79
|
+
|
|
80
|
+
rm -rf dist/*
|
|
81
|
+
python -m build --sdist . --outdir dist
|
|
82
|
+
pip install --no-deps --no-build-isolation dist/*.tar.gz
|
|
83
|
+
pushd ..
|
|
84
|
+
python -c "import diffsky; assert diffsky.__version__ != '0.0.0'"
|
|
85
|
+
popd
|
|
86
|
+
pip uninstall diffsky --yes
|
|
87
|
+
|
|
88
|
+
python -m pip install -v --no-deps --no-build-isolation -e .
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: diffsky
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Library for differentiable generation of synthetic skies
|
|
5
5
|
Author-email: Andrew Hearin <ahearin@anl.gov>
|
|
6
6
|
License: BSD 3-Clause License
|
|
@@ -35,15 +35,15 @@ License: BSD 3-Clause License
|
|
|
35
35
|
|
|
36
36
|
Project-URL: home, https://github.com/ArgonneCPAC/diffsky
|
|
37
37
|
Classifier: Programming Language :: Python :: 3
|
|
38
|
-
Requires-Python: >=3.
|
|
38
|
+
Requires-Python: >=3.11
|
|
39
39
|
Description-Content-Type: text/x-rst
|
|
40
40
|
License-File: LICENSE.rst
|
|
41
41
|
Requires-Dist: numpy
|
|
42
42
|
Requires-Dist: jax
|
|
43
|
-
Requires-Dist:
|
|
44
|
-
Requires-Dist:
|
|
45
|
-
Requires-Dist: diffstar
|
|
43
|
+
Requires-Dist: diffmah>=0.6.1
|
|
44
|
+
Requires-Dist: diffstar>=0.3.2
|
|
46
45
|
Requires-Dist: dsps
|
|
46
|
+
Requires-Dist: h5py
|
|
47
47
|
|
|
48
48
|
diffsky
|
|
49
49
|
============
|
|
@@ -69,7 +69,7 @@ Conda environment
|
|
|
69
69
|
~~~~~~~~~~~~~~~~~
|
|
70
70
|
For a typical development environment in conda-forge::
|
|
71
71
|
|
|
72
|
-
$ conda create -c conda-forge -n diffsky_env python=3.
|
|
72
|
+
$ conda create -c conda-forge -n diffsky_env python=3.11 numpy jax pytest ipython jupyter matplotlib scipy h5py diffmah diffstar dsps diffsky
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
Documentation
|
|
@@ -22,7 +22,7 @@ Conda environment
|
|
|
22
22
|
~~~~~~~~~~~~~~~~~
|
|
23
23
|
For a typical development environment in conda-forge::
|
|
24
24
|
|
|
25
|
-
$ conda create -c conda-forge -n diffsky_env python=3.
|
|
25
|
+
$ conda create -c conda-forge -n diffsky_env python=3.11 numpy jax pytest ipython jupyter matplotlib scipy h5py diffmah diffstar dsps diffsky
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
Documentation
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.1.2'
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""
|
|
2
|
+
"""
|
|
3
|
+
|
|
4
|
+
import numpy as np
|
|
5
|
+
from matplotlib import pyplot as plt
|
|
6
|
+
|
|
7
|
+
from ..fburstpop import DEFAULT_FBURSTPOP_PARAMS, get_lgfburst_from_fburstpop_params
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def make_fburstpop_comparison_plot(
|
|
11
|
+
params,
|
|
12
|
+
params2=DEFAULT_FBURSTPOP_PARAMS,
|
|
13
|
+
fname=None,
|
|
14
|
+
label1=r"${\rm new\ model}$",
|
|
15
|
+
label2=r"${\rm default\ model}$",
|
|
16
|
+
):
|
|
17
|
+
"""Make basic diagnostic plot of the model for Fburst
|
|
18
|
+
|
|
19
|
+
Parameters
|
|
20
|
+
----------
|
|
21
|
+
params : namedtuple
|
|
22
|
+
Instance of fburstpop.FburstPopParams
|
|
23
|
+
|
|
24
|
+
params2 : namedtuple, optional
|
|
25
|
+
Instance of fburstpop.FburstPopParams
|
|
26
|
+
Default is set by DEFAULT_FBURSTPOP_PARAMS
|
|
27
|
+
|
|
28
|
+
fname : string, optional
|
|
29
|
+
filename of the output figure
|
|
30
|
+
|
|
31
|
+
"""
|
|
32
|
+
nsm, nsfr = 250, 250
|
|
33
|
+
logsm_grid = np.linspace(7, 12, nsm)
|
|
34
|
+
logssfr_grid = np.linspace(-13, -8, nsfr)
|
|
35
|
+
|
|
36
|
+
X, Y = np.meshgrid(logsm_grid, logssfr_grid)
|
|
37
|
+
|
|
38
|
+
Z = get_lgfburst_from_fburstpop_params(params, X, Y)
|
|
39
|
+
Z2 = get_lgfburst_from_fburstpop_params(params2, X, Y)
|
|
40
|
+
|
|
41
|
+
fig, axes = plt.subplots(1, 2, figsize=(10, 4))
|
|
42
|
+
(ax0, ax1) = axes
|
|
43
|
+
|
|
44
|
+
pcm0 = ax0.pcolor(X, Y, Z, cmap="coolwarm_r", vmin=-4.5, vmax=-2.1)
|
|
45
|
+
fig.colorbar(pcm0, ax=ax0)
|
|
46
|
+
|
|
47
|
+
pcm1 = ax1.pcolor(X, Y, Z2, cmap="coolwarm_r", vmin=-4.5, vmax=-2.1)
|
|
48
|
+
fig.colorbar(pcm1, ax=ax1, label=r"${\rm lgFburst}$")
|
|
49
|
+
for ax in axes:
|
|
50
|
+
xlabel = ax.set_xlabel(r"$\log_{10}M_{\star}/M_{\odot}$")
|
|
51
|
+
ylabel = ax0.set_ylabel(r"${\rm \log_{10}sSFR}$")
|
|
52
|
+
|
|
53
|
+
ax0.set_title(label1)
|
|
54
|
+
ax1.set_title(label2)
|
|
55
|
+
|
|
56
|
+
if fname is not None:
|
|
57
|
+
fig.savefig(
|
|
58
|
+
fname, bbox_extra_artists=[xlabel, ylabel], bbox_inches="tight", dpi=200
|
|
59
|
+
)
|
|
60
|
+
return fig
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
"""
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
from ..plot_fburstpop import DEFAULT_FBURSTPOP_PARAMS, make_fburstpop_comparison_plot
|
|
7
|
+
|
|
8
|
+
_THIS_DRNAME = os.path.dirname(os.path.abspath(__file__))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_make_freqburst_comparison_plot():
|
|
12
|
+
fn = os.path.join(_THIS_DRNAME, "dummy.png")
|
|
13
|
+
make_fburstpop_comparison_plot(DEFAULT_FBURSTPOP_PARAMS, fname=fn)
|
|
14
|
+
assert os.path.isfile(fn)
|
|
15
|
+
os.remove(fn)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""
|
|
2
|
+
"""
|
|
3
|
+
from collections import namedtuple
|
|
4
|
+
|
|
5
|
+
from dsps.sfh.diffburst import BurstParams, calc_bursty_age_weights
|
|
6
|
+
from jax import jit as jjit
|
|
7
|
+
|
|
8
|
+
from .fburstpop import (
|
|
9
|
+
DEFAULT_FBURSTPOP_PARAMS,
|
|
10
|
+
get_bounded_fburstpop_params,
|
|
11
|
+
get_lgfburst_from_fburstpop_params,
|
|
12
|
+
get_unbounded_fburstpop_params,
|
|
13
|
+
)
|
|
14
|
+
from .tburstpop import (
|
|
15
|
+
DEFAULT_TBURSTPOP_PARAMS,
|
|
16
|
+
get_bounded_tburstpop_params,
|
|
17
|
+
get_tburst_params_from_tburstpop_params,
|
|
18
|
+
get_unbounded_tburstpop_params,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
DiffburstPopParams = namedtuple(
|
|
22
|
+
"DiffburstPopParams", ["fburstpop_params", "tburstpop_params"]
|
|
23
|
+
)
|
|
24
|
+
DEFAULT_DIFFBURSTPOP_PARAMS = DiffburstPopParams(
|
|
25
|
+
DEFAULT_FBURSTPOP_PARAMS, DEFAULT_TBURSTPOP_PARAMS
|
|
26
|
+
)
|
|
27
|
+
_BURSTPOP_UPNAMES = [
|
|
28
|
+
key.replace("params", "u_params") for key in DEFAULT_DIFFBURSTPOP_PARAMS._fields
|
|
29
|
+
]
|
|
30
|
+
DiffburstPopUParams = namedtuple("DiffburstPopUParams", _BURSTPOP_UPNAMES)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@jjit
|
|
34
|
+
def get_bounded_diffburstpop_params(u_params):
|
|
35
|
+
u_fburstpop_params, u_tburstpop_params = u_params
|
|
36
|
+
bounded_tburstpop_params = get_bounded_tburstpop_params(u_tburstpop_params)
|
|
37
|
+
bounded_fburstpop_params = get_bounded_fburstpop_params(u_fburstpop_params)
|
|
38
|
+
diffburstpop_params = DiffburstPopParams(
|
|
39
|
+
bounded_fburstpop_params, bounded_tburstpop_params
|
|
40
|
+
)
|
|
41
|
+
return diffburstpop_params
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@jjit
|
|
45
|
+
def get_unbounded_diffburstpop_params(params):
|
|
46
|
+
fburstpop_params, tburstpop_params = params
|
|
47
|
+
unbounded_fburstpop_params = get_unbounded_fburstpop_params(fburstpop_params)
|
|
48
|
+
unbounded_tburstpop_params = get_unbounded_tburstpop_params(tburstpop_params)
|
|
49
|
+
diffburstpop_u_params = DiffburstPopUParams(
|
|
50
|
+
unbounded_fburstpop_params, unbounded_tburstpop_params
|
|
51
|
+
)
|
|
52
|
+
return diffburstpop_u_params
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@jjit
|
|
56
|
+
def calc_bursty_age_weights_from_diffburstpop_params(
|
|
57
|
+
diffburstpop_params, logsm, logssfr, ssp_lg_age_gyr, smooth_age_weights
|
|
58
|
+
):
|
|
59
|
+
lgfburst = get_lgfburst_from_fburstpop_params(
|
|
60
|
+
diffburstpop_params.fburstpop_params, logsm, logssfr
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
tburst_params = get_tburst_params_from_tburstpop_params(
|
|
64
|
+
diffburstpop_params.tburstpop_params, logsm, logssfr
|
|
65
|
+
)
|
|
66
|
+
lgyr_peak, lgyr_max = tburst_params
|
|
67
|
+
burst_params = BurstParams(lgfburst, lgyr_peak, lgyr_max)
|
|
68
|
+
|
|
69
|
+
age_weights = calc_bursty_age_weights(
|
|
70
|
+
burst_params, smooth_age_weights, ssp_lg_age_gyr
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
return age_weights, burst_params
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def calc_bursty_age_weights_from_diffburstpop_u_params(
|
|
77
|
+
diffburstpop_u_params, logsm, logssfr, ssp_lg_age_gyr, smooth_age_weights
|
|
78
|
+
):
|
|
79
|
+
diffburstpop_params = get_bounded_diffburstpop_params(diffburstpop_u_params)
|
|
80
|
+
args = diffburstpop_params, logsm, logssfr, ssp_lg_age_gyr, smooth_age_weights
|
|
81
|
+
age_weights, burst_params = calc_bursty_age_weights_from_diffburstpop_params(*args)
|
|
82
|
+
return age_weights, burst_params
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
DEFAULT_DIFFBURSTPOP_U_PARAMS = DiffburstPopUParams(
|
|
86
|
+
*get_unbounded_diffburstpop_params(DEFAULT_DIFFBURSTPOP_PARAMS)
|
|
87
|
+
)
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"""
|
|
2
|
+
"""
|
|
3
|
+
|
|
4
|
+
from collections import namedtuple
|
|
5
|
+
|
|
6
|
+
from dsps.sfh.diffburst import BurstParams, calc_bursty_age_weights
|
|
7
|
+
from jax import jit as jjit
|
|
8
|
+
|
|
9
|
+
from .fburstpop import (
|
|
10
|
+
DEFAULT_FBURSTPOP_PARAMS,
|
|
11
|
+
get_bounded_fburstpop_params,
|
|
12
|
+
get_lgfburst_from_fburstpop_params,
|
|
13
|
+
get_unbounded_fburstpop_params,
|
|
14
|
+
)
|
|
15
|
+
from .freqburst import (
|
|
16
|
+
DEFAULT_FREQBURST_PARAMS,
|
|
17
|
+
get_bounded_freqburst_params,
|
|
18
|
+
get_unbounded_freqburst_params,
|
|
19
|
+
)
|
|
20
|
+
from .tburstpop import (
|
|
21
|
+
DEFAULT_TBURSTPOP_PARAMS,
|
|
22
|
+
get_bounded_tburstpop_params,
|
|
23
|
+
get_tburst_params_from_tburstpop_params,
|
|
24
|
+
get_unbounded_tburstpop_params,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
DiffburstPopParams = namedtuple(
|
|
28
|
+
"DiffburstPopParams", ["freqburst_params", "fburstpop_params", "tburstpop_params"]
|
|
29
|
+
)
|
|
30
|
+
DEFAULT_DIFFBURSTPOP_PARAMS = DiffburstPopParams(
|
|
31
|
+
DEFAULT_FREQBURST_PARAMS, DEFAULT_FBURSTPOP_PARAMS, DEFAULT_TBURSTPOP_PARAMS
|
|
32
|
+
)
|
|
33
|
+
_BURSTPOP_UPNAMES = [
|
|
34
|
+
key.replace("params", "u_params") for key in DEFAULT_DIFFBURSTPOP_PARAMS._fields
|
|
35
|
+
]
|
|
36
|
+
DiffburstPopUParams = namedtuple("DiffburstPopUParams", _BURSTPOP_UPNAMES)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@jjit
|
|
40
|
+
def get_bounded_diffburstpop_params(u_params):
|
|
41
|
+
u_freqburst_params, u_fburstpop_params, u_tburstpop_params = u_params
|
|
42
|
+
bounded_freqburst_params = get_bounded_freqburst_params(u_freqburst_params)
|
|
43
|
+
bounded_tburstpop_params = get_bounded_tburstpop_params(u_tburstpop_params)
|
|
44
|
+
bounded_fburstpop_params = get_bounded_fburstpop_params(u_fburstpop_params)
|
|
45
|
+
diffburstpop_params = DiffburstPopParams(
|
|
46
|
+
bounded_freqburst_params, bounded_fburstpop_params, bounded_tburstpop_params
|
|
47
|
+
)
|
|
48
|
+
return diffburstpop_params
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@jjit
|
|
52
|
+
def get_unbounded_diffburstpop_params(params):
|
|
53
|
+
freqburst_params, fburstpop_params, tburstpop_params = params
|
|
54
|
+
unbounded_freqburst_params = get_unbounded_freqburst_params(freqburst_params)
|
|
55
|
+
unbounded_fburstpop_params = get_unbounded_fburstpop_params(fburstpop_params)
|
|
56
|
+
unbounded_tburstpop_params = get_unbounded_tburstpop_params(tburstpop_params)
|
|
57
|
+
diffburstpop_u_params = DiffburstPopUParams(
|
|
58
|
+
unbounded_freqburst_params,
|
|
59
|
+
unbounded_fburstpop_params,
|
|
60
|
+
unbounded_tburstpop_params,
|
|
61
|
+
)
|
|
62
|
+
return diffburstpop_u_params
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@jjit
|
|
66
|
+
def calc_bursty_age_weights_from_diffburstpop_params(
|
|
67
|
+
diffburstpop_params, logsm, logssfr, ssp_lg_age_gyr, smooth_age_weights
|
|
68
|
+
):
|
|
69
|
+
lgfburst = get_lgfburst_from_fburstpop_params(
|
|
70
|
+
diffburstpop_params.fburstpop_params, logsm, logssfr
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
tburst_params = get_tburst_params_from_tburstpop_params(
|
|
74
|
+
diffburstpop_params.tburstpop_params, logsm, logssfr
|
|
75
|
+
)
|
|
76
|
+
lgyr_peak, lgyr_max = tburst_params
|
|
77
|
+
burst_params = BurstParams(lgfburst, lgyr_peak, lgyr_max)
|
|
78
|
+
|
|
79
|
+
age_weights = calc_bursty_age_weights(
|
|
80
|
+
burst_params, smooth_age_weights, ssp_lg_age_gyr
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
return age_weights, burst_params
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def calc_bursty_age_weights_from_diffburstpop_u_params(
|
|
87
|
+
diffburstpop_u_params, logsm, logssfr, ssp_lg_age_gyr, smooth_age_weights
|
|
88
|
+
):
|
|
89
|
+
diffburstpop_params = get_bounded_diffburstpop_params(diffburstpop_u_params)
|
|
90
|
+
args = diffburstpop_params, logsm, logssfr, ssp_lg_age_gyr, smooth_age_weights
|
|
91
|
+
age_weights, burst_params = calc_bursty_age_weights_from_diffburstpop_params(*args)
|
|
92
|
+
return age_weights, burst_params
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
DEFAULT_DIFFBURSTPOP_U_PARAMS = DiffburstPopUParams(
|
|
96
|
+
*get_unbounded_diffburstpop_params(DEFAULT_DIFFBURSTPOP_PARAMS)
|
|
97
|
+
)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"""
|
|
2
|
+
"""
|
|
3
|
+
|
|
4
|
+
from collections import OrderedDict, namedtuple
|
|
5
|
+
|
|
6
|
+
from jax import jit as jjit
|
|
7
|
+
from jax import numpy as jnp
|
|
8
|
+
from jax import vmap
|
|
9
|
+
|
|
10
|
+
from ..utils import _inverse_sigmoid, _sigmoid
|
|
11
|
+
|
|
12
|
+
LGSM_K = 5.0
|
|
13
|
+
LGSSFR_K = 5.0
|
|
14
|
+
|
|
15
|
+
DEFAULT_FBURSTPOP_PDICT = OrderedDict(
|
|
16
|
+
lgfburst_logsm_x0_x0=10.0,
|
|
17
|
+
lgfburst_logsm_x0_q=10.5,
|
|
18
|
+
lgfburst_logsm_x0_ms=9.5,
|
|
19
|
+
lgfburst_logsm_ylo_x0=-10.25,
|
|
20
|
+
lgfburst_logsm_ylo_q=-4.5,
|
|
21
|
+
lgfburst_logsm_ylo_ms=-4.5,
|
|
22
|
+
lgfburst_logsm_yhi_x0=-11.25,
|
|
23
|
+
lgfburst_logsm_yhi_q=-4.5,
|
|
24
|
+
lgfburst_logsm_yhi_ms=-4.5,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
_LGSM_X0_BOUNDS = (8.0, 12.0)
|
|
28
|
+
_LGSSFR_X0_BOUNDS = (-13.0, -7.0)
|
|
29
|
+
_LGFBURST_BOUNDS = (-6.0, -2.0)
|
|
30
|
+
FBURSTPOP_BOUNDS_PDICT = OrderedDict(
|
|
31
|
+
lgfburst_logsm_x0_x0=_LGSM_X0_BOUNDS,
|
|
32
|
+
lgfburst_logsm_x0_q=_LGSM_X0_BOUNDS,
|
|
33
|
+
lgfburst_logsm_x0_ms=_LGSM_X0_BOUNDS,
|
|
34
|
+
lgfburst_logsm_ylo_x0=_LGSSFR_X0_BOUNDS,
|
|
35
|
+
lgfburst_logsm_ylo_q=_LGFBURST_BOUNDS,
|
|
36
|
+
lgfburst_logsm_ylo_ms=_LGFBURST_BOUNDS,
|
|
37
|
+
lgfburst_logsm_yhi_x0=_LGSSFR_X0_BOUNDS,
|
|
38
|
+
lgfburst_logsm_yhi_q=_LGFBURST_BOUNDS,
|
|
39
|
+
lgfburst_logsm_yhi_ms=_LGFBURST_BOUNDS,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
FburstPopParams = namedtuple("FburstPopParams", DEFAULT_FBURSTPOP_PDICT.keys())
|
|
43
|
+
_FBURSTPOP_UPNAMES = ["u_" + key for key in DEFAULT_FBURSTPOP_PDICT.keys()]
|
|
44
|
+
FburstPopUParams = namedtuple("FburstPopUParams", _FBURSTPOP_UPNAMES)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
DEFAULT_FBURSTPOP_PARAMS = FburstPopParams(**DEFAULT_FBURSTPOP_PDICT)
|
|
48
|
+
FBURSTPOP_PBOUNDS = FburstPopParams(**FBURSTPOP_BOUNDS_PDICT)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@jjit
|
|
52
|
+
def get_lgfburst_from_fburstpop_u_params(fburstpop_u_params, logsm, logssfr):
|
|
53
|
+
fburstpop_params = get_bounded_fburstpop_params(fburstpop_u_params)
|
|
54
|
+
lgfburst = get_lgfburst_from_fburstpop_params(fburstpop_params, logsm, logssfr)
|
|
55
|
+
return lgfburst
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@jjit
|
|
59
|
+
def get_lgfburst_from_fburstpop_params(fburstpop_params, logsm, logssfr):
|
|
60
|
+
lgfburst_logssfr_x0 = _sigmoid(
|
|
61
|
+
logsm,
|
|
62
|
+
fburstpop_params.lgfburst_logsm_x0_x0,
|
|
63
|
+
LGSM_K,
|
|
64
|
+
fburstpop_params.lgfburst_logsm_ylo_x0,
|
|
65
|
+
fburstpop_params.lgfburst_logsm_yhi_x0,
|
|
66
|
+
)
|
|
67
|
+
lgfburst_logssfr_q = _sigmoid(
|
|
68
|
+
logsm,
|
|
69
|
+
fburstpop_params.lgfburst_logsm_x0_q,
|
|
70
|
+
LGSM_K,
|
|
71
|
+
fburstpop_params.lgfburst_logsm_ylo_q,
|
|
72
|
+
fburstpop_params.lgfburst_logsm_yhi_q,
|
|
73
|
+
)
|
|
74
|
+
lgfburst_logssfr_ms = _sigmoid(
|
|
75
|
+
logsm,
|
|
76
|
+
fburstpop_params.lgfburst_logsm_x0_ms,
|
|
77
|
+
LGSSFR_K,
|
|
78
|
+
fburstpop_params.lgfburst_logsm_ylo_ms,
|
|
79
|
+
fburstpop_params.lgfburst_logsm_yhi_ms,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
lgfburst = _sigmoid(
|
|
83
|
+
logssfr,
|
|
84
|
+
lgfburst_logssfr_x0,
|
|
85
|
+
LGSSFR_K,
|
|
86
|
+
lgfburst_logssfr_q,
|
|
87
|
+
lgfburst_logssfr_ms,
|
|
88
|
+
)
|
|
89
|
+
return lgfburst
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@jjit
|
|
93
|
+
def _get_bounded_fburstpop_param(u_param, bound):
|
|
94
|
+
lo, hi = bound
|
|
95
|
+
mid = 0.5 * (lo + hi)
|
|
96
|
+
return _sigmoid(u_param, mid, 0.1, lo, hi)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@jjit
|
|
100
|
+
def _get_unbounded_fburstpop_param(param, bound):
|
|
101
|
+
lo, hi = bound
|
|
102
|
+
mid = 0.5 * (lo + hi)
|
|
103
|
+
return _inverse_sigmoid(param, mid, 0.1, lo, hi)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
_C = (0, 0)
|
|
107
|
+
_get_bounded_fburstpop_params_kern = jjit(
|
|
108
|
+
vmap(_get_bounded_fburstpop_param, in_axes=_C)
|
|
109
|
+
)
|
|
110
|
+
_get_unbounded_fburstpop_params_kern = jjit(
|
|
111
|
+
vmap(_get_unbounded_fburstpop_param, in_axes=_C)
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@jjit
|
|
116
|
+
def get_bounded_fburstpop_params(u_params):
|
|
117
|
+
u_params = jnp.array([getattr(u_params, u_pname) for u_pname in _FBURSTPOP_UPNAMES])
|
|
118
|
+
params = _get_bounded_fburstpop_params_kern(
|
|
119
|
+
jnp.array(u_params), jnp.array(FBURSTPOP_PBOUNDS)
|
|
120
|
+
)
|
|
121
|
+
fburstpop_params = FburstPopParams(*params)
|
|
122
|
+
return fburstpop_params
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@jjit
|
|
126
|
+
def get_unbounded_fburstpop_params(params):
|
|
127
|
+
params = jnp.array(
|
|
128
|
+
[getattr(params, pname) for pname in DEFAULT_FBURSTPOP_PARAMS._fields]
|
|
129
|
+
)
|
|
130
|
+
u_params = _get_unbounded_fburstpop_params_kern(
|
|
131
|
+
jnp.array(params), jnp.array(FBURSTPOP_PBOUNDS)
|
|
132
|
+
)
|
|
133
|
+
fburstpop_u_params = FburstPopUParams(*u_params)
|
|
134
|
+
return fburstpop_u_params
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
DEFAULT_FBURSTPOP_U_PARAMS = FburstPopUParams(
|
|
138
|
+
*get_unbounded_fburstpop_params(DEFAULT_FBURSTPOP_PARAMS)
|
|
139
|
+
)
|