PyCosmo 2.0.3__tar.gz → 2.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.
- {PyCosmo-2.0.3/PyCosmo.egg-info → PyCosmo-2.1.1}/PKG-INFO +13 -11
- PyCosmo-2.1.1/pyproject.toml +45 -0
- PyCosmo-2.1.1/setup.cfg +79 -0
- PyCosmo-2.1.1/setup.py +30 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/Background.py +51 -19
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/BoltzmannSolver/Fields.py +1 -5
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/BoltzmannSolver/LinearPerturbationBoltzmann.py +256 -82
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/BoltzmannSolver/LsodaSolver.py +33 -33
- PyCosmo-2.1.1/src/PyCosmo/BoltzmannSolver/ScipySolver.py +355 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/Cosmo.py +134 -68
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/CosmologyCore.py +11 -3
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/CosmologyCore_massivenu.py +20 -16
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/CosmologyCore_massivenu_rsa.py +13 -9
- PyCosmo-2.1.1/src/PyCosmo/CosmologyCore_massivenu_wcdm.py +1017 -0
- PyCosmo-2.1.1/src/PyCosmo/CosmologyCore_massivenu_wcdm_rsa.py +374 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/CosmologyCore_rsa.py +14 -12
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/CosmologyCore_wcdm.py +9 -5
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/CosmologyCore_wcdm_rsa.py +24 -23
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/LinearPerturbationApprox.py +6 -7
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/LinearPerturbationBase.py +10 -3
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/LinearPerturbationTable.py +2 -2
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/NonLinearPerturbationHaloFit.py +112 -100
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/NonLinearPerturbationMead.py +98 -99
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/NonLinearPerturbationTable.py +1 -1
- PyCosmo-2.0.3/PyCosmo/Obs_old.py → PyCosmo-2.1.1/src/PyCosmo/Obs.py +50 -13
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/PerturbationBase.py +2 -2
- PyCosmo-2.1.1/src/PyCosmo/PerturbationTable.py +225 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/Projection.py +11 -10
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/_RecombinationCosmics.py +2 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/__init__.py +2 -16
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/config/__init__.py +2 -7
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/config/default_lcdm.ini +10 -1
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/config/default_lcdm_rsa.ini +10 -1
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/config/default_mnulcdm.ini +10 -1
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/config/default_mnulcdm_rsa.ini +10 -1
- PyCosmo-2.1.1/src/PyCosmo/config/default_mnuwcdm.ini +92 -0
- PyCosmo-2.1.1/src/PyCosmo/config/default_mnuwcdm_rsa.ini +94 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/config/default_wcdm.ini +10 -1
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/config/default_wcdm_rsa.ini +10 -1
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/config/load_parameters_ini.py +35 -11
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/core_file_handling.py +18 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/halo_integral.c +2154 -1957
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/halo_integral.pyx +3 -4
- PyCosmo-2.1.1/src/PyCosmo/disable_multithreading.py +13 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/ini_handling.py +0 -2
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/model_config.py +55 -0
- PyCosmo-2.1.1/src/PyCosmo/predefined_k_grids.py +87 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src/PyCosmo.egg-info}/PKG-INFO +13 -11
- PyCosmo-2.1.1/src/PyCosmo.egg-info/SOURCES.txt +100 -0
- PyCosmo-2.1.1/src/PyCosmo.egg-info/not-zip-safe +1 -0
- PyCosmo-2.1.1/src/PyCosmo.egg-info/requires.txt +28 -0
- PyCosmo-2.1.1/tests/test_background.py +410 -0
- PyCosmo-2.1.1/tests/test_boltzmann_solver.py +841 -0
- PyCosmo-2.1.1/tests/test_class.py +200 -0
- PyCosmo-2.1.1/tests/test_core_files_imports.py +57 -0
- PyCosmo-2.1.1/tests/test_cosmo.py +48 -0
- PyCosmo-2.1.1/tests/test_cython_extensions.py +49 -0
- PyCosmo-2.1.1/tests/test_ini_handling.py +45 -0
- PyCosmo-2.1.1/tests/test_linear_perturbation_approx.py +259 -0
- PyCosmo-2.1.1/tests/test_massive_neutrinos.py +176 -0
- PyCosmo-2.1.1/tests/test_nonlinear_perturbation_halofit.py +132 -0
- PyCosmo-2.1.1/tests/test_nonlinear_perturbation_mead.py +218 -0
- PyCosmo-2.1.1/tests/test_obs.py +781 -0
- PyCosmo-2.1.1/tests/test_perturbation_table.py +84 -0
- PyCosmo-2.1.1/tests/test_pickling.py +25 -0
- PyCosmo-2.1.1/tests/test_pycosmo.py +112 -0
- PyCosmo-2.1.1/tests/test_recombination.py +19 -0
- PyCosmo-2.1.1/tests/test_scipy_solver.py +93 -0
- PyCosmo-2.1.1/tests/test_util.py +40 -0
- PyCosmo-2.0.3/MANIFEST.in +0 -4
- PyCosmo-2.0.3/PyCosmo/CosmologyCore.ipynb +0 -1455
- PyCosmo-2.0.3/PyCosmo/Obs.py +0 -866
- PyCosmo-2.0.3/PyCosmo.egg-info/SOURCES.txt +0 -75
- PyCosmo-2.0.3/PyCosmo.egg-info/requires.txt +0 -7
- PyCosmo-2.0.3/setup.cfg +0 -15
- PyCosmo-2.0.3/setup.py +0 -130
- {PyCosmo-2.0.3 → PyCosmo-2.1.1}/AUTHORS.rst +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1}/LICENSE +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1}/README.rst +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/BoltzmannSolver/__init__.py +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/TheoryPredTables.py +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/_Cosmics.py +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/_Recombination.py +1 -1
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/_RecombinationClass.py +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/_Tables.py +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/_Util.py +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/_scipy_utils.py +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/build.py +1 -1
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/__init__.py +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/const.c +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/constf.c +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/logf.c +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/main.c +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/mconf.h +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/mtherr.c +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/polevl.c +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/polevlf.c +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/protos.h +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/sici.c +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/sici.h +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/sici32.c +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/sicif.c +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/cython/sinf.c +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/optimize_nq.py +1 -1
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo/patches.py +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo.egg-info/dependency_links.txt +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo.egg-info/entry_points.txt +0 -0
- {PyCosmo-2.0.3 → PyCosmo-2.1.1/src}/PyCosmo.egg-info/top_level.txt +0 -0
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyCosmo
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: A multi-purpose cosmology calculation tool
|
|
5
|
-
|
|
6
|
-
Author:
|
|
7
|
-
Author-email: pycosmo@lists.phys.ethz.ch
|
|
5
|
+
Author: Uwe Schmitt et al
|
|
6
|
+
Author-email: uwe.schmitt@id.ethz.ch
|
|
8
7
|
License: GPLv3
|
|
9
|
-
|
|
8
|
+
Project-URL: Source, https://cosmo-docs.phys.ethz.ch/PyCosmo
|
|
10
9
|
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: Intended Audience :: Science/Research
|
|
12
12
|
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
13
13
|
Classifier: Natural Language :: English
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
|
-
Classifier: Programming Language :: Python
|
|
16
15
|
Classifier: Programming Language :: C
|
|
17
|
-
Classifier:
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Description-Content-Type: text/x-rst; charset=UTF-8
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Provides-Extra: docs
|
|
21
25
|
License-File: LICENSE
|
|
22
26
|
License-File: AUTHORS.rst
|
|
23
27
|
|
|
@@ -39,5 +43,3 @@ The code includes calculations of:
|
|
|
39
43
|
The code documentation can be found at `<https://cosmo-docs.phys.ethz.ch/PyCosmo/>`_ or created by typing make docs from the PyCosmo folder in your terminal.
|
|
40
44
|
|
|
41
45
|
Interactive tutorial notebooks are available on the PyCosmoHUB `<https://pycosmohub.com/>`_.
|
|
42
|
-
|
|
43
|
-
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools >= 40.6.0", "wheel", "numpy", "Cython"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[tool.black]
|
|
7
|
+
include = '\.pyi?$'
|
|
8
|
+
exclude = '''
|
|
9
|
+
(
|
|
10
|
+
\.eggs
|
|
11
|
+
| \.git
|
|
12
|
+
| \.mypy_cache
|
|
13
|
+
| \.tox
|
|
14
|
+
| \.venv
|
|
15
|
+
| venv
|
|
16
|
+
| _build/
|
|
17
|
+
| build/
|
|
18
|
+
| dist
|
|
19
|
+
)
|
|
20
|
+
'''
|
|
21
|
+
|
|
22
|
+
[tool.pytest.ini_options]
|
|
23
|
+
addopts = "-v -ra"
|
|
24
|
+
testpaths = ["tests"]
|
|
25
|
+
filterwarnings = ["ignore:invalid"]
|
|
26
|
+
|
|
27
|
+
[tool.tox]
|
|
28
|
+
legacy_tox_ini = '''
|
|
29
|
+
[tox]
|
|
30
|
+
isolated_build = true
|
|
31
|
+
envlist = py39,py310,py311
|
|
32
|
+
package = sdist
|
|
33
|
+
setenv =
|
|
34
|
+
PIP_EXTRA_INDEX_URL=https://cosmo-pypi.phys.ethz.ch/simple
|
|
35
|
+
HTTP_PROXY=http://proxy.ethz.ch:3128
|
|
36
|
+
HTTPS_PROXY=http://proxy.ethz.ch:3128
|
|
37
|
+
|
|
38
|
+
[testenv]
|
|
39
|
+
skip_install = false
|
|
40
|
+
passenv = *
|
|
41
|
+
allowlist_externals = pytest
|
|
42
|
+
extras = dev
|
|
43
|
+
commands =
|
|
44
|
+
pytest --runslow -v -ra tests
|
|
45
|
+
'''
|
PyCosmo-2.1.1/setup.cfg
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
name = PyCosmo
|
|
3
|
+
version = 2.1.1
|
|
4
|
+
license = GPLv3
|
|
5
|
+
description = A multi-purpose cosmology calculation tool
|
|
6
|
+
long_description = file: README.rst
|
|
7
|
+
long_description_content_type = text/x-rst; charset=UTF-8
|
|
8
|
+
author = Uwe Schmitt et al
|
|
9
|
+
author_email = uwe.schmitt@id.ethz.ch
|
|
10
|
+
classifiers =
|
|
11
|
+
Development Status :: 4 - Beta
|
|
12
|
+
Intended Audience :: Developers
|
|
13
|
+
Intended Audience :: Science/Research
|
|
14
|
+
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
15
|
+
Natural Language :: English
|
|
16
|
+
Operating System :: OS Independent
|
|
17
|
+
Programming Language :: C
|
|
18
|
+
Programming Language :: Python :: 3
|
|
19
|
+
Programming Language :: Python :: 3.10
|
|
20
|
+
Programming Language :: Python :: 3.9
|
|
21
|
+
Programming Language :: Python :: 3.8
|
|
22
|
+
Topic :: Scientific/Engineering :: Astronomy
|
|
23
|
+
project_urls =
|
|
24
|
+
Source = https://cosmo-docs.phys.ethz.ch/PyCosmo
|
|
25
|
+
|
|
26
|
+
[options]
|
|
27
|
+
install_requires =
|
|
28
|
+
numpy
|
|
29
|
+
recfast4py>=0.2.3
|
|
30
|
+
dill
|
|
31
|
+
matplotlib
|
|
32
|
+
numba>=0.57.0rc1
|
|
33
|
+
sympy2c>=2.2.2
|
|
34
|
+
numexpr
|
|
35
|
+
scipy
|
|
36
|
+
packages = find:
|
|
37
|
+
package_dir =
|
|
38
|
+
=src
|
|
39
|
+
zip_safe = False
|
|
40
|
+
python_requires = >=3.8
|
|
41
|
+
|
|
42
|
+
[options.packages.find]
|
|
43
|
+
where = src
|
|
44
|
+
|
|
45
|
+
[options.package_data]
|
|
46
|
+
* =
|
|
47
|
+
*.pyx
|
|
48
|
+
*.c
|
|
49
|
+
*.h
|
|
50
|
+
config/*.ini
|
|
51
|
+
|
|
52
|
+
[options.entry_points]
|
|
53
|
+
console_scripts =
|
|
54
|
+
recompile = PyCosmo:Cosmo.recompile_from_cli
|
|
55
|
+
|
|
56
|
+
[options.extras_require]
|
|
57
|
+
dev =
|
|
58
|
+
Cython
|
|
59
|
+
twine
|
|
60
|
+
pytest<7.2.0
|
|
61
|
+
pytest-cov
|
|
62
|
+
pytest-regtest
|
|
63
|
+
tox
|
|
64
|
+
flake8
|
|
65
|
+
black
|
|
66
|
+
isort
|
|
67
|
+
sphinx
|
|
68
|
+
sphinx-pynpoint-theme
|
|
69
|
+
myst-parser
|
|
70
|
+
memray
|
|
71
|
+
docs =
|
|
72
|
+
sphinx
|
|
73
|
+
sphinx-pynpoint-theme
|
|
74
|
+
myst-parser
|
|
75
|
+
|
|
76
|
+
[egg_info]
|
|
77
|
+
tag_build =
|
|
78
|
+
tag_date = 0
|
|
79
|
+
|
PyCosmo-2.1.1/setup.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
import numpy
|
|
3
|
+
from Cython.Build import cythonize
|
|
4
|
+
from setuptools import Extension, setup
|
|
5
|
+
|
|
6
|
+
files = [
|
|
7
|
+
"const.c",
|
|
8
|
+
"main.c",
|
|
9
|
+
"halo_integral.c",
|
|
10
|
+
"polevl.c",
|
|
11
|
+
"sici.c",
|
|
12
|
+
"sicif.c",
|
|
13
|
+
"polevlf.c",
|
|
14
|
+
"logf.c",
|
|
15
|
+
"sinf.c",
|
|
16
|
+
"constf.c",
|
|
17
|
+
"mtherr.c",
|
|
18
|
+
]
|
|
19
|
+
ext_modules = [
|
|
20
|
+
Extension(
|
|
21
|
+
name="PyCosmo.cython.halo_integral",
|
|
22
|
+
ext_modules=cythonize("src/PyCosmo/cython/halo_integral.pyx"),
|
|
23
|
+
sources=["src/PyCosmo/cython/" + file for file in files],
|
|
24
|
+
include_dirs=[numpy.get_include()],
|
|
25
|
+
)
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
setup(
|
|
29
|
+
ext_modules=ext_modules,
|
|
30
|
+
)
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import numpy as np
|
|
18
18
|
from scipy import integrate
|
|
19
|
+
from scipy.interpolate import interp1d
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
def _call(wrapper, function, a=None):
|
|
@@ -26,8 +27,7 @@ def _call(wrapper, function, a=None):
|
|
|
26
27
|
elif isinstance(a, list):
|
|
27
28
|
a = np.array(a)
|
|
28
29
|
assert isinstance(a, np.ndarray)
|
|
29
|
-
|
|
30
|
-
return getattr(wrapper, function + "_ufunc")(a)
|
|
30
|
+
return getattr(wrapper, function)(a.astype(float))
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
class Background(object):
|
|
@@ -46,6 +46,18 @@ class Background(object):
|
|
|
46
46
|
self._params = params
|
|
47
47
|
self._rec = rec
|
|
48
48
|
self._wrapper = wrapper
|
|
49
|
+
self._eta_to_a = None
|
|
50
|
+
|
|
51
|
+
def _setup_eta_to_a(self):
|
|
52
|
+
a = np.logspace(-100, 0.0, 1000)
|
|
53
|
+
eta = self.eta(a)
|
|
54
|
+
a = a[eta > 0]
|
|
55
|
+
eta = eta[eta > 0]
|
|
56
|
+
self._eta_to_a = interp1d(
|
|
57
|
+
eta, a, "cubic", bounds_error=False, fill_value="extrapolate"
|
|
58
|
+
)
|
|
59
|
+
self._eta_min = np.min(eta)
|
|
60
|
+
self._eta_max = np.max(eta)
|
|
49
61
|
|
|
50
62
|
def H(self, a):
|
|
51
63
|
"""
|
|
@@ -67,12 +79,11 @@ class Background(object):
|
|
|
67
79
|
_hubble = H
|
|
68
80
|
|
|
69
81
|
def _H2_H02_a(self, a=1.0):
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
)
|
|
82
|
+
result = self._H2_H02_Omegar_a(a=a)
|
|
83
|
+
result += self._H2_H02_Omegam_a(a=a)
|
|
84
|
+
result += self._H2_H02_Omegak_a(a=a)
|
|
85
|
+
result += self._H2_H02_Omegal_a(a=a)
|
|
86
|
+
return result
|
|
76
87
|
|
|
77
88
|
def _H2_H02_Omegar_a(self, a=1.0):
|
|
78
89
|
return self._params.omega_r / a**4
|
|
@@ -96,6 +107,7 @@ class Background(object):
|
|
|
96
107
|
return _call(self._wrapper, "omega_nu_m", a) / a**4
|
|
97
108
|
|
|
98
109
|
def _w_a(self, a=1.0):
|
|
110
|
+
self._cosmo.reset_wrapper_globals()
|
|
99
111
|
return self._params.w0 + (1.0 - a) * self._params.wa
|
|
100
112
|
|
|
101
113
|
#########################################################
|
|
@@ -131,7 +143,6 @@ class Background(object):
|
|
|
131
143
|
:param a: scale factor [1]
|
|
132
144
|
:return: Radial comoving horizon, :math:`\chi(a)`, in :math:`[Mpc s/km]`.
|
|
133
145
|
"""
|
|
134
|
-
self._cosmo.reset_wrapper_globals()
|
|
135
146
|
return _call(self._wrapper, "chi", a)
|
|
136
147
|
|
|
137
148
|
def dist_trans_a(self, a=1.0):
|
|
@@ -198,16 +209,30 @@ class Background(object):
|
|
|
198
209
|
|
|
199
210
|
return self.dist_trans_a(a) / a
|
|
200
211
|
|
|
201
|
-
def
|
|
202
|
-
|
|
203
|
-
|
|
212
|
+
def eta_to_a(self, eta):
|
|
213
|
+
if self._eta_to_a is None:
|
|
214
|
+
self._setup_eta_to_a()
|
|
215
|
+
eta = np.atleast_1d(eta)
|
|
216
|
+
if np.any(eta < 0.95 * self._eta_min) or np.any(eta > self._eta_max * 1.05):
|
|
217
|
+
raise ValueError(
|
|
218
|
+
f"eta value(s) outside of range {self._eta_min:e} .. "
|
|
219
|
+
f" {self._eta_max:e}"
|
|
220
|
+
)
|
|
221
|
+
return self._eta_to_a(eta)
|
|
204
222
|
|
|
205
|
-
|
|
206
|
-
:return: :math:`\eta` conformal time [:math:`\mathrm{Mpc}/h`]
|
|
207
|
-
"""
|
|
223
|
+
def eta(self, a):
|
|
208
224
|
a = np.atleast_1d(a)
|
|
209
|
-
|
|
210
|
-
|
|
225
|
+
af = a[a > 1e-100]
|
|
226
|
+
af = np.concatenate(([1e-100], af))
|
|
227
|
+
y, meta = self._wrapper.solve_fast_eta(
|
|
228
|
+
np.array((0.0,)),
|
|
229
|
+
af,
|
|
230
|
+
1e-8,
|
|
231
|
+
1e-8,
|
|
232
|
+
)
|
|
233
|
+
eta = np.zeros_like(a)
|
|
234
|
+
eta[a > 1e-100] = y.flatten()[1:]
|
|
235
|
+
return eta
|
|
211
236
|
|
|
212
237
|
#########################################################
|
|
213
238
|
# A series of functions to compute thermodynamical #
|
|
@@ -267,7 +292,12 @@ class Background(object):
|
|
|
267
292
|
"""
|
|
268
293
|
a = np.atleast_1d(a)
|
|
269
294
|
return np.array(
|
|
270
|
-
[
|
|
295
|
+
[
|
|
296
|
+
integrate.quadrature(
|
|
297
|
+
self._tau_intgd, np.log(aa), 0.0, rtol=1e-6, maxiter=100
|
|
298
|
+
)[0]
|
|
299
|
+
for aa in a
|
|
300
|
+
]
|
|
271
301
|
)
|
|
272
302
|
|
|
273
303
|
def _tau_intgd(self, lna):
|
|
@@ -408,7 +438,9 @@ class Background(object):
|
|
|
408
438
|
input: a - scale factor [1]
|
|
409
439
|
output: [1]
|
|
410
440
|
"""
|
|
411
|
-
|
|
441
|
+
result = self._H2_H02_Omegal_a(a=a)
|
|
442
|
+
result /= self._H2_H02_a(a=a)
|
|
443
|
+
return result
|
|
412
444
|
|
|
413
445
|
def _omega_nu_m_a(self, a=1.0):
|
|
414
446
|
"""
|
|
@@ -37,7 +37,7 @@ class Fields(object):
|
|
|
37
37
|
self.lna = None
|
|
38
38
|
self._offsets = defaultdict(list)
|
|
39
39
|
|
|
40
|
-
def set_results(self, lna, solver_result
|
|
40
|
+
def set_results(self, lna, solver_result):
|
|
41
41
|
self.lna = lna
|
|
42
42
|
|
|
43
43
|
fields_map = self._wrapper.fields(lna, solver_result, self._cosmology)
|
|
@@ -61,10 +61,6 @@ class Fields(object):
|
|
|
61
61
|
assert self._y.shape[1] == len(lna), "fields and lna vector mismatch"
|
|
62
62
|
self._offsets = offsets
|
|
63
63
|
|
|
64
|
-
if not keep_lna0:
|
|
65
|
-
self._y = self._y[:, 1:]
|
|
66
|
-
self.lna = self.lna[1:]
|
|
67
|
-
|
|
68
64
|
def __dir__(self):
|
|
69
65
|
return super().__dir__() + list(map(str, self._symbols))
|
|
70
66
|
|