PyCosmo 2.1.3__tar.gz → 2.2.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 (124) hide show
  1. {PyCosmo-2.1.3 → pycosmo-2.2.1}/AUTHORS.rst +0 -1
  2. pycosmo-2.2.1/MANIFEST.in +1 -0
  3. pycosmo-2.2.1/PKG-INFO +55 -0
  4. pycosmo-2.2.1/README.md +19 -0
  5. pycosmo-2.2.1/pyproject.toml +113 -0
  6. pycosmo-2.2.1/setup.cfg +4 -0
  7. pycosmo-2.2.1/setup.py +41 -0
  8. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/BoltzmannSolver/Fields.py +0 -1
  9. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/BoltzmannSolver/LinearPerturbationBoltzmann.py +6 -38
  10. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/BoltzmannSolver/LsodaSolver.py +0 -2
  11. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/BoltzmannSolver/ScipySolver.py +1 -2
  12. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/CosmologyCore.py +6 -12
  13. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/CosmologyCore_massivenu.py +8 -14
  14. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/CosmologyCore_massivenu_rsa.py +6 -12
  15. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/CosmologyCore_massivenu_wcdm.py +7 -14
  16. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/CosmologyCore_massivenu_wcdm_rsa.py +5 -12
  17. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/CosmologyCore_rsa.py +1 -0
  18. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/CosmologyCore_wcdm.py +6 -12
  19. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/CosmologyCore_wcdm_rsa.py +1 -0
  20. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/LinearPerturbationApprox.py +2 -11
  21. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/LinearPerturbationBase.py +5 -8
  22. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/NonLinearPerturbationHaloFit.py +9 -10
  23. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/NonLinearPerturbationMead.py +40 -20
  24. pycosmo-2.2.1/src/PyCosmo/NonLinearPerturbation_HI.py +424 -0
  25. pycosmo-2.2.1/src/PyCosmo/NonLinearPerturbation_HaloModel.py +1266 -0
  26. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/PerturbationTable.py +1 -4
  27. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/TheoryPredTables.py +0 -1
  28. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/_Recombination.py +0 -1
  29. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/_RecombinationClass.py +0 -1
  30. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/_RecombinationCosmics.py +3 -4
  31. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/_Util.py +0 -2
  32. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/__init__.py +11 -8
  33. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/_scipy_utils.py +0 -1
  34. pycosmo-2.2.1/src/PyCosmo/adaptive_simpson.c +7601 -0
  35. PyCosmo-2.1.3/src/PyCosmo/Background.py → pycosmo-2.2.1/src/PyCosmo/background.py +5 -13
  36. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/build.py +0 -1
  37. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/config/__init__.py +0 -1
  38. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/config/default_lcdm.ini +9 -1
  39. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/config/default_lcdm_rsa.ini +9 -1
  40. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/config/default_mnulcdm.ini +9 -1
  41. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/config/default_mnulcdm_rsa.ini +9 -1
  42. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/config/default_mnuwcdm.ini +9 -1
  43. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/config/default_mnuwcdm_rsa.ini +9 -1
  44. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/config/default_wcdm.ini +9 -1
  45. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/config/default_wcdm_rsa.ini +9 -1
  46. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/config/load_parameters_ini.py +23 -6
  47. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/core_file_handling.py +0 -6
  48. PyCosmo-2.1.3/src/PyCosmo/Cosmo.py → pycosmo-2.2.1/src/PyCosmo/cosmo.py +27 -14
  49. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/__init__.py +9 -1
  50. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/const.c +1 -1
  51. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/halo_integral.c +9833 -9121
  52. pycosmo-2.2.1/src/PyCosmo/cython/halo_integral_1h.c +33780 -0
  53. pycosmo-2.2.1/src/PyCosmo/cython/halo_integral_1h.pyx +298 -0
  54. pycosmo-2.2.1/src/PyCosmo/cython/halo_integral_2h.c +33943 -0
  55. pycosmo-2.2.1/src/PyCosmo/cython/halo_integral_2h.pyx +306 -0
  56. pycosmo-2.2.1/src/PyCosmo/cython/halo_integral_HI_1h.c +34161 -0
  57. pycosmo-2.2.1/src/PyCosmo/cython/halo_integral_HI_1h.pyx +303 -0
  58. pycosmo-2.2.1/src/PyCosmo/cython/halo_integral_HI_2h.c +34342 -0
  59. pycosmo-2.2.1/src/PyCosmo/cython/halo_integral_HI_2h.pyx +314 -0
  60. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/logf.c +2 -9
  61. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/mconf.h +2 -2
  62. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/mtherr.c +2 -2
  63. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/polevl.c +1 -1
  64. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/polevlf.c +1 -15
  65. pycosmo-2.2.1/src/PyCosmo/cython/rho_HI_integral.c +33413 -0
  66. pycosmo-2.2.1/src/PyCosmo/cython/rho_HI_integral.pyx +257 -0
  67. pycosmo-2.2.1/src/PyCosmo/cython/rho_m_integral.c +33211 -0
  68. pycosmo-2.2.1/src/PyCosmo/cython/rho_m_integral.pyx +246 -0
  69. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/sici.c +1 -1
  70. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/sici32.c +1 -1
  71. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/sicif.c +1 -11
  72. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/sinf.c +3 -14
  73. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/model_config.py +0 -4
  74. PyCosmo-2.1.3/src/PyCosmo/Obs.py → pycosmo-2.2.1/src/PyCosmo/obs.py +50 -43
  75. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/optimize_nq.py +2 -2
  76. PyCosmo-2.1.3/src/PyCosmo/Projection.py → pycosmo-2.2.1/src/PyCosmo/projection.py +45 -21
  77. pycosmo-2.2.1/src/PyCosmo.egg-info/PKG-INFO +55 -0
  78. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo.egg-info/SOURCES.txt +22 -24
  79. pycosmo-2.2.1/src/PyCosmo.egg-info/requires.txt +10 -0
  80. PyCosmo-2.1.3/PKG-INFO +0 -69
  81. PyCosmo-2.1.3/README.rst +0 -18
  82. PyCosmo-2.1.3/pyproject.toml +0 -45
  83. PyCosmo-2.1.3/setup.cfg +0 -79
  84. PyCosmo-2.1.3/setup.py +0 -30
  85. PyCosmo-2.1.3/src/PyCosmo/LinearPerturbationTable.py +0 -174
  86. PyCosmo-2.1.3/src/PyCosmo/NonLinearPerturbationTable.py +0 -163
  87. PyCosmo-2.1.3/src/PyCosmo/_Tables.py +0 -300
  88. PyCosmo-2.1.3/src/PyCosmo.egg-info/PKG-INFO +0 -69
  89. PyCosmo-2.1.3/src/PyCosmo.egg-info/requires.txt +0 -28
  90. PyCosmo-2.1.3/tests/test_background.py +0 -410
  91. PyCosmo-2.1.3/tests/test_boltzmann_solver.py +0 -841
  92. PyCosmo-2.1.3/tests/test_class.py +0 -200
  93. PyCosmo-2.1.3/tests/test_core_files_imports.py +0 -57
  94. PyCosmo-2.1.3/tests/test_cosmo.py +0 -48
  95. PyCosmo-2.1.3/tests/test_cython_extensions.py +0 -49
  96. PyCosmo-2.1.3/tests/test_ini_handling.py +0 -45
  97. PyCosmo-2.1.3/tests/test_linear_perturbation_approx.py +0 -259
  98. PyCosmo-2.1.3/tests/test_massive_neutrinos.py +0 -176
  99. PyCosmo-2.1.3/tests/test_nonlinear_perturbation_halofit.py +0 -132
  100. PyCosmo-2.1.3/tests/test_nonlinear_perturbation_mead.py +0 -218
  101. PyCosmo-2.1.3/tests/test_obs.py +0 -781
  102. PyCosmo-2.1.3/tests/test_perturbation_table.py +0 -84
  103. PyCosmo-2.1.3/tests/test_pickling.py +0 -25
  104. PyCosmo-2.1.3/tests/test_pycosmo.py +0 -112
  105. PyCosmo-2.1.3/tests/test_recombination.py +0 -19
  106. PyCosmo-2.1.3/tests/test_scipy_solver.py +0 -93
  107. PyCosmo-2.1.3/tests/test_util.py +0 -40
  108. {PyCosmo-2.1.3 → pycosmo-2.2.1}/LICENSE +0 -0
  109. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/BoltzmannSolver/__init__.py +0 -0
  110. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/PerturbationBase.py +0 -0
  111. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/_Cosmics.py +0 -0
  112. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/constf.c +0 -0
  113. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/halo_integral.pyx +1 -1
  114. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/main.c +0 -0
  115. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/protos.h +0 -0
  116. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/cython/sici.h +0 -0
  117. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/disable_multithreading.py +0 -0
  118. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/ini_handling.py +0 -0
  119. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/patches.py +0 -0
  120. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo/predefined_k_grids.py +0 -0
  121. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo.egg-info/dependency_links.txt +0 -0
  122. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo.egg-info/entry_points.txt +0 -0
  123. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo.egg-info/not-zip-safe +0 -0
  124. {PyCosmo-2.1.3 → pycosmo-2.2.1}/src/PyCosmo.egg-info/top_level.txt +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
