PyCosmo 2.1.3__tar.gz → 2.2.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.
Files changed (117) hide show
  1. {PyCosmo-2.1.3 → pycosmo-2.2.0}/AUTHORS.rst +0 -1
  2. {PyCosmo-2.1.3/src/PyCosmo.egg-info → pycosmo-2.2.0}/PKG-INFO +6 -11
  3. {PyCosmo-2.1.3 → pycosmo-2.2.0}/setup.cfg +6 -11
  4. pycosmo-2.2.0/setup.py +41 -0
  5. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/Background.py +1 -2
  6. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/BoltzmannSolver/Fields.py +0 -1
  7. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/BoltzmannSolver/LinearPerturbationBoltzmann.py +2 -3
  8. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/BoltzmannSolver/LsodaSolver.py +0 -2
  9. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/BoltzmannSolver/ScipySolver.py +0 -1
  10. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/Cosmo.py +21 -8
  11. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/CosmologyCore.py +4 -12
  12. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/CosmologyCore_massivenu.py +5 -14
  13. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/CosmologyCore_massivenu_rsa.py +2 -12
  14. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/CosmologyCore_massivenu_wcdm.py +5 -14
  15. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/CosmologyCore_massivenu_wcdm_rsa.py +2 -12
  16. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/CosmologyCore_wcdm.py +5 -12
  17. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/LinearPerturbationApprox.py +8 -19
  18. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/LinearPerturbationTable.py +0 -1
  19. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/NonLinearPerturbationHaloFit.py +1 -2
  20. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/NonLinearPerturbationMead.py +33 -13
  21. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/NonLinearPerturbationTable.py +0 -1
  22. pycosmo-2.2.0/src/PyCosmo/NonLinearPerturbation_HI.py +424 -0
  23. pycosmo-2.2.0/src/PyCosmo/NonLinearPerturbation_HaloModel.py +1266 -0
  24. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/Obs.py +44 -37
  25. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/PerturbationTable.py +0 -3
  26. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/Projection.py +40 -16
  27. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/TheoryPredTables.py +0 -1
  28. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/_Recombination.py +0 -1
  29. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/_RecombinationClass.py +0 -1
  30. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/_RecombinationCosmics.py +0 -1
  31. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/_Tables.py +0 -1
  32. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/_Util.py +0 -2
  33. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/__init__.py +1 -0
  34. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/_scipy_utils.py +0 -1
  35. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/build.py +0 -1
  36. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/config/default_lcdm.ini +9 -1
  37. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/config/default_lcdm_rsa.ini +9 -1
  38. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/config/default_mnulcdm.ini +9 -1
  39. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/config/default_mnulcdm_rsa.ini +9 -1
  40. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/config/default_mnuwcdm.ini +9 -1
  41. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/config/default_mnuwcdm_rsa.ini +9 -1
  42. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/config/default_wcdm.ini +9 -1
  43. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/config/default_wcdm_rsa.ini +9 -1
  44. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/config/load_parameters_ini.py +23 -6
  45. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/core_file_handling.py +0 -6
  46. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/__init__.py +6 -0
  47. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/const.c +1 -1
  48. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/halo_integral.c +2391 -1788
  49. pycosmo-2.2.0/src/PyCosmo/cython/halo_integral_1h.c +33619 -0
  50. pycosmo-2.2.0/src/PyCosmo/cython/halo_integral_1h.pyx +298 -0
  51. pycosmo-2.2.0/src/PyCosmo/cython/halo_integral_2h.c +33796 -0
  52. pycosmo-2.2.0/src/PyCosmo/cython/halo_integral_2h.pyx +306 -0
  53. pycosmo-2.2.0/src/PyCosmo/cython/halo_integral_HI_1h.c +34030 -0
  54. pycosmo-2.2.0/src/PyCosmo/cython/halo_integral_HI_1h.pyx +303 -0
  55. pycosmo-2.2.0/src/PyCosmo/cython/halo_integral_HI_2h.c +34208 -0
  56. pycosmo-2.2.0/src/PyCosmo/cython/halo_integral_HI_2h.pyx +314 -0
  57. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/logf.c +2 -9
  58. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/mconf.h +2 -2
  59. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/mtherr.c +2 -2
  60. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/polevl.c +1 -1
  61. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/polevlf.c +1 -15
  62. pycosmo-2.2.0/src/PyCosmo/cython/rho_HI_integral.c +33231 -0
  63. pycosmo-2.2.0/src/PyCosmo/cython/rho_HI_integral.pyx +257 -0
  64. pycosmo-2.2.0/src/PyCosmo/cython/rho_m_integral.c +33015 -0
  65. pycosmo-2.2.0/src/PyCosmo/cython/rho_m_integral.pyx +246 -0
  66. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/sici.c +1 -1
  67. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/sici32.c +1 -1
  68. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/sicif.c +1 -11
  69. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/sinf.c +3 -14
  70. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/model_config.py +0 -4
  71. {PyCosmo-2.1.3 → pycosmo-2.2.0/src/PyCosmo.egg-info}/PKG-INFO +6 -11
  72. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo.egg-info/SOURCES.txt +15 -0
  73. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo.egg-info/requires.txt +5 -10
  74. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_boltzmann_solver.py +0 -10
  75. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_class.py +0 -4
  76. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_cython_extensions.py +3 -1
  77. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_linear_perturbation_approx.py +0 -3
  78. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_massive_neutrinos.py +0 -4
  79. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_nonlinear_perturbation_halofit.py +3 -6
  80. pycosmo-2.2.0/tests/test_nonlinear_perturbation_halomodel.py +167 -0
  81. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_nonlinear_perturbation_mead.py +0 -2
  82. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_obs.py +67 -26
  83. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_pycosmo.py +0 -2
  84. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_scipy_solver.py +2 -4
  85. PyCosmo-2.1.3/setup.py +0 -30
  86. {PyCosmo-2.1.3 → pycosmo-2.2.0}/LICENSE +0 -0
  87. {PyCosmo-2.1.3 → pycosmo-2.2.0}/README.rst +0 -0
  88. {PyCosmo-2.1.3 → pycosmo-2.2.0}/pyproject.toml +0 -0
  89. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/BoltzmannSolver/__init__.py +0 -0
  90. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/CosmologyCore_rsa.py +0 -0
  91. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/CosmologyCore_wcdm_rsa.py +0 -0
  92. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/LinearPerturbationBase.py +0 -0
  93. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/PerturbationBase.py +0 -0
  94. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/_Cosmics.py +0 -0
  95. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/config/__init__.py +0 -0
  96. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/constf.c +0 -0
  97. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/halo_integral.pyx +1 -1
  98. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/main.c +0 -0
  99. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/protos.h +0 -0
  100. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/cython/sici.h +0 -0
  101. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/disable_multithreading.py +0 -0
  102. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/ini_handling.py +0 -0
  103. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/optimize_nq.py +0 -0
  104. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/patches.py +0 -0
  105. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo/predefined_k_grids.py +0 -0
  106. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo.egg-info/dependency_links.txt +0 -0
  107. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo.egg-info/entry_points.txt +0 -0
  108. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo.egg-info/not-zip-safe +0 -0
  109. {PyCosmo-2.1.3 → pycosmo-2.2.0}/src/PyCosmo.egg-info/top_level.txt +0 -0
  110. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_background.py +0 -0
  111. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_core_files_imports.py +0 -0
  112. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_cosmo.py +0 -0
  113. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_ini_handling.py +0 -0
  114. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_perturbation_table.py +0 -0
  115. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_pickling.py +0 -0
  116. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_recombination.py +0 -0
  117. {PyCosmo-2.1.3 → pycosmo-2.2.0}/tests/test_util.py +0 -0
