diffsky 0.1.0__tar.gz → 0.1.1__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.
Files changed (58) hide show
  1. {diffsky-0.1.0 → diffsky-0.1.1}/CHANGES.rst +5 -0
  2. {diffsky-0.1.0 → diffsky-0.1.1}/PKG-INFO +6 -6
  3. {diffsky-0.1.0 → diffsky-0.1.1}/README.rst +5 -5
  4. diffsky-0.1.1/diffsky/_version.py +1 -0
  5. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/boris_dust.py +28 -5
  6. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/photpop.py +5 -5
  7. diffsky-0.1.1/diffsky/experimental/dspspop/tests/test_boris_dust.py +36 -0
  8. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky.egg-info/PKG-INFO +6 -6
  9. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky.egg-info/SOURCES.txt +1 -0
  10. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky.egg-info/top_level.txt +0 -1
  11. diffsky-0.1.1/docs/source/installation.rst +31 -0
  12. diffsky-0.1.0/diffsky/_version.py +0 -1
  13. diffsky-0.1.0/docs/source/installation.rst +0 -48
  14. {diffsky-0.1.0 → diffsky-0.1.1}/.coveragerc +0 -0
  15. {diffsky-0.1.0 → diffsky-0.1.1}/.git_archival.txt +0 -0
  16. {diffsky-0.1.0 → diffsky-0.1.1}/.gitattributes +0 -0
  17. {diffsky-0.1.0 → diffsky-0.1.1}/.github/workflows/linting.yml +0 -0
  18. {diffsky-0.1.0 → diffsky-0.1.1}/.github/workflows/tests.yml +0 -0
  19. {diffsky-0.1.0 → diffsky-0.1.1}/.gitignore +0 -0
  20. {diffsky-0.1.0 → diffsky-0.1.1}/.readthedocs.yml +0 -0
  21. {diffsky-0.1.0 → diffsky-0.1.1}/LICENSE.rst +0 -0
  22. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/__init__.py +0 -0
  23. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/diffndhist.py +0 -0
  24. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/__init__.py +0 -0
  25. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/__init__.py +0 -0
  26. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/burstshapepop.py +0 -0
  27. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/dust_deltapop.py +0 -0
  28. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/dustpop.py +0 -0
  29. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/lgavpop.py +0 -0
  30. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/lgfburstpop.py +0 -0
  31. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/nagaraj22_dust.py +0 -0
  32. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/tests/__init__.py +0 -0
  33. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/tests/test_attavpop.py +0 -0
  34. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/tests/test_burstshapepop.py +0 -0
  35. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/tests/test_dustdeltapop.py +0 -0
  36. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/tests/test_lgfburstpop.py +0 -0
  37. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/dspspop/tests/test_photpop.py +0 -0
  38. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/photometry_interpolation.py +0 -0
  39. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/tests/__init__.py +0 -0
  40. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/experimental/tests/test_photometry_interpolation.py +0 -0
  41. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/tests/__init__.py +0 -0
  42. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/tests/test_diffndhist.py +0 -0
  43. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/tests/test_diffsky_setup.py +0 -0
  44. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/tests/test_utils.py +0 -0
  45. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/tests/testing_data/__init__.py +0 -0
  46. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky/utils.py +0 -0
  47. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky.egg-info/dependency_links.txt +0 -0
  48. {diffsky-0.1.0 → diffsky-0.1.1}/diffsky.egg-info/requires.txt +0 -0
  49. {diffsky-0.1.0 → diffsky-0.1.1}/docs/Makefile +0 -0
  50. {diffsky-0.1.0 → diffsky-0.1.1}/docs/make.bat +0 -0
  51. {diffsky-0.1.0 → diffsky-0.1.1}/docs/source/citation.rst +0 -0
  52. {diffsky-0.1.0 → diffsky-0.1.1}/docs/source/conf.py +0 -0
  53. {diffsky-0.1.0 → diffsky-0.1.1}/docs/source/index.rst +0 -0
  54. {diffsky-0.1.0 → diffsky-0.1.1}/docs/source/rtd_environment.yaml +0 -0
  55. {diffsky-0.1.0 → diffsky-0.1.1}/pyproject.toml +0 -0
  56. {diffsky-0.1.0 → diffsky-0.1.1}/requirements.txt +0 -0
  57. {diffsky-0.1.0 → diffsky-0.1.1}/setup.cfg +0 -0
  58. {diffsky-0.1.0 → diffsky-0.1.1}/setup.py +0 -0