-
@@ -0,0 +1 @@
1
+ prune tests
pycosmo-2.2.1/PKG-INFO ADDED
@@ -0,0 +1,55 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyCosmo
3
+ Version: 2.2.1
4
+ Summary: A multi-purpose cosmology calculation tool
5
+ Author-email: Uwe Schmitt et al <uwe.schmitt@id.ethz.ch>
6
+ License: GPLv3
7
+ Project-URL: Source, https://cosmo-docs.phys.ethz.ch/PyCosmo
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
12
+ Classifier: Natural Language :: English
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: C
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown; charset=UTF-8
23
+ License-File: LICENSE
24
+ License-File: AUTHORS.rst
25
+ Requires-Dist: numpy>=2
26
+ Requires-Dist: recfast4py>=0.2.3
27
+ Requires-Dist: dill
28
+ Requires-Dist: matplotlib
29
+ Requires-Dist: numba>=0.60
30
+ Requires-Dist: sympy2c>=2.3.1
31
+ Requires-Dist: numexpr>=2.10
32
+ Requires-Dist: scipy
33
+ Requires-Dist: setuptools>=75.6.0
34
+ Requires-Dist: mpmath==1.3
35
+ Dynamic: license-file
36
+
37
+ # PyCosmo
38
+
39
+ PyCosmo is a multi-purpose cosmology calculation tool in Python. It is
40
+ designed to be interactive and user friendly.
41
+
42
+ The code includes calculations of:
43
+ - Background
44
+ - Linear perturbations (incl. fitting functions and a Boltzmann solver)
45
+ - Non-linear perturbations
46
+ - Series of observables (e.g., weak lensing and galaxy clustering
47
+ power spectrum, ...)
48
+ - Several model extensions (massive neutrinos, wCDM, ...)
49
+
50
+
51
+ The code documentation can be found at
52
+ [https://cosmo-docs.phys.ethz.ch/PyCosmo](https://cosmo-docs.phys.ethz.ch/PyCosmo)
53
+
54
+ Interactive tutorial notebooks are available on the
55
+ [PyCosmoHUB](https://pycosmohub.com).
@@ -0,0 +1,19 @@
1
+ # PyCosmo
2
+
3
+ PyCosmo is a multi-purpose cosmology calculation tool in Python. It is
4
+ designed to be interactive and user friendly.
5
+
6
+ The code includes calculations of:
7
+ - Background
8
+ - Linear perturbations (incl. fitting functions and a Boltzmann solver)
9
+ - Non-linear perturbations
10
+ - Series of observables (e.g., weak lensing and galaxy clustering
11
+ power spectrum, ...)
12
+ - Several model extensions (massive neutrinos, wCDM, ...)
13
+
14
+
15
+ The code documentation can be found at
16
+ [https://cosmo-docs.phys.ethz.ch/PyCosmo](https://cosmo-docs.phys.ethz.ch/PyCosmo)
17
+
18
+ Interactive tutorial notebooks are available on the
19
+ [PyCosmoHUB](https://pycosmohub.com).
@@ -0,0 +1,113 @@
1
+ [build-system]
2
+ requires = ["setuptools >= 64", "numpy", "Cython"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+
6
+ [project]
7
+ name = "PyCosmo"
8
+ version = "2.2.1"
9
+ license = {text = "GPLv3"}
10
+ description = "A multi-purpose cosmology calculation tool"
11
+ authors = [{name = "Uwe Schmitt et al", email = "uwe.schmitt@id.ethz.ch"}]
12
+ classifiers = [
13
+ "Development Status :: 4 - Beta",
14
+ "Intended Audience :: Developers",
15
+ "Intended Audience :: Science/Research",
16
+ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
17
+ "Natural Language :: English",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: C",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.9",
25
+ "Topic :: Scientific/Engineering :: Astronomy",
26
+ ]
27
+
28
+ urls = {Source = "https://cosmo-docs.phys.ethz.ch/PyCosmo"}
29
+ requires-python = ">=3.10"
30
+ dependencies = [
31
+ "numpy>=2",
32
+ "recfast4py>=0.2.3",
33
+ "dill",
34
+ "matplotlib",
35
+ "numba>=0.60",
36
+ "sympy2c>=2.3.1",
37
+ "numexpr>=2.10",
38
+ "scipy",
39
+ "setuptools>=75.6.0",
40
+ "mpmath==1.3",
41
+ ]
42
+
43
+ [project.readme]
44
+ file = "README.md"
45
+ content-type = "text/markdown; charset=UTF-8"
46
+
47
+ [dependency-groups]
48
+ dev = [
49
+ "Cython",
50
+ "twine",
51
+ "pytest",
52
+ "pytest-cov",
53
+ "pytest-regtest>=2.2.0a2",
54
+ "ruff",
55
+ "isort",
56
+ "pre-commit",
57
+ "pdbp>=1.7.1",
58
+ ]
59
+
60
+ docs = [
61
+ "sphinx < 7",
62
+ "sphinx-pynpoint-theme",
63
+ "myst-parser",
64
+ ]
65
+
66
+ [project.scripts]
67
+ recompile = "PyCosmo:Cosmo.recompile_from_cli"
68
+
69
+ [tool.setuptools]
70
+ zip-safe = false
71
+ include-package-data = true
72
+
73
+ [tool.setuptools.package-data]
74
+ "*" = [
75
+ "*.pyx",
76
+ "*.c",
77
+ "*.h",
78
+ "config/*.ini",
79
+ ]
80
+
81
+
82
+ [tool.ruff]
83
+ line-length = 88
84
+ extend-exclude = ["benchmarks/", "*.ipynb"]
85
+
86
+ [tool.ruff.format]
87
+ quote-style = "double"
88
+ line-ending = "lf"
89
+ docstring-code-format = false
90
+
91
+ [tool.ruff.lint]
92
+ extend-select = [
93
+ "RUF100", # unnecessary `noqa` directives
94
+ ]
95
+ ignore = [
96
+ "E501",
97
+ "E731", # lambda assignment
98
+ "E741", # ambiguous variable name
99
+ ]
100
+
101
+ [tool.ruff.lint.per-file-ignores]
102
+ '__init__.py' = [
103
+ "F401", # imported but unused
104
+ ]
105
+
106
+
107
+ [tool.pytest.ini_options]
108
+ testpaths = ["tests"]
109
+ addopts = ["--verbose", "--durations=0", "--durations-min=5"]
110
+ markers = [
111
+ "slow: Marks tests as slow to run. Pass `--runslow` to include them."
112
+ ]
113
+ console_output_style = "count"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
pycosmo-2.2.1/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
+ )
@@ -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()
@@ -16,7 +16,6 @@
16
16
 
17
17
  import itertools
18
18
  import warnings
19
- from datetime import datetime
20
19
  from functools import lru_cache
21
20
  from multiprocessing import current_process
22
21
 
@@ -26,8 +25,9 @@ from ..LinearPerturbationBase import LinearPerturbationBase
26
25
  from .Fields import Fields
27
26
  from .LsodaSolver import LsodaSolver
28
27
 
28
+
29
29
  # use decorator to print messages only once per model:
30
- @lru_cache(maxsize=1) # noqa: E302
30
+ @lru_cache(maxsize=1)
31
31
  def print_new_traces(cache_file):
32
32
  print()
33
33
  print("new traces detected! you might want to run")
@@ -38,36 +38,6 @@ def print_new_traces(cache_file):
38
38
  proc_name = current_process().name
39
39
 
40
40
 
41
- def trace_call(frame, event, arg):
42
- if proc_name.endswith("-2"):
43
- return trace_call
44
- if event in ("line",):
45
- return trace_call
46
- fname = frame.f_code.co_filename
47
- if any(
48
- n in fname
49
- for n in (
50
- "pprint",
51
- "dill",
52
- "pickle",
53
- "numba",
54
- "logging",
55
- "ini_handling",
56
- "llvmlite",
57
- "traceback",
58
- "weakref",
59
- )
60
- ):
61
- return trace_call
62
- print(datetime.now(), end=" ")
63
- fr = frame
64
- print(proc_name, f"{event:8s}", end="")
65
- while (fr := fr.f_back) is not None:
66
- print(" ", end="")
67
- print(fname, frame.f_code.co_name, frame.f_lineno, flush=True)
68
- return trace_call
69
-
70
-
71
41
  class LinearPerturbationBoltzmann(LinearPerturbationBase):
72
42
  """
73
43
  Class for computing linear perturbations by solving the Einstein-Boltzmann ODE
@@ -196,9 +166,7 @@ class LinearPerturbationBoltzmann(LinearPerturbationBase):
196
166
  pk = norm * growth**2 * k**self._params.n * T_k**2
197
167
  else:
198
168
  # 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
- )
169
+ pk = norm * growth**2 * (k**self._params.n * T_k**2).reshape(-1, 1)
202
170
 
203
171
  if (self._params.pk_norm_type == "A_s") or (
204
172
  self._params.pk_norm_type == "sigma8"
@@ -363,9 +331,9 @@ class LinearPerturbationBoltzmann(LinearPerturbationBase):
363
331
 
364
332
  :return: D(a): growth factor normalised to 1 at a=1 [1]
365
333
  """
366
- assert (
367
- k is not None
368
- ), "growth factor of Einstein-Boltzmann model requires a k value"
334
+ assert k is not None, (
335
+ "growth factor of Einstein-Boltzmann model requires a k value"
336
+ )
369
337
  # TODO: add option where D is normalised to a in matter dominated era
370
338
  grid = np.log(np.atleast_1d(a))
371
339
  if grid[-1] != 0.0:
@@ -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__(
@@ -301,7 +300,7 @@ def merge(wrapper, t_0, t_switch, t_1, y_0, y_1): # pragma: no cover
301
300
  + a
302
301
  * H_Mpc
303
302
  * wrapper.taudot_interp_ufunc(a)
304
- / k**2
303
+ / k** 2
305
304
  * (
306
305
  u_b
307
306
  - k / (a * H_Mpc) * wrapper.c_s_interp_ufunc(a) ** 2 * delta_b
@@ -16,6 +16,8 @@
16
16
 
17
17
  # pragma: no cover
18
18
 
19
+ # ruff: noqa
20
+
19
21
  import sympy as sp
20
22
  from sympy2c import (
21
23
  ERROR,
@@ -141,9 +143,7 @@ omega_l_a = IfThenElse(flat_universe, (1 - omega_m - omega_r), omega_l)
141
143
  omega_k = 1 - omega_m - omega_r - omega_l_a
142
144
 
143
145
  # Friedmann equation
144
- H = H0 * (omega_r * a**-4 + omega_m * a**-3 + omega_k * a**-2 + omega_l_a) ** (
145
- 1 / 2
146
- )
146
+ H = H0 * (omega_r * a**-4 + omega_m * a**-3 + omega_k * a**-2 + omega_l_a) ** (1 / 2)
147
147
 
148
148
  R = (3 / 4) * omega_b / omega_gamma * a
149
149
 
@@ -522,14 +522,10 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R, l_max=l_max):
522
522
  dTheta_dlan[0] = -k_H * Theta[1] - dPhi_dlan # 0th photon multipole
523
523
  dTheta_dlan[1] = k_H / 3 * (Theta[0] - 2 * Theta[2] + Psi) + taudot_interp(a) / (
524
524
  a * H
525
- ) * (
526
- Theta[1] - u_b / 3
527
- ) # 1st photon multipole
525
+ ) * (Theta[1] - u_b / 3) # 1st photon multipole
528
526
  dTheta_dlan[2] = k_H / 5 * (2 * Theta[1] - 3 * Theta[3]) + taudot_interp(a) / (
529
527
  a * H
530
- ) * (
531
- Theta[2] - Pi / 10
532
- ) # 2nd photon multipole
528
+ ) * (Theta[2] - Pi / 10) # 2nd photon multipole
533
529
 
534
530
  dTheta_P_dlan[0] = k_H / 1 * -Theta_P[1] + taudot_interp(a) / (a * H) * (
535
531
  Theta_P[0] - Pi / 2
@@ -540,9 +536,7 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R, l_max=l_max):
540
536
  ) # 1st photon polarization multipole
541
537
  dTheta_P_dlan[2] = k_H / 5 * (2 * Theta_P[1] - 3 * Theta_P[3]) + taudot_interp(
542
538
  a
543
- ) / (a * H) * (
544
- Theta_P[2] - Pi / 10
545
- ) # 2nd photon polarization multipole
539
+ ) / (a * H) * (Theta_P[2] - Pi / 10) # 2nd photon polarization multipole
546
540
 
547
541
  for l in range(3, l_max): # lth photons multipoles
548
542
  dTheta_dlan[l] = (
@@ -15,6 +15,9 @@
15
15
  # program. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
17
 
18
+ # pragma: no cover
19
+ # ruff: noqa
20
+
18
21
  import numpy as np
19
22
  import sympy as sp
20
23
  from sympy2c import (
@@ -121,6 +124,7 @@ globals_ = Globals(
121
124
  T_mnu,
122
125
  )
123
126
 
127
+
124
128
  # check functions used to impose conditions
125
129
  # on the parameters
126
130
  def check_massive_nu_total_mass(params):
@@ -767,14 +771,10 @@ def rhs(H=H_Mpc, H0=H0_Mpc, amnu=amnu):
767
771
  dTheta_dlan[0] = -k_H * Theta[1] - dPhi_dlan # 0th photon multipole
768
772
  dTheta_dlan[1] = k_H / 3 * (Theta[0] - 2 * Theta[2] + Psi) + taudot_interp(a) / (
769
773
  a * H
770
- ) * (
771
- Theta[1] - u_b / 3
772
- ) # 1st photon multipole
774
+ ) * (Theta[1] - u_b / 3) # 1st photon multipole
773
775
  dTheta_dlan[2] = k_H / 5 * (2 * Theta[1] - 3 * Theta[3]) + taudot_interp(a) / (
774
776
  a * H
775
- ) * (
776
- Theta[2] - Pi / 10
777
- ) # 2nd photon multipole
777
+ ) * (Theta[2] - Pi / 10) # 2nd photon multipole
778
778
 
779
779
  dTheta_P_dlan[0] = k_H / 1 * -Theta_P[1] + taudot_interp(a) / (a * H) * (
780
780
  Theta_P[0] - Pi / 2
@@ -785,9 +785,7 @@ def rhs(H=H_Mpc, H0=H0_Mpc, amnu=amnu):
785
785
  ) # 1st photon polarization multipole
786
786
  dTheta_P_dlan[2] = k_H / 5 * (2 * Theta_P[1] - 3 * Theta_P[3]) + taudot_interp(
787
787
  a
788
- ) / (a * H) * (
789
- Theta_P[2] - Pi / 10
790
- ) # 2nd photon polarization multipole
788
+ ) / (a * H) * (Theta_P[2] - Pi / 10) # 2nd photon polarization multipole
791
789
 
792
790
  for l in range(3, l_max): # lth photons multipoles
793
791
  dTheta_dlan[l] = (
@@ -845,7 +843,6 @@ def rhs(H=H_Mpc, H0=H0_Mpc, amnu=amnu):
845
843
 
846
844
  for m in range(2, l_max_mnu):
847
845
  for j in range(nq):
848
-
849
846
  dM_dlan[m * nq + j] = (
850
847
  qq[j]
851
848
  * k
@@ -862,10 +859,7 @@ def rhs(H=H_Mpc, H0=H0_Mpc, amnu=amnu):
862
859
  1
863
860
  / (a * H)
864
861
  * (
865
- qq[j]
866
- * k
867
- / sp.sqrt(amnu**2 + qq[j] ** 2)
868
- * M[(l_max_mnu - 1) * nq + j]
862
+ qq[j] * k / sp.sqrt(amnu**2 + qq[j] ** 2) * M[(l_max_mnu - 1) * nq + j]
869
863
  - (l_max_mnu + 1) / eta_interp(a) * M[l_max_mnu * nq + j]
870
864
  )
871
865
  )
@@ -14,6 +14,10 @@
14
14
  # You should have received a copy of the GNU General Public License along with this
15
15
  # program. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
+
18
+ # pragma: no cover
19
+ # ruff: noqa
20
+
17
21
  from CosmologyCore_massivenu import *
18
22
  from sympy2c import OdeCombined
19
23
 
@@ -140,7 +144,6 @@ def rhs_rsa(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu, l_max=2):
140
144
  # lth multipoles massive neutrinos
141
145
  for m in range(2, l_max_mnu):
142
146
  for j in range(nq):
143
-
144
147
  dM_dlan[m * nq + j] = (
145
148
  qq[j]
146
149
  * k
@@ -153,10 +156,7 @@ def rhs_rsa(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu, l_max=2):
153
156
  1
154
157
  / (a * H)
155
158
  * (
156
- qq[j]
157
- * k
158
- / sp.sqrt(amnu**2 + qq[j] ** 2)
159
- * M[(l_max_mnu - 1) * nq + j]
159
+ qq[j] * k / sp.sqrt(amnu**2 + qq[j] ** 2) * M[(l_max_mnu - 1) * nq + j]
160
160
  - (l_max_mnu + 1) / eta_interp(a) * M[l_max_mnu * nq + j]
161
161
  )
162
162
  )
@@ -232,13 +232,7 @@ def merge(wrapper, t_0, t_switch, t_1, y_0, y_1): # pragma: no cover
232
232
  T_0 = Tcmb * T_mnu
233
233
  amnu = a * massive_nu_total_mass / (N_massive_nu * kb * T_0)
234
234
  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
235
+ 3 * H0**2 * (hbar) ** 3 * c_ms**3 / (8 * np.pi * G) / evc2 / (mpc / 1000) ** 2
242
236
  ) / (kb * T_0) ** 4
243
237
  C_nu = N_massive_nu / (2 * np.pi) ** 2 / rho_ev
244
238
 
@@ -14,6 +14,8 @@
14
14
  # You should have received a copy of the GNU General Public License along with this
15
15
  # program. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
+ # pragma: no cover
18
+ # ruff: noqa
17
19
 
18
20
  import numpy as np
19
21
  import sympy as sp
@@ -129,6 +131,7 @@ globals_ = Globals(
129
131
  cs_de2,
130
132
  )
131
133
 
134
+
132
135
  # check functions used to impose conditions
133
136
  # on the parameters
134
137
  def check_massive_nu_total_mass(params):
@@ -816,14 +819,10 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu):
816
819
  dTheta_dlan[0] = -k_H * Theta[1] - dPhi_dlan # 0th photon multipole