@@ -19,4 +19,3 @@ Contact information
19
19
 
20
20
  If you have any suggestions or questions about PyCosmo feel free to email us
21
21
  at pycosmo@lists.phys.ethz.ch.
22
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyCosmo
3
- Version: 2.1.3
3
+ Version: 2.2.0
4
4
  Summary: A multi-purpose cosmology calculation tool
5
5
  Author: Uwe Schmitt et al
6
6
  Author-email: uwe.schmitt@id.ethz.ch
@@ -22,7 +22,7 @@ Requires-Python: >=3.8
22
22
  Description-Content-Type: text/x-rst; charset=UTF-8
23
23
  License-File: LICENSE
24
24
  License-File: AUTHORS.rst
25
- Requires-Dist: numpy
25
+ Requires-Dist: numpy<2
26
26
  Requires-Dist: recfast4py>=0.2.3
27
27
  Requires-Dist: dill
28
28
  Requires-Dist: matplotlib
@@ -33,17 +33,12 @@ Requires-Dist: scipy
33
33
  Provides-Extra: dev
34
34
  Requires-Dist: Cython; extra == "dev"
35
35
  Requires-Dist: twine; extra == "dev"
36
- Requires-Dist: pytest<7.2.0; extra == "dev"
36
+ Requires-Dist: pytest; extra == "dev"
37
37
  Requires-Dist: pytest-cov; extra == "dev"
38
- Requires-Dist: pytest-regtest; extra == "dev"
39
- Requires-Dist: tox; extra == "dev"
40
- Requires-Dist: flake8; extra == "dev"
41
- Requires-Dist: black; extra == "dev"
38
+ Requires-Dist: pytest-regtest>=2.2.0a2; extra == "dev"
39
+ Requires-Dist: ruff; extra == "dev"
42
40
  Requires-Dist: isort; extra == "dev"