@@ -1,3 +1,8 @@
1
+ 0.1.1 (2023-10-04)
2
+ -------------------
3
+ - Update calls to dsps v0.3.4
4
+
5
+
1
6
  0.1.0 (2023-10-03)
2
7
  -------------------
3
8
  - First release. Compatible with diffstar v0.2.1 and dsps v0.3.3.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diffsky
3
- Version: 0.1.0
3
+ Version: 0.1.1
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
@@ -48,15 +48,15 @@ Requires-Dist: dsps
48
48
  diffsky
49
49
  ============
50
50
 
51
- Code for producing mock catalogs based on
51
+ Diffsky is a python library based on JAX for producing mock catalogs based on
52
52
  `diffstar <https://diffstar.readthedocs.io/en/latest/>`_
53
53
  and `dsps <https://dsps.readthedocs.io/en/latest/>`_.
54
54
 
55
55
  Installation
56
56
  ------------
57
- The latest release of diffsky is available for installation with pip or conda::
57
+ The latest release of diffsky is available for installation with pip or conda-forge::
58
58
 
59
- $ conda install diffsky
59
+ $ conda install -c conda-forge diffsky
60
60
 
61
61
 
62
62
  To install diffsky into your environment from the source code::
@@ -67,9 +67,9 @@ To install diffsky into your environment from the source code::
67
67
 
68
68
  Conda environment
69
69
  ~~~~~~~~~~~~~~~~~
70
- For a typical development environment in conda::
70
+ For a typical development environment in conda-forge::
71
71
 
72
- $ conda create -n diffsky_env python=3.9 numpy jax pytest ipython jupyter matplotlib scipy h5py diffmah diffstar dsps diffsky
72
+ $ conda create -c conda-forge -n diffsky_env python=3.9 numpy jax pytest ipython jupyter matplotlib scipy h5py diffmah diffstar dsps diffsky
73
73
 
74
74
 
75
75
  Documentation
@@ -1,15 +1,15 @@
1
1
  diffsky
2
2
  ============
3
3
 
4
- Code for producing mock catalogs based on
4
+ Diffsky is a python library based on JAX for producing mock catalogs based on
5
5
  `diffstar <https://diffstar.readthedocs.io/en/latest/>`_
6
6
  and `dsps <https://dsps.readthedocs.io/en/latest/>`_.
7
7
 
8
8
  Installation
9
9
  ------------
10
- The latest release of diffsky is available for installation with pip or conda::
10
+ The latest release of diffsky is available for installation with pip or conda-forge::
11
11
 
12
- $ conda install diffsky
12
+ $ conda install -c conda-forge diffsky
13
13
 
14
14
 
15
15
  To install diffsky into your environment from the source code::
@@ -20,9 +20,9 @@ To install diffsky into your environment from the source code::
20
20
 
21
21
  Conda environment
22
22
  ~~~~~~~~~~~~~~~~~
23
- For a typical development environment in conda::
23
+ For a typical development environment in conda-forge::
24
24
 
25
- $ conda create -n diffsky_env python=3.9 numpy jax pytest ipython jupyter matplotlib scipy h5py diffmah diffstar dsps diffsky
25
+ $ conda create -c conda-forge -n diffsky_env python=3.9 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.1'
@@ -1,11 +1,12 @@
1
1
  """
2
2
  """
3
- from jax import jit as jjit
4
- from jax import vmap
3
+ from collections import OrderedDict
4
+
5
5
  import numpy as np
6
+ from dsps.utils import _inverse_sigmoid, _sigmoid, powerlaw_rvs
7
+ from jax import jit as jjit
6
8
  from jax import numpy as jnp