817
820
  dTheta_dlan[1] = k_H / 3 * (Theta[0] - 2 * Theta[2] + Psi) + taudot_interp(a) / (
818
821
  a * H
819
- ) * (
820
- Theta[1] - u_b / 3
821
- ) # 1st photon multipole
822
+ ) * (Theta[1] - u_b / 3) # 1st photon multipole
822
823
  dTheta_dlan[2] = k_H / 5 * (2 * Theta[1] - 3 * Theta[3]) + taudot_interp(a) / (
823
824
  a * H
824
- ) * (
825
- Theta[2] - Pi / 10
826
- ) # 2nd photon multipole
825
+ ) * (Theta[2] - Pi / 10) # 2nd photon multipole
827
826
 
828
827
  dTheta_P_dlan[0] = k_H / 1 * -Theta_P[1] + taudot_interp(a) / (a * H) * (
829
828
  Theta_P[0] - Pi / 2
@@ -834,9 +833,7 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu):
834
833
  ) # 1st photon polarization multipole
835
834
  dTheta_P_dlan[2] = k_H / 5 * (2 * Theta_P[1] - 3 * Theta_P[3]) + taudot_interp(
836
835
  a
837
- ) / (a * H) * (
838
- Theta_P[2] - Pi / 10
839
- ) # 2nd photon polarization multipole
836
+ ) / (a * H) * (Theta_P[2] - Pi / 10) # 2nd photon polarization multipole
840
837
 