43
- Requires-Dist: sphinx<7; extra == "dev"
44
- Requires-Dist: sphinx-pynpoint-theme; extra == "dev"
45
- Requires-Dist: myst-parser; extra == "dev"
46
- Requires-Dist: memray; extra == "dev"
41
+ Requires-Dist: pre-commit; extra == "dev"
47
42
  Provides-Extra: docs
48
43
  Requires-Dist: sphinx<7; extra == "docs"
49
44
  Requires-Dist: sphinx-pynpoint-theme; extra == "docs"
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = PyCosmo
3
- version = 2.1.3
3
+ version = 2.2.0
4
4
  license = GPLv3
5
5
  description = A multi-purpose cosmology calculation tool
6
6
  long_description = file: README.rst
@@ -25,7 +25,7 @@ project_urls =
25
25
 
26
26
  [options]
27
27
  install_requires =
28
- numpy
28
+ numpy<2
29
29
  recfast4py>=0.2.3
30
30
  dill
31
31
  matplotlib
@@ -57,17 +57,12 @@ console_scripts =
57
57
  dev =
58
58
  Cython
59
59
  twine
60
- pytest<7.2.0
60
+ pytest
61
61
  pytest-cov
62
- pytest-regtest
63
- tox
64
- flake8
65
- black
62
+ pytest-regtest>=2.2.0a2
63
+ ruff
66
64
  isort
67
- sphinx < 7
68
- sphinx-pynpoint-theme
69
- myst-parser
70
- memray
65
+ pre-commit
71
66
  docs =
72
67
  sphinx < 7
73
68
  sphinx-pynpoint-theme
pycosmo-2.2.0/setup.py ADDED
@@ -0,0 +1,41 @@
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
+ "polevl.c",
10
+ "sici.c",
11
+ "sicif.c",
12
+ "polevlf.c",
13
+ "logf.c",
14
+ "sinf.c",
15
+ "constf.c",
16
+ "mtherr.c",
17
+ ]
18
+ ext_modules = []
19
+
20
+
21
+ for stem in (
22
+ "halo_integral",
23
+ "halo_integral_1h",
24
+ "halo_integral_2h",
25
+ "halo_integral_HI_1h",
26
+ "halo_integral_HI_2h",
27
+ "rho_HI_integral",
28
+ "rho_m_integral",
29
+ ):
30
+ ext_modules.append(
31
+ Extension(
32
+ name=f"PyCosmo.cython.{stem}",
33
+ ext_modules=cythonize(f"src/PyCosmo/cython/{stem}.pyx"),
34
+ sources=["src/PyCosmo/cython/" + file for file in files + [stem + ".c"]],
35
+ include_dirs=[numpy.get_include()],
36
+ )
37
+ )
38
+
39
+ setup(
40
+ ext_modules=ext_modules,
41
+ )
@@ -91,8 +91,7 @@ class Background(object):
91
91
  def _H2_H02_Omegam_a(self, a=1.0):
92
92
  self._cosmo.reset_wrapper_globals()
93
93
  return (
94
- self._params.omega_m / a**3
95
- + _call(self._wrapper, "omega_nu_m", a) / a**4
94
+ self._params.omega_m / a**3 + _call(self._wrapper, "omega_nu_m", a) / a**4
96
95
  )
97
96
 
98
97
  def _H2_H02_Omegak_a(self, a=1.0):
@@ -65,7 +65,6 @@ class Fields(object):
65
65
  return super().__dir__() + list(map(str, self._symbols))
66
66
 
67
67
  def __getattr__(self, symbol):
68
-
69
68
  # needed to support pickling:
70
69
  if "_offsets" not in vars(self):
71
70
  raise AttributeError()
@@ -26,6 +26,7 @@ from ..LinearPerturbationBase import LinearPerturbationBase
26
26
  from .Fields import Fields
27
27
  from .LsodaSolver import LsodaSolver
28
28
 
29
+
29
30
  # use decorator to print messages only once per model:
30
31
  @lru_cache(maxsize=1) # noqa: E302
31
32
  def print_new_traces(cache_file):
@@ -196,9 +197,7 @@ class LinearPerturbationBoltzmann(LinearPerturbationBase):
196
197
  pk = norm * growth**2 * k**self._params.n * T_k**2
197
198
  else:
198
199
  # pk = norm * np.outer(growth.T ** 2, k ** self._params.n * T_k ** 2).T
199
- pk = (
200
- norm * growth**2 * (k**self._params.n * T_k**2).reshape(-1, 1)
201
- )
200
+ pk = norm * growth**2 * (k**self._params.n * T_k**2).reshape(-1, 1)
202
201
 