7
- from dsps.utils import _sigmoid, _inverse_sigmoid, powerlaw_rvs
8
- from collections import OrderedDict
9
+ from jax import vmap
9
10
 
10
11
  powerlaw_rvs_vmap = jjit(vmap(powerlaw_rvs, in_axes=(None, 0, 0, 0)))
11
12
 
@@ -195,11 +196,33 @@ def _age_dep_funo_from_params_kern(
195
196
  N_PARAMS = len(DEFAULT_PARAMS)
196
197
  _a = [0, 0, 0, None, *[None] * N_PARAMS]
197
198
  _b = [None, None, None, 0, *[None] * N_PARAMS]
199
+ _age_dep_funo_from_params_singlegal = jjit(
200
+ vmap(_age_dep_funo_from_params_kern, in_axes=_b)
201
+ )
198
202
  _age_dep_funo_from_params_vmap = jjit(
199
- vmap(vmap(_age_dep_funo_from_params_kern, in_axes=_b), in_axes=_a)
203
+ vmap(_age_dep_funo_from_params_singlegal, in_axes=_a)
200
204
  )
201
205
 
202
206
 
207
+ @jjit
208
+ def _get_funo_from_params_singlegal(
209
+ gal_logsm, gal_logfburst, gal_logssfr, ssp_lg_age_gyr, funo_params
210
+ ):
211
+ return _age_dep_funo_from_params_singlegal(
212
+ gal_logsm, gal_logfburst, gal_logssfr, ssp_lg_age_gyr, *funo_params
213
+ )
214
+
215
+
216
+ @jjit
217
+ def _get_funo_from_u_params_singlegal(
218
+ gal_logsm, gal_logfburst, gal_logssfr, ssp_lg_age_gyr, funo_u_params
219
+ ):
220
+ funo_params = get_params_from_u_params(funo_u_params)
221
+ return _age_dep_funo_from_params_singlegal(
222
+ gal_logsm, gal_logfburst, gal_logssfr, ssp_lg_age_gyr, *funo_params
223
+ )
224
+
225
+
203
226
  @jjit
204
227
  def _get_funo_from_params_galpop(
205
228
  gal_logsm, gal_logfburst, gal_logssfr, ssp_lg_age_gyr, funo_params
@@ -3,7 +3,7 @@
3
3
  from dsps.constants import SFR_MIN
4
4
  from dsps.cosmology.flat_wcdm import _age_at_z_kern
5
5
  from dsps.experimental.diffburst import _age_weights_from_u_params
6
- from dsps.metallicity.mzr import DEFAULT_MZR_PDICT, mzr_model
6
+ from dsps.metallicity.mzr import DEFAULT_MET_PDICT, mzr_model
7
7
  from dsps.sed import calc_ssp_weights_sfh_table_lognormal_mdf
8
8
  from dsps.sed.stellar_age_weights import _calc_logsm_table_from_sfh_table
9
9
  from jax import jit as jjit
@@ -18,7 +18,7 @@ from .lgfburstpop import _get_lgfburst_galpop_from_u_params
18
18
  _A = (None, 0)
19
19
  _age_weights_from_u_params_vmap = jjit(vmap(_age_weights_from_u_params, in_axes=_A))
20
20
 
21
- DEFAULT_MZR_PARAMS = jnp.array(list(DEFAULT_MZR_PDICT.values()))
21
+ DEFAULT_MET_PARAMS = jnp.array(list(DEFAULT_MET_PDICT.values()))
22
22
  _linterp_vmap = jjit(vmap(jnp.interp, in_axes=(None, None, 0)))
23
23
 
24
24
  _g = (None, 0, 0, None, None, None, None)
@@ -49,8 +49,7 @@ def get_obs_photometry_singlez(
49
49
  fracuno_pop_u_params,
50
50
  cosmo_params,
51
51
  z_obs,
52
- met_params=DEFAULT_MZR_PARAMS,
53
- lgmet_scatter=0.2,
52
+ met_params=DEFAULT_MET_PARAMS,
54
53
  ):
55
54
  """Compute apparent magnitudes of galaxies at a single redshift
56
55
 
@@ -143,7 +142,8 @@ def get_obs_photometry_singlez(
143
142
  gal_logsfr_t_obs = _linterp_vmap(lgt_obs, lgt_table, gal_logsfr_table)
144
143
  gal_logssfr_t_obs = gal_logsfr_t_obs - gal_logsm_t_obs
145
144
 
146
- gal_lgmet = mzr_model(gal_logsm_t_obs, t_obs, *met_params[:-1])
145
+ mzr_params, lgmet_scatter = met_params[:-1], met_params[-1]
146
+ gal_lgmet = mzr_model(gal_logsm_t_obs, t_obs, *mzr_params)
147
147
 
148
148
  _res = calc_ssp_weights_sfh_table_lognormal_mdf_vmap(
149
149
  gal_t_table,
@@ -0,0 +1,36 @@
1
+ """
2
+ """
3
+ import numpy as np
4
+
5
+ from ..boris_dust import DEFAULT_U_PARAMS as DEFAULT_BORIS_U_PARAMS
6
+ from ..boris_dust import (
7
+ _get_funo_from_params_singlegal,
8
+ _get_funo_from_u_params_singlegal,
9
+ get_params_from_u_params,
10
+ get_u_params_from_params,
11
+ )
12
+
13
+
14
+ def test_param_u_param_inversion():
15
+ p = get_params_from_u_params(DEFAULT_BORIS_U_PARAMS)
16
+ u_p = get_u_params_from_params(p)
17
+ assert np.allclose(u_p, DEFAULT_BORIS_U_PARAMS, rtol=1e-3)
18
+
19
+
20
+ def test_get_funo_from_u_params_singlegal():
21
+ logsm, logfburst, logssfr = 10.0, -2.0, -10.5
22
+
23
+ n_age = 94
24
+ ssp_lg_age_gyr = np.linspace(5.5, 10.25, n_age) - 9.0
25
+ funo = _get_funo_from_u_params_singlegal(
26
+ logsm, logfburst, logssfr, ssp_lg_age_gyr, DEFAULT_BORIS_U_PARAMS
27
+ )
28
+ assert funo.shape == (n_age,)
29
+ assert np.all(funo >= 0)
30
+ assert np.all(funo <= 1)
31
+
32
+ params = get_params_from_u_params(DEFAULT_BORIS_U_PARAMS)
33
+ funo2 = _get_funo_from_params_singlegal(
34
+ logsm, logfburst, logssfr, ssp_lg_age_gyr, params
35
+ )
36
+ assert np.allclose(funo, funo2, rtol=1e-3)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diffsky
3
- Version: 0.1.0
3
+ Version: 0.1.1
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
@@ -48,15 +48,15 @@ Requires-Dist: dsps
48
48
  diffsky
49
49
  ============
50
50
 
51
- Code for producing mock catalogs based on
51
+ Diffsky is a python library based on JAX for producing mock catalogs based on
52
52
  `diffstar <https://diffstar.readthedocs.io/en/latest/>`_
53
53
  and `dsps <https://dsps.readthedocs.io/en/latest/>`_.
54
54
 
55
55
  Installation
56
56
  ------------
57
- The latest release of diffsky is available for installation with pip or conda::
57
+ The latest release of diffsky is available for installation with pip or conda-forge::
58
58
 
59
- $ conda install diffsky
59
+ $ conda install -c conda-forge diffsky
60
60
 
61
61
 
62
62
  To install diffsky into your environment from the source code::
@@ -67,9 +67,9 @@ To install diffsky into your environment from the source code::
67
67
 
68
68
  Conda environment
69
69
  ~~~~~~~~~~~~~~~~~
70
- For a typical development environment in conda::
70
+ For a typical development environment in conda-forge::
71
71
 
72
- $ conda create -n diffsky_env python=3.9 numpy jax pytest ipython jupyter matplotlib scipy h5py diffmah diffstar dsps diffsky
72
+ $ conda create -c conda-forge -n diffsky_env python=3.9 numpy jax pytest ipython jupyter matplotlib scipy h5py diffmah diffstar dsps diffsky
73
73
 
74
74
 
75
75
  Documentation
@@ -34,6 +34,7 @@ diffsky/experimental/dspspop/nagaraj22_dust.py
34
34
  diffsky/experimental/dspspop/photpop.py
35
35
  diffsky/experimental/dspspop/tests/__init__.py
36
36
  diffsky/experimental/dspspop/tests/test_attavpop.py
37
+ diffsky/experimental/dspspop/tests/test_boris_dust.py
37
38
  diffsky/experimental/dspspop/tests/test_burstshapepop.py
38
39
  diffsky/experimental/dspspop/tests/test_dustdeltapop.py
39
40
  diffsky/experimental/dspspop/tests/test_lgfburstpop.py
@@ -1,3 +1,2 @@
1
- build
2
1
  diffsky
3
2
  dist
@@ -0,0 +1,31 @@
1
+ Installation instructions
2
+ =========================
3
+
4
+ To install lsstdesc-diffsky into an existing environment with conda-forge::
5
+
6
+ $ conda install -c conda-forge diffsky
7
+
8
+
9
+ To create a new environment from scratch::
10
+
11
+ $ conda create -c conda-forge -n diffsky_env python=3.9 numpy jax pytest ipython jupyter matplotlib scipy h5py diffmah diffstar dsps diffsky
12
+
13
+
14
+ Managing dependencies
15
+ ---------------------
16
+
17
+ The above commands will install all the latest releases of the diffsky dependency chain.
18
+ This includes `numpy <https://numpy.org/>`__ and
19
+ `jax <https://jax.readthedocs.io/en/latest/>`__,
20
+ and also a collection of libraries implementing
21
+ the differentiable modeling ingredients:
22
+ `Diffmah <https://github.com/ArgonneCPAC/diffmah>`_,
23
+ `Diffstar <https://github.com/ArgonneCPAC/diffstar>`_,
24
+ and `DSPS <https://github.com/ArgonneCPAC/dsps>`_.
25
+
26
+ Depending on your analysis, you may need to install a specific branch of diffsky
27
+ and/one of its dependencies. You can do this by cloning the GitHub repo of the code
28
+ for which you need a custom version, checking out the appropriate version,
29
+ and running::
30
+
31
+ $ pip install . --no-deps
@@ -1 +0,0 @@
1
- __version__ = '0.1.0'
@@ -1,48 +0,0 @@
1
- Installation instructions
2
- =========================
3
-
4
- Dependencies
5
- ------------
6
-
7
- ``diffsky`` requires `numpy <https://numpy.org/>`__
8
- and `jax <https://jax.readthedocs.io/en/latest/>`__,
9
- and also a collection of libraries implementing
10
- the differentiable modeling ingredients:
11
- `Diffmah <https://github.com/ArgonneCPAC/diffmah>`_,
12
- `Diffstar <https://github.com/ArgonneCPAC/diffstar>`_,
13
- and `DSPS <https://github.com/ArgonneCPAC/dsps>`_.
14
-
15
- Installation
16
- ------------
17
-
18
- Installing dependencies
19
- ~~~~~~~~~~~~~~~~~~~~~~~
20
-
21
- Beginning from an environment that includes numpy and a recent version of jax,
22
- you can install the additional dependencies available on conda-forge as follows:
23
-
24
- conda install -c conda-forge diffmah diffstar dsps
25
-
26
- Depending on the mock you are making,
27
- note that for one or more of these dependencies,
28
- you may need to install the main branch of the code.
29
- You can do this by cloning the GitHub repository and running the standard::
30
-
31
- python setup.py install
32
-
33
- command or its usual variants, such as::
34
-
35
- python setup.py install --prefix=/PATH/TO/INSTALL/DIRECTORY
36
-
37
- or::
38
-
39
- pip install .
40
-
41
- Installing diffsky
42
- ~~~~~~~~~~~~~~~~~~
43
-
44
- Once you have the dependencies installed,
45
- ``diffsky`` can be installed as usual::
46
-
47
- python setup.py install
48
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes