jaxace 0.1.0__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.
jaxace-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 CosmologicalEmulators
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
jaxace-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.3
2
+ Name: jaxace
3
+ Version: 0.1.0
4
+ Summary: JAX/Flax implementation of AbstractCosmologicalEmulators.jl interface
5
+ Author: marcobonici
6
+ Author-email: bonici.marco@gmail.com
7
+ Requires-Python: >=3.10,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Requires-Dist: diffrax (>=0.7.0,<0.8.0)
14
+ Requires-Dist: flax (>=0.10.0,<0.11.0)
15
+ Requires-Dist: interpax (>=0.3.9,<0.4.0)
16
+ Requires-Dist: jax (>=0.4.30,<0.5.0)
17
+ Requires-Dist: jaxlib (>=0.4.30,<0.5.0)
18
+ Requires-Dist: numpy (>=2.2.6,<3.0.0)
19
+ Requires-Dist: quadax (>=0.2.9,<0.3.0)
20
+ Description-Content-Type: text/markdown
21
+
22
+ # jaxace
23
+
24
+ [![Tests](https://github.com/CosmologicalEmulators/jaxace/actions/workflows/tests.yml/badge.svg)](https://github.com/CosmologicalEmulators/jaxace/actions/workflows/tests.yml)
25
+ [![Documentation](https://img.shields.io/badge/docs-stable-blue)](https://cosmologicalemulators.github.io/jaxace/stable/)
26
+ [![Documentation](https://img.shields.io/badge/docs-dev-blue)](https://cosmologicalemulators.github.io/jaxace/dev/)
27
+ [![codecov](https://codecov.io/gh/CosmologicalEmulators/jaxace/graph/badge.svg?token=8DGPCJR8KX)](https://codecov.io/gh/CosmologicalEmulators/jaxace)
28
+
29
+ JAX/Flax implementation of cosmological emulators with automatic JIT compilation.
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ pip install -e .
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ ```python
40
+ import jaxace
41
+ import jax.numpy as jnp
42
+
43
+ # Cosmology
44
+ cosmo = jaxace.W0WaCDMCosmology(
45
+ ln10As=3.044, ns=0.9649, h=0.6736,
46
+ omega_b=0.02237, omega_c=0.1200,
47
+ m_nu=0.06, w0=-1.0, wa=0.0
48
+ )
49
+
50
+ # Background functions
51
+ z = jnp.array([0.0, 0.5, 1.0])
52
+ growth = jaxace.D_z_from_cosmo(z, cosmo)
53
+ distance = jaxace.r_z_from_cosmo(z, cosmo)
54
+
55
+ # Neural network emulator
56
+ emulator = jaxace.init_emulator(nn_dict, weights, jaxace.FlaxEmulator)
57
+ output = emulator(input_data) # Auto-JIT + batch detection
58
+ ```
59
+
60
+ ## Features
61
+
62
+ - Background cosmology (growth, distances, Hubble)
63
+ - Neural network emulators with auto-JIT
64
+ - Massive neutrinos and dark energy support
65
+ - Full JAX integration (grad, vmap, jit)
66
+
jaxace-0.1.0/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # jaxace
2
+
3
+ [![Tests](https://github.com/CosmologicalEmulators/jaxace/actions/workflows/tests.yml/badge.svg)](https://github.com/CosmologicalEmulators/jaxace/actions/workflows/tests.yml)
4
+ [![Documentation](https://img.shields.io/badge/docs-stable-blue)](https://cosmologicalemulators.github.io/jaxace/stable/)
5
+ [![Documentation](https://img.shields.io/badge/docs-dev-blue)](https://cosmologicalemulators.github.io/jaxace/dev/)
6
+ [![codecov](https://codecov.io/gh/CosmologicalEmulators/jaxace/graph/badge.svg?token=8DGPCJR8KX)](https://codecov.io/gh/CosmologicalEmulators/jaxace)
7
+
8
+ JAX/Flax implementation of cosmological emulators with automatic JIT compilation.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pip install -e .
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```python
19
+ import jaxace
20
+ import jax.numpy as jnp
21
+
22
+ # Cosmology
23
+ cosmo = jaxace.W0WaCDMCosmology(
24
+ ln10As=3.044, ns=0.9649, h=0.6736,
25
+ omega_b=0.02237, omega_c=0.1200,
26
+ m_nu=0.06, w0=-1.0, wa=0.0
27
+ )
28
+
29
+ # Background functions
30
+ z = jnp.array([0.0, 0.5, 1.0])
31
+ growth = jaxace.D_z_from_cosmo(z, cosmo)
32
+ distance = jaxace.r_z_from_cosmo(z, cosmo)
33
+
34
+ # Neural network emulator
35
+ emulator = jaxace.init_emulator(nn_dict, weights, jaxace.FlaxEmulator)
36
+ output = emulator(input_data) # Auto-JIT + batch detection
37
+ ```
38
+
39
+ ## Features
40
+
41
+ - Background cosmology (growth, distances, Hubble)
42
+ - Neural network emulators with auto-JIT
43
+ - Massive neutrinos and dark energy support
44
+ - Full JAX integration (grad, vmap, jit)
@@ -0,0 +1,72 @@
1
+ """
2
+ JAX AbstractCosmologicalEmulators (jaxace)
3
+
4
+ A JAX/Flax implementation of the AbstractCosmologicalEmulators.jl interface,
5
+ providing foundational neural network emulator infrastructure for cosmological
6
+ computations.
7
+ """
8
+
9
+ from .core import (
10
+ AbstractTrainedEmulator,
11
+ FlaxEmulator,
12
+ run_emulator,
13
+ get_emulator_description
14
+ )
15
+
16
+ from .initialization import (
17
+ init_emulator,
18
+ MLP
19
+ )
20
+
21
+ from .utils import (
22
+ maximin,
23
+ inv_maximin,
24
+ validate_nn_dict_structure,
25
+ validate_parameter_ranges,
26
+ validate_layer_structure,
27
+ safe_dict_access
28
+ )
29
+
30
+ # Import background cosmology functions
31
+ from .background import (
32
+ W0WaCDMCosmology,
33
+ a_z, E_a, E_z, dlogEdloga, Ωma,
34
+ D_z, f_z, D_f_z,
35
+ D_z_from_cosmo, f_z_from_cosmo, D_f_z_from_cosmo,
36
+ r_z, r_z_from_cosmo,
37
+ dA_z, dA_z_from_cosmo,
38
+ dL_z, dL_z_from_cosmo,
39
+ ρc_z, Ωtot_z
40
+ )
41
+
42
+ __version__ = "0.1.0"
43
+
44
+ __all__ = [
45
+ # Core types and functions
46
+ "AbstractTrainedEmulator",
47
+ "FlaxEmulator",
48
+ "run_emulator",
49
+ "get_emulator_description",
50
+
51
+ # Initialization
52
+ "init_emulator",
53
+ "MLP",
54
+
55
+ # Utilities
56
+ "maximin",
57
+ "inv_maximin",
58
+ "validate_nn_dict_structure",
59
+ "validate_parameter_ranges",
60
+ "validate_layer_structure",
61
+ "safe_dict_access",
62
+
63
+ # Background cosmology
64
+ "W0WaCDMCosmology",
65
+ "a_z", "E_a", "E_z", "dlogEdloga", "Ωma",
66
+ "D_z", "f_z", "D_f_z",
67
+ "D_z_from_cosmo", "f_z_from_cosmo", "D_f_z_from_cosmo",
68
+ "r_z", "r_z_from_cosmo",
69
+ "dA_z", "dA_z_from_cosmo",
70
+ "dL_z", "dL_z_from_cosmo",
71
+ "ρc_z", "Ωtot_z"
72
+ ]