203
202
  if (self._params.pk_norm_type == "A_s") or (
204
203
  self._params.pk_norm_type == "sigma8"
@@ -21,7 +21,6 @@ import numpy as np
21
21
 
22
22
 
23
23
  class LsodaSolver:
24
-
25
24
  SOLVER_ID = "linear_perturbation"
26
25
 
27
26
  _wrappers = {}
@@ -89,7 +88,6 @@ class LsodaSolver:
89
88
  enable_sparse_lu_solver=True,
90
89
  keep_lna0=False,
91
90
  ):
92
-
93
91
  self._setup_globals(k)
94
92
  self.wrapper.set_sec_factor(sec_factor)
95
93
 
@@ -24,7 +24,6 @@ from .Fields import Fields
24
24
 
25
25
 
26
26
  class ScipySolver:
27
-
28
27
  _wrappers = {}
29
28
 
30
29
  def __init__(
@@ -325,7 +325,9 @@ class Cosmo(object):
325
325
  merged.update(derived_parameters_pre)
326
326
  merged.update(self.model_specific_parameters)
327
327
 
328
- if self._last_merged is not None and self._last_merged == merged:
328
+ if self._last_merged is not None and (
329
+ dill.dumps(self._last_merged) == dill.dumps(merged)
330
+ ):
329
331
  return
330
332
 
331
333
  self._last_merged = merged
@@ -438,6 +440,22 @@ class Cosmo(object):
438
440
 
439
441
  self.nonlin_pert = NonLinearPerturbationMead(self)
440
442
 
443
+ elif params.pk_nonlin_type == "HaloModel":
444
+ assert (
445
+ params.pk_type != "boltz"
446
+ ), "HaloModel not supported by the Boltzmann solver yet!"
447
+ from .NonLinearPerturbation_HaloModel import NonLinearPerturbation_HaloModel
448
+
449
+ self.nonlin_pert = NonLinearPerturbation_HaloModel(self)
450
+
451
+ elif params.pk_nonlin_type == "HI":
452
+ assert (
453
+ params.pk_type != "boltz"
454
+ ), "HI not supported by the Boltzmann solver yet!"
455
+ from .NonLinearPerturbation_HI import NonLinearPerturbation_HI
456
+
457
+ self.nonlin_pert = NonLinearPerturbation_HI(self)
458
+
441
459
  elif params.pk_nonlin_type is None:
442
460
  self.nonlin_pert = None
443
461
 
@@ -540,10 +558,7 @@ class Cosmo(object):
540
558
  )
541
559
 
542
560
  derived_parameters.omega_gamma_prefactor = (
543
- np.pi**2
544
- / 15
545
- * (2.725 * params.kb) ** 4
546
- / (derived_parameters.rho_gamma_eV)
561
+ np.pi**2 / 15 * (2.725 * params.kb) ** 4 / (derived_parameters.rho_gamma_eV)
547
562
  )
548
563
  derived_parameters.omega_gamma = (
549
564
  derived_parameters.omega_gamma_prefactor
@@ -651,9 +666,7 @@ class Cosmo(object):
651
666
  # TODO: this differs from z_eq in the cosmo class. should probably rename
652
667
  # it to avoid confusion
653
668
  # Redshift at matter-radiation equality, Eq. (2)
654
- derived_parameters._z_equality = (
655
- 2.5e4 * omh2 * derived_parameters._sigma_27**-4
656
- )
669
+ derived_parameters._z_equality = 2.5e4 * omh2 * derived_parameters._sigma_27**-4
657
670
  b_1 = 0.313 * omh2**-0.419 * (1.0 + 0.607 * omh2**0.674)
658
671
  b_2 = 0.238 * omh2**0.223
659
672
  derived_parameters._z_drag = (
@@ -141,9 +141,7 @@ omega_l_a = IfThenElse(flat_universe, (1 - omega_m - omega_r), omega_l)
141
141
  omega_k = 1 - omega_m - omega_r - omega_l_a
142
142
 
143
143
  # Friedmann equation
144
- H = H0 * (omega_r * a**-4 + omega_m * a**-3 + omega_k * a**-2 + omega_l_a) ** (
145
- 1 / 2
146
- )
144
+ H = H0 * (omega_r * a**-4 + omega_m * a**-3 + omega_k * a**-2 + omega_l_a) ** (1 / 2)
147
145
 
148
146
  R = (3 / 4) * omega_b / omega_gamma * a
149
147
 
@@ -522,14 +520,10 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R, l_max=l_max):
522
520
  dTheta_dlan[0] = -k_H * Theta[1] - dPhi_dlan # 0th photon multipole
523
521
  dTheta_dlan[1] = k_H / 3 * (Theta[0] - 2 * Theta[2] + Psi) + taudot_interp(a) / (
524
522
  a * H
525
- ) * (
526
- Theta[1] - u_b / 3
527
- ) # 1st photon multipole
523
+ ) * (Theta[1] - u_b / 3) # 1st photon multipole
528
524
  dTheta_dlan[2] = k_H / 5 * (2 * Theta[1] - 3 * Theta[3]) + taudot_interp(a) / (
529
525
  a * H
530
- ) * (
531
- Theta[2] - Pi / 10
532
- ) # 2nd photon multipole
526
+ ) * (Theta[2] - Pi / 10) # 2nd photon multipole
533
527
 
534
528
  dTheta_P_dlan[0] = k_H / 1 * -Theta_P[1] + taudot_interp(a) / (a * H) * (
535
529
  Theta_P[0] - Pi / 2
@@ -540,9 +534,7 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R, l_max=l_max):
540
534
  ) # 1st photon polarization multipole
541
535
  dTheta_P_dlan[2] = k_H / 5 * (2 * Theta_P[1] - 3 * Theta_P[3]) + taudot_interp(
542
536
  a
543
- ) / (a * H) * (
544
- Theta_P[2] - Pi / 10
545
- ) # 2nd photon polarization multipole
537
+ ) / (a * H) * (Theta_P[2] - Pi / 10) # 2nd photon polarization multipole
546
538
 
547
539
  for l in range(3, l_max): # lth photons multipoles
548
540
  dTheta_dlan[l] = (
@@ -121,6 +121,7 @@ globals_ = Globals(
121
121
  T_mnu,
122
122
  )
123
123
 
124
+
124
125
  # check functions used to impose conditions
125
126
  # on the parameters
126
127
  def check_massive_nu_total_mass(params):
@@ -767,14 +768,10 @@ def rhs(H=H_Mpc, H0=H0_Mpc, amnu=amnu):
767
768
  dTheta_dlan[0] = -k_H * Theta[1] - dPhi_dlan # 0th photon multipole
768
769
  dTheta_dlan[1] = k_H / 3 * (Theta[0] - 2 * Theta[2] + Psi) + taudot_interp(a) / (
769
770
  a * H
770
- ) * (
771
- Theta[1] - u_b / 3
772
- ) # 1st photon multipole
771
+ ) * (Theta[1] - u_b / 3) # 1st photon multipole
773
772
  dTheta_dlan[2] = k_H / 5 * (2 * Theta[1] - 3 * Theta[3]) + taudot_interp(a) / (
774
773
  a * H
775
- ) * (
776
- Theta[2] - Pi / 10
777
- ) # 2nd photon multipole
774
+ ) * (Theta[2] - Pi / 10) # 2nd photon multipole
778
775
 
779
776
  dTheta_P_dlan[0] = k_H / 1 * -Theta_P[1] + taudot_interp(a) / (a * H) * (
780
777
  Theta_P[0] - Pi / 2
@@ -785,9 +782,7 @@ def rhs(H=H_Mpc, H0=H0_Mpc, amnu=amnu):
785
782
  ) # 1st photon polarization multipole
786
783
  dTheta_P_dlan[2] = k_H / 5 * (2 * Theta_P[1] - 3 * Theta_P[3]) + taudot_interp(
787
784
  a
788
- ) / (a * H) * (
789
- Theta_P[2] - Pi / 10
790
- ) # 2nd photon polarization multipole
785
+ ) / (a * H) * (Theta_P[2] - Pi / 10) # 2nd photon polarization multipole
791
786
 
792
787
  for l in range(3, l_max): # lth photons multipoles
793
788
  dTheta_dlan[l] = (
@@ -845,7 +840,6 @@ def rhs(H=H_Mpc, H0=H0_Mpc, amnu=amnu):
845
840
 
846
841
  for m in range(2, l_max_mnu):
847
842
  for j in range(nq):
848
-
849
843
  dM_dlan[m * nq + j] = (
850
844
  qq[j]
851
845
  * k
@@ -862,10 +856,7 @@ def rhs(H=H_Mpc, H0=H0_Mpc, amnu=amnu):
862
856
  1
863
857
  / (a * H)
864
858
  * (
865
- qq[j]
866
- * k
867
- / sp.sqrt(amnu**2 + qq[j] ** 2)
868
- * M[(l_max_mnu - 1) * nq + j]
859
+ qq[j] * k / sp.sqrt(amnu**2 + qq[j] ** 2) * M[(l_max_mnu - 1) * nq + j]
869
860
  - (l_max_mnu + 1) / eta_interp(a) * M[l_max_mnu * nq + j]
870
861
  )
871
862
  )
@@ -140,7 +140,6 @@ def rhs_rsa(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu, l_max=2):
140
140
  # lth multipoles massive neutrinos
141
141
  for m in range(2, l_max_mnu):
142
142
  for j in range(nq):
143
-
144
143
  dM_dlan[m * nq + j] = (
145
144
  qq[j]
146
145
  * k
@@ -153,10 +152,7 @@ def rhs_rsa(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu, l_max=2):
153
152
  1
154
153
  / (a * H)
155
154
  * (
156
- qq[j]
157
- * k
158
- / sp.sqrt(amnu**2 + qq[j] ** 2)
159
- * M[(l_max_mnu - 1) * nq + j]
155
+ qq[j] * k / sp.sqrt(amnu**2 + qq[j] ** 2) * M[(l_max_mnu - 1) * nq + j]
160
156
  - (l_max_mnu + 1) / eta_interp(a) * M[l_max_mnu * nq + j]
161
157
  )
162
158
  )
@@ -232,13 +228,7 @@ def merge(wrapper, t_0, t_switch, t_1, y_0, y_1): # pragma: no cover
232
228
  T_0 = Tcmb * T_mnu
233
229
  amnu = a * massive_nu_total_mass / (N_massive_nu * kb * T_0)
234
230
  rho_ev = (
235
- 3
236
- * H0**2
237
- * (hbar) ** 3
238
- * c_ms**3
239
- / (8 * np.pi * G)
240
- / evc2
241
- / (mpc / 1000) ** 2
231
+ 3 * H0**2 * (hbar) ** 3 * c_ms**3 / (8 * np.pi * G) / evc2 / (mpc / 1000) ** 2
242
232
  ) / (kb * T_0) ** 4
243
233
  C_nu = N_massive_nu / (2 * np.pi) ** 2 / rho_ev
244
234
 
@@ -129,6 +129,7 @@ globals_ = Globals(
129
129
  cs_de2,
130
130
  )
131
131
 
132
+
132
133
  # check functions used to impose conditions
133
134
  # on the parameters
134
135
  def check_massive_nu_total_mass(params):
@@ -816,14 +817,10 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu):
816
817
  dTheta_dlan[0] = -k_H * Theta[1] - dPhi_dlan # 0th photon multipole
817
818
  dTheta_dlan[1] = k_H / 3 * (Theta[0] - 2 * Theta[2] + Psi) + taudot_interp(a) / (
818
819
  a * H
819
- ) * (
820
- Theta[1] - u_b / 3
821
- ) # 1st photon multipole
820
+ ) * (Theta[1] - u_b / 3) # 1st photon multipole
822
821
  dTheta_dlan[2] = k_H / 5 * (2 * Theta[1] - 3 * Theta[3]) + taudot_interp(a) / (
823
822
  a * H
824
- ) * (
825
- Theta[2] - Pi / 10
826
- ) # 2nd photon multipole
823
+ ) * (Theta[2] - Pi / 10) # 2nd photon multipole
827
824
 
828
825
  dTheta_P_dlan[0] = k_H / 1 * -Theta_P[1] + taudot_interp(a) / (a * H) * (
829
826
  Theta_P[0] - Pi / 2
@@ -834,9 +831,7 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu):
834
831
  ) # 1st photon polarization multipole
835
832
  dTheta_P_dlan[2] = k_H / 5 * (2 * Theta_P[1] - 3 * Theta_P[3]) + taudot_interp(
836
833
  a
837
- ) / (a * H) * (
838
- Theta_P[2] - Pi / 10
839
- ) # 2nd photon polarization multipole
834
+ ) / (a * H) * (Theta_P[2] - Pi / 10) # 2nd photon polarization multipole
840
835
 
841
836
  for l in range(3, l_max): # lth photons multipoles
842
837
  dTheta_dlan[l] = (
@@ -894,7 +889,6 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu):
894
889
 
895
890
  for m in range(2, l_max_mnu):
896
891
  for j in range(nq):
897
-
898
892
  dM_dlan[m * nq + j] = (
899
893
  qq[j]
900
894
  * k
@@ -911,10 +905,7 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu):
911
905
  1
912
906
  / (a * H)
913
907
  * (
914
- qq[j]
915
- * k
916
- / sp.sqrt(amnu**2 + qq[j] ** 2)
917
- * M[(l_max_mnu - 1) * nq + j]
908
+ qq[j] * k / sp.sqrt(amnu**2 + qq[j] ** 2) * M[(l_max_mnu - 1) * nq + j]
918
909
  - (l_max_mnu + 1) / eta_interp(a) * M[l_max_mnu * nq + j]
919
910
  )
920
911
  )
@@ -157,7 +157,6 @@ def rhs_rsa(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu, l_max=2):
157
157
  # lth multipoles massive neutrinos
158
158
  for m in range(2, l_max_mnu):
159
159
  for j in range(nq):
160
-
161
160
  dM_dlan[m * nq + j] = (
162
161
  qq[j]
163
162
  * k
@@ -170,10 +169,7 @@ def rhs_rsa(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu, l_max=2):
170
169
  1
171
170
  / (a * H)
172
171
  * (
173
- qq[j]
174
- * k
175
- / sp.sqrt(amnu**2 + qq[j] ** 2)
176
- * M[(l_max_mnu - 1) * nq + j]
172
+ qq[j] * k / sp.sqrt(amnu**2 + qq[j] ** 2) * M[(l_max_mnu - 1) * nq + j]
177
173
  - (l_max_mnu + 1) / eta_interp(a) * M[l_max_mnu * nq + j]
178
174
  )
179
175
  )
@@ -256,13 +252,7 @@ def merge(wrapper, t_0, t_switch, t_1, y_0, y_1): # pragma: no cover
256
252
  T_0 = Tcmb * T_mnu
257
253
  amnu = a * massive_nu_total_mass / (N_massive_nu * kb * T_0)
258
254
  rho_ev = (
259
- 3
260
- * H0**2
261
- * (hbar) ** 3
262
- * c_ms**3
263
- / (8 * np.pi * G)
264
- / evc2
265
- / (mpc / 1000) ** 2
255
+ 3 * H0**2 * (hbar) ** 3 * c_ms**3 / (8 * np.pi * G) / evc2 / (mpc / 1000) ** 2
266
256
  ) / (kb * T_0) ** 4
267
257
  C_nu = N_massive_nu / (2 * np.pi) ** 2 / rho_ev
268
258
 
@@ -106,6 +106,7 @@ neq = 5 + 2 + 3 * (l_max + 1)
106
106
  # w_a is w(a), not to be confused with wa
107
107
  w_a = w0
108
108
 
109
+
109
110
  # check functions used to impose conditions
110
111
  # on the parameters
111
112
  def check_wa(params):
@@ -165,9 +166,7 @@ omega_l_a = IfThenElse(
165
166
  omega_k = 1 - omega_m - omega_r - omega_l_a.subs({a: 1})
166
167
 
167
168
  # Friedmann equation
168
- H = H0 * (omega_r * a**-4 + omega_m * a**-3 + omega_k * a**-2 + omega_l_a) ** (
169
- 1 / 2
170
- )
169
+ H = H0 * (omega_r * a**-4 + omega_m * a**-3 + omega_k * a**-2 + omega_l_a) ** (1 / 2)
171
170
 
172
171
  R = 3 / 4 * omega_b / omega_gamma * a
173
172
 
@@ -570,14 +569,10 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R):
570
569
  dTheta_dlan[0] = -k_H * Theta[1] - dPhi_dlan # 0th photon multipole
571
570
  dTheta_dlan[1] = k_H / 3 * (Theta[0] - 2 * Theta[2] + Psi) + taudot_interp(a) / (
572
571
  a * H
573
- ) * (
574
- Theta[1] - u_b / 3
575
- ) # 1st photon multipole
572
+ ) * (Theta[1] - u_b / 3) # 1st photon multipole
576
573
  dTheta_dlan[2] = k_H / 5 * (2 * Theta[1] - 3 * Theta[3]) + taudot_interp(a) / (
577
574
  a * H
578
- ) * (
579
- Theta[2] - Pi / 10
580
- ) # 2nd photon multipole
575
+ ) * (Theta[2] - Pi / 10) # 2nd photon multipole
581
576
 
582
577
  dTheta_P_dlan[0] = k_H / 1 * -Theta_P[1] + taudot_interp(a) / (a * H) * (
583
578
  Theta_P[0] - Pi / 2
@@ -588,9 +583,7 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R):
588
583
  ) # 1st photon polarization multipole
589
584
  dTheta_P_dlan[2] = k_H / 5 * (2 * Theta_P[1] - 3 * Theta_P[3]) + taudot_interp(
590
585
  a
591
- ) / (a * H) * (
592
- Theta_P[2] - Pi / 10
593
- ) # 2nd photon polarization multipole
586
+ ) / (a * H) * (Theta_P[2] - Pi / 10) # 2nd photon polarization multipole
594
587
 
595
588
  for l in range(3, l_max): # lth photons multipoles
596
589
  dTheta_dlan[l] = (
@@ -21,7 +21,6 @@ from .LinearPerturbationBase import LinearPerturbationBase
21
21
 
22
22
 
23
23
  class LinearPerturbationApprox(LinearPerturbationBase):
24
-
25
24
  r"""
26
25
  Class created to manage fitting functions for the computation of the linear matter
27
26
  power spectrum :math:`P_{lin}(k)`. The fitting functions provide transfer
@@ -170,10 +169,9 @@ class LinearPerturbationApprox(LinearPerturbationBase):
170
169
 
171
170
  _dlnh_dlna = self._background._dlnh_dlna(a=a_temp)[0]
172
171
 
173
- f2 = (
174
- -(4.0 + _dlnh_dlna) * y[1]
175
- - (3.0 + _dlnh_dlna - 1.5 * self._background._omega_m_a(a=a_temp)) * y[0]
176
- )
172
+ f2 = -(4.0 + _dlnh_dlna) * y[1] - (
173
+ 3.0 + _dlnh_dlna - 1.5 * self._background._omega_m_a(a=a_temp)
174
+ ) * y[0]
177
175
  return [f1, f2]
178
176
 
179
177
  def _growth_derivs_nu(self, y, x):
@@ -188,10 +186,9 @@ class LinearPerturbationApprox(LinearPerturbationBase):
188
186
 
189
187
  _dlnh_dlna = self._background._dlnh_dlna_massive_nu(a=a_temp)
190
188
 
191
- f2 = (
192
- -(4.0 + _dlnh_dlna) * y[1]
193
- - (3.0 + _dlnh_dlna - 1.5 * self._background._omega_m_a(a=a_temp)) * y[0]
194
- )
189
+ f2 = -(4.0 + _dlnh_dlna) * y[1] - (
190
+ 3.0 + _dlnh_dlna - 1.5 * self._background._omega_m_a(a=a_temp)
191
+ ) * y[0]
195
192
  return [f1, f2]
196
193
 
197
194
  def _growth_hyper_a(self, a=1.0): # , Om=0.25,z=0):
@@ -574,7 +571,6 @@ class LinearPerturbationApprox(LinearPerturbationBase):
574
571
  """
575
572
 
576
573
  if self._params.pk_type == "EH":
577
-
578
574
  self._set_eh_params()
579
575
 
580
576
  if self._params.pk_type in ("BBKS", "BBKS_CCL"):
@@ -611,14 +607,11 @@ class LinearPerturbationApprox(LinearPerturbationBase):
611
607
  return None
612
608
 
613
609
  def _set_eh_params(self):
614
-
615
610
  if (
616
611
  self._params.N_massive_nu == 0.0
617
612
  or self._params.massive_nu_total_mass == 0.0
618
613
  ):
619
- omh2 = (
620
- self._params.omega_m + self._params.omega_nu_m
621
- ) * self._params.h**2
614
+ omh2 = (self._params.omega_m + self._params.omega_nu_m) * self._params.h**2
622
615
 
623
616
  self._params._k_Silk = (
624
617
  1.6
@@ -666,7 +659,6 @@ class LinearPerturbationApprox(LinearPerturbationBase):
666
659
  self._params._beta_node = 8.41 * omh2**0.435
667
660
 
668
661
  else:
669
-
670
662
  omh2_nu = (
671
663
  self._params.omega_m + self._params.omega_nu_m
672
664
  ) * self._params.h**2
@@ -683,10 +675,7 @@ class LinearPerturbationApprox(LinearPerturbationBase):
683
675
  1291.0
684
676
  * (omh2_nu**0.251)
685
677
  / (1.0 + 0.659 * omh2_nu**0.828)
686
- * (
687
- 1.0
688
- + b_1_nu * (self._params.omega_b * self._params.h**2) ** b_2_nu
689
- )
678
+ * (1.0 + b_1_nu * (self._params.omega_b * self._params.h**2) ** b_2_nu)
690
679
  ) # Redshift at drag epoch, Eq. (4)
691
680
 
692
681
  # Wave vector values, modified to include Omega_nu_m in Omega_m
@@ -22,7 +22,6 @@ from PyCosmo.LinearPerturbationBase import LinearPerturbationBase
22
22
 
23
23
 
24
24
  class LinearPerturbationTable(LinearPerturbationBase):
25
-
26
25
  """
27
26
  This class represents the interface to the tables class, which builds
28
27
  tabulated data for the costly calculations. Using this tabulated data
@@ -22,7 +22,6 @@ from PyCosmo.PerturbationBase import NonLinearPerturbationBase
22
22
 
23
23
 
24
24
  class NonLinearPerturbationHaloFit(NonLinearPerturbationBase):
25
-
26
25
  """
27
26
  The class computes the non-linear matter power spectrum, :math:`P_{nl}(k)`,
28
27
  with a choice of analytic fitting funtions.
@@ -255,7 +254,7 @@ class NonLinearPerturbationHaloFit(NonLinearPerturbationBase):
255
254
  kseek = np.logspace(logkmin, logkmax, nk)
256
255
 
257
256
  sig2gauss = np.trapz(
258
- np.exp(-np.outer(1 / kseek, k) ** 2) * Dlin / k, x=k, axis=1
257
+ np.exp(-(np.outer(1 / kseek, k) ** 2)) * Dlin / k, x=k, axis=1
259
258
  )
260
259
 
261
260
  ksig = np.interp(1.0, sig2gauss, kseek)