841
838
  for l in range(3, l_max): # lth photons multipoles
842
839
  dTheta_dlan[l] = (
@@ -894,7 +891,6 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu):
894
891
 
895
892
  for m in range(2, l_max_mnu):
896
893
  for j in range(nq):
897
-
898
894
  dM_dlan[m * nq + j] = (
899
895
  qq[j]
900
896
  * k
@@ -911,10 +907,7 @@ def rhs(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu):
911
907
  1
912
908
  / (a * H)
913
909
  * (
914
- qq[j]
915
- * k
916
- / sp.sqrt(amnu**2 + qq[j] ** 2)
917
- * M[(l_max_mnu - 1) * nq + j]
910
+ qq[j] * k / sp.sqrt(amnu**2 + qq[j] ** 2) * M[(l_max_mnu - 1) * nq + j]
918
911
  - (l_max_mnu + 1) / eta_interp(a) * M[l_max_mnu * nq + j]
919
912
  )
920
913
  )
@@ -14,6 +14,9 @@
14
14
  # You should have received a copy of the GNU General Public License along with this
15
15
  # program. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
+ # pragma: no cover
18
+ # ruff: noqa
19
+
17
20
  from CosmologyCore_massivenu_wcdm import *
18
21
  from sympy2c import OdeCombined
19
22
 
@@ -157,7 +160,6 @@ def rhs_rsa(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu, l_max=2):
157
160
  # lth multipoles massive neutrinos
158
161
  for m in range(2, l_max_mnu):
159
162
  for j in range(nq):
160
-
161
163
  dM_dlan[m * nq + j] = (
162
164
  qq[j]
163
165
  * k
@@ -170,10 +172,7 @@ def rhs_rsa(H=H_Mpc, H0=H0_Mpc, R=R, amnu=amnu, l_max=2):
170
172
  1
171
173
  / (a * H)
172
174
  * (
173
- qq[j]
174
- * k
175
- / sp.sqrt(amnu**2 + qq[j] ** 2)
176
- * M[(l_max_mnu - 1) * nq + j]
175
+ qq[j] * k / sp.sqrt(amnu**2 + qq[j] ** 2) * M[(l_max_mnu - 1) * nq + j]
177
176
  - (l_max_mnu + 1) / eta_interp(a) * M[l_max_mnu * nq + j]
178
177
  )
179
178
  )
@@ -256,13 +255,7 @@ def merge(wrapper, t_0, t_switch, t_1, y_0, y_1): # pragma: no cover
256
255
  T_0 = Tcmb * T_mnu
257
256
  amnu = a * massive_nu_total_mass / (N_massive_nu * kb * T_0)
258
257
  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
258
+ 3 * H0**2 * (hbar) ** 3 * c_ms**3 / (8 * np.pi * G) / evc2 / (mpc / 1000) ** 2
266
259
  ) / (kb * T_0) ** 4
267
260
  C_nu = N_massive_nu / (2 * np.pi) ** 2 / rho_ev
268
261
 
@@ -15,6 +15,7 @@
15
15
  # program. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
17
  # pragma: no cover
18
+ # ruff: noqa
18
19
 
19
20
  from CosmologyCore import *
20
21
  from sympy2c import OdeCombined