CosmoWAP 0.7.0__tar.gz → 0.7.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 (100) hide show
  1. cosmowap-0.7.1/PKG-INFO +122 -0
  2. cosmowap-0.7.1/README.md +95 -0
  3. {cosmowap-0.7.0 → cosmowap-0.7.1}/pyproject.toml +1 -1
  4. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/HOD/hmf.py +59 -11
  5. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/HOD/hods.py +8 -7
  6. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/HOD/peak_background_bias.py +29 -43
  7. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/WSGR.py +3 -0
  8. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/combined.py +6 -0
  9. cosmowap-0.7.1/src/cosmo_wap/bk_mt/combined.py +59 -0
  10. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/forecast/base_posterior.py +48 -16
  11. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/forecast/core.py +122 -90
  12. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/forecast/covariances.py +160 -72
  13. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/forecast/fisher.py +122 -4
  14. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/forecast/fisher_list.py +5 -0
  15. cosmowap-0.7.1/src/cosmo_wap/forecast/forecast.py +1044 -0
  16. cosmowap-0.7.1/src/cosmo_wap/forecast/sampler.py +845 -0
  17. cosmowap-0.7.1/src/cosmo_wap/lib/__init__.py +12 -0
  18. cosmowap-0.7.1/src/cosmo_wap/lib/lf_priors.py +223 -0
  19. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/lib/luminosity_funcs.py +76 -50
  20. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/lib/utils.py +35 -0
  21. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/main.py +59 -112
  22. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/numeric_mu/pk.py +36 -18
  23. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/pk/combined.py +37 -3
  24. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/pk/covRR.py +29 -29
  25. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/pk/covWS.py +22 -22
  26. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/pk/covWSGR.py +29 -29
  27. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/survey_params.py +60 -54
  28. cosmowap-0.7.1/src/cosmowap.egg-info/PKG-INFO +122 -0
  29. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmowap.egg-info/SOURCES.txt +2 -0
  30. {cosmowap-0.7.0 → cosmowap-0.7.1}/tests/test_compute_bias.py +1 -1
  31. {cosmowap-0.7.0 → cosmowap-0.7.1}/tests/test_fisher.py +47 -0
  32. cosmowap-0.7.0/PKG-INFO +0 -117
  33. cosmowap-0.7.0/README.md +0 -90
  34. cosmowap-0.7.0/src/cosmo_wap/forecast/forecast.py +0 -649
  35. cosmowap-0.7.0/src/cosmo_wap/forecast/sampler.py +0 -512
  36. cosmowap-0.7.0/src/cosmo_wap/lib/__init__.py +0 -3
  37. cosmowap-0.7.0/src/cosmowap.egg-info/PKG-INFO +0 -117
  38. {cosmowap-0.7.0 → cosmowap-0.7.1}/LICENSE.txt +0 -0
  39. {cosmowap-0.7.0 → cosmowap-0.7.1}/setup.cfg +0 -0
  40. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/HOD/AbacusSummit_base_c000_ph000_best_params.txt +0 -0
  41. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/HOD/__init__.py +0 -0
  42. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/__init__.py +0 -0
  43. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/GR0.py +0 -0
  44. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/GR1.py +0 -0
  45. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/GR2.py +0 -0
  46. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/GR_0.py +0 -0
  47. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/GR_1.py +0 -0
  48. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/GR_2.py +0 -0
  49. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/PNG.py +0 -0
  50. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/PNG_.py +0 -0
  51. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/RR1.py +0 -0
  52. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/RR2.py +0 -0
  53. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/RR_1.py +0 -0
  54. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/WA1.py +0 -0
  55. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/WA2.py +0 -0
  56. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/WARR.py +0 -0
  57. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/WA_1.py +0 -0
  58. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/WA_2.py +0 -0
  59. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/__init__.py +0 -0
  60. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/bk_int.py +0 -0
  61. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk/cov.py +0 -0
  62. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk_mt/GR0.py +0 -0
  63. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk_mt/GR1.py +0 -0
  64. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk_mt/GR2.py +0 -0
  65. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk_mt/PNG.py +0 -0
  66. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/bk_mt/__init__.py +0 -0
  67. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/data_library/SKAO1Data.txt +0 -0
  68. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/data_library/SKAO2Data.txt +0 -0
  69. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/data_library/k_modes.txt +0 -0
  70. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/data_library/snr_surveyparams.txt +0 -0
  71. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/forecast/__init__.py +0 -0
  72. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/forecast/mpi_mcmc.py +0 -0
  73. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/lib/angular_integrate.py +0 -0
  74. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/lib/betas.py +0 -0
  75. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/lib/bk_plots.py +0 -0
  76. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/lib/integrated.py +0 -0
  77. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/lib/unpack.py +0 -0
  78. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/numeric_mu/__init__.py +0 -0
  79. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/numeric_mu/bk_int.py +0 -0
  80. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/numeric_mu/integration.py +0 -0
  81. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/numeric_mu/kernels.py +0 -0
  82. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/numeric_mu/utils.py +0 -0
  83. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/pk/IxS_components.py +0 -0
  84. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/pk/PNG.py +0 -0
  85. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/pk/Pk_0.py +0 -0
  86. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/pk/Pk_WS.py +0 -0
  87. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/pk/Pk_WSGR.py +0 -0
  88. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/pk/__init__.py +0 -0
  89. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/pk/cov.py +0 -0
  90. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/pk/int.py +0 -0
  91. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmo_wap/pk/int_components.py +0 -0
  92. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmowap.egg-info/dependency_links.txt +0 -0
  93. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmowap.egg-info/requires.txt +0 -0
  94. {cosmowap-0.7.0 → cosmowap-0.7.1}/src/cosmowap.egg-info/top_level.txt +0 -0
  95. {cosmowap-0.7.0 → cosmowap-0.7.1}/tests/test_bk_multipoles.py +0 -0
  96. {cosmowap-0.7.0 → cosmowap-0.7.1}/tests/test_forecast.py +0 -0
  97. {cosmowap-0.7.0 → cosmowap-0.7.1}/tests/test_luminosity_funcs.py +0 -0
  98. {cosmowap-0.7.0 → cosmowap-0.7.1}/tests/test_pk_multipoles.py +0 -0
  99. {cosmowap-0.7.0 → cosmowap-0.7.1}/tests/test_survey_params.py +0 -0
  100. {cosmowap-0.7.0 → cosmowap-0.7.1}/tests/test_utils.py +0 -0
@@ -0,0 +1,122 @@
1
+ Metadata-Version: 2.4
2
+ Name: cosmowap
3
+ Version: 0.7.1
4
+ Summary: A package for forecasting with the galaxy clustering power spectra and bispectra
5
+ Author-email: Chris Addis <c.l.j.addis@qmul.ac.uk>
6
+ License: MIT
7
+ Project-URL: homepage, https://github.com/craddis1/CosmoWAP
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE.txt
14
+ Requires-Dist: numpy
15
+ Requires-Dist: scipy>=1.15.0
16
+ Requires-Dist: matplotlib
17
+ Requires-Dist: tqdm
18
+ Requires-Dist: cython
19
+ Requires-Dist: classy
20
+ Requires-Dist: chainconsumer
21
+ Requires-Dist: cobaya
22
+ Provides-Extra: dev
23
+ Requires-Dist: ruff; extra == "dev"
24
+ Requires-Dist: pytest; extra == "dev"
25
+ Requires-Dist: pre-commit; extra == "dev"
26
+ Dynamic: license-file
27
+
28
+ # CosmoWAP
29
+ ```
30
+ ______ _ _____ ____
31
+ / ____/___ _________ ___ ____| | / / | / __ \
32
+ / / / __ \/ ___/ __ `__ \/ __ \ | /| / / /| | / /_/ /
33
+ / /___/ /_/ (__ ) / / / / / /_/ / |/ |/ / ___ |/ ____/
34
+ \____/\____/____/_/ /_/ /_/\____/|__/|__/_/ |_/_/
35
+
36
+ ```
37
+
38
+ [![PyPI version](https://img.shields.io/pypi/v/cosmowap)](https://pypi.org/project/cosmowap/)
39
+ [![Licence](https://img.shields.io/github/license/craddis1/CosmoWAP?label=licence&style=flat-square&color=informational)](https://github.com/craddis1/CosmoWAP/blob/main/LICENCE)
40
+ [![Docs](https://img.shields.io/readthedocs/cosmowap/latest?logo=ReadtheDocs)](https://readthedocs.org/projects/cosmowap/builds/)
41
+ [![Codacy Badge](https://app.codacy.com/project/badge/Grade/fcc0f69852984e01b101fc56d67c43f4)](https://app.codacy.com/gh/craddis1/CosmoWAP/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
42
+ [![ASCL](https://img.shields.io/badge/ascl-2507.020-blue.svg?colorB=262255)](https://ascl.net/2507.020)
43
+ [![PyPI Downloads](https://static.pepy.tech/personalized-badge/cosmowap?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=MAGENTA&left_text=downloads)](https://pepy.tech/projects/cosmowap)
44
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
45
+
46
+ **Cosmo**logy with **W**ide-separation, rel**A**tivistic and **P**rimordial non-Gaussian contributions.
47
+
48
+ CosmoWAP is a project that has grown organically alongside several research works, taking an increasingly central role in their development. It is designed to be a flexible and user-friendly Python framework to enable quick and easy forecasts of large-scale galaxy clustering using 3D power spectrum and/or bispectrum multipoles.
49
+
50
+ The modelling covers several key areas: relativistic effects, wide-separation corrections, and Primordial non-Gaussianity (PNG) in standard perturbation theory. The core analytical expressions are derived in Mathematica (see [MathWAP](https://github.com/craddis1/MathWAP)) and stored as exported .py files for efficiency. These expressions ingest a cosmology (via CLASS) and a flexible set of bias models, and have been thoroughly validated with sanity checks and against existing literature results.
51
+
52
+ To enable realistic forecasts, the associated machinery has been built around the core: thorough bias modelling with HOD/luminosity functions, theoretical covariances, Fisher matrices, and MCMC modules. These tools are easily accessible and can be used flexibly for a wide range of survey scenarios.
53
+
54
+ ## [Documentation](https://cosmowap.readthedocs.io/en/latest/)
55
+
56
+ > [!NOTE]
57
+ > Note this is still in progress as this is an evolving repo!
58
+ > Occasionally parts will be outdated and will contain deprecated methods.
59
+
60
+ ## Installation
61
+
62
+ > [!NOTE]
63
+ > Requires at least Python >=3.10 for full functionality.
64
+ > For use of CosmoPower emulators we recommend using Python 3.10 or 3.11 - See Docs for full details.
65
+
66
+ ``` sh
67
+ pip install cosmowap
68
+
69
+ ```
70
+ For Development mode...
71
+
72
+ Clone repository:
73
+
74
+ ``` sh
75
+ git clone https://github.com/craddis1/CosmoWAP.git
76
+ ```
77
+ and then make editable install:
78
+ ``` sh
79
+ cd CosmoWAP
80
+ pip install -e .
81
+ ```
82
+
83
+ See requirements.txt for full list of dependencies (most are common python libraries). classy (CLASS python wrapper) is necessary to fully use CosmoWAP.
84
+
85
+ ## Features
86
+
87
+ **Core Observables**
88
+
89
+ 3D redshift space Fourier statistics: Multipoles and full line-of-sight (LOS) dependent expressions (fully multi-tracer compatible).
90
+
91
+ * **$P_{\ell}(k)$:** Legendre Power spectrum multipoles.
92
+ * **$B_{\ell,m}(k_1,k_2,k_3)$:** Scoccimarro Bispectrum multipoles (TriPosH extension to come).
93
+
94
+ ---
95
+
96
+ **Physical Contributions**
97
+ * **Wide-separation (WS) corrections:** Wide-angle and radial redshift contributions up to second order in the WS expansion.
98
+ * **Local Relativistic (GR) effects:** Projection and dynamical effects up to $(\mathcal{H}/k)^2$.
99
+ * **Integrated effects:** Lensing, ISW, and time delay contributions (currently implemented for the power spectrum only).
100
+ * **Primordial non-Gaussianity (PNG):** Contributions for local, equilateral, and orthogonal types — uses peak background split approach for biases.
101
+ * **Non-linearities:** Finger-of-God damping and non-linear `HaloFit`/`HMcode` $P(k)$.
102
+
103
+ ---
104
+
105
+ **Forecasting and Analysis**
106
+ * **Bias modelling:** Uses a range literature Luminosity Functions, HOD/HMF and peak-background split approach for different surveys.
107
+ * **Multi-tracer covariances:** Multipole covariances assuming Gaussianity for power spectrum (including wide-separation corrections) and bispectrum.
108
+ * **Forecasting modules:** Fisher matrices and MCMC capabilities through [`Cobaya`](https://github.com/CobayaSampler/cobaya) and emulated $P(k)$ with [`CosmoPower`](https://github.com/alessiospuriomancini/cosmopower).
109
+ * **Built-in plotting library:** Designed for exploring theoretical expressions, covariances and forecasts — plots of parameter posteriors implemented with [`ChainConsumer`](https://github.com/Samreay/ChainConsumer).
110
+
111
+ ## Usage
112
+
113
+ If you use CosmoWAP in your research, please cite the relevant papers:
114
+
115
+ * Original code: [arXiv:2407.00168](https://arxiv.org/abs/2407.00168)
116
+ * Integrated effects in the power spectrum and forecasting routines: [arXiv:2511.09466](https://arxiv.org/abs/2511.09466)
117
+ * PNG, HODs and forecasting routines : arXiv:26xx.xxxx
118
+
119
+
120
+ ## Contact
121
+
122
+ If you find any bugs or errors or have any questions and suggestions feel free to get in touch :) - c.l.j.addis@qmul.ac.uk
@@ -0,0 +1,95 @@
1
+ # CosmoWAP
2
+ ```
3
+ ______ _ _____ ____
4
+ / ____/___ _________ ___ ____| | / / | / __ \
5
+ / / / __ \/ ___/ __ `__ \/ __ \ | /| / / /| | / /_/ /
6
+ / /___/ /_/ (__ ) / / / / / /_/ / |/ |/ / ___ |/ ____/
7
+ \____/\____/____/_/ /_/ /_/\____/|__/|__/_/ |_/_/
8
+
9
+ ```
10
+
11
+ [![PyPI version](https://img.shields.io/pypi/v/cosmowap)](https://pypi.org/project/cosmowap/)
12
+ [![Licence](https://img.shields.io/github/license/craddis1/CosmoWAP?label=licence&style=flat-square&color=informational)](https://github.com/craddis1/CosmoWAP/blob/main/LICENCE)
13
+ [![Docs](https://img.shields.io/readthedocs/cosmowap/latest?logo=ReadtheDocs)](https://readthedocs.org/projects/cosmowap/builds/)
14
+ [![Codacy Badge](https://app.codacy.com/project/badge/Grade/fcc0f69852984e01b101fc56d67c43f4)](https://app.codacy.com/gh/craddis1/CosmoWAP/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
15
+ [![ASCL](https://img.shields.io/badge/ascl-2507.020-blue.svg?colorB=262255)](https://ascl.net/2507.020)
16
+ [![PyPI Downloads](https://static.pepy.tech/personalized-badge/cosmowap?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=MAGENTA&left_text=downloads)](https://pepy.tech/projects/cosmowap)
17
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
18
+
19
+ **Cosmo**logy with **W**ide-separation, rel**A**tivistic and **P**rimordial non-Gaussian contributions.
20
+
21
+ CosmoWAP is a project that has grown organically alongside several research works, taking an increasingly central role in their development. It is designed to be a flexible and user-friendly Python framework to enable quick and easy forecasts of large-scale galaxy clustering using 3D power spectrum and/or bispectrum multipoles.
22
+
23
+ The modelling covers several key areas: relativistic effects, wide-separation corrections, and Primordial non-Gaussianity (PNG) in standard perturbation theory. The core analytical expressions are derived in Mathematica (see [MathWAP](https://github.com/craddis1/MathWAP)) and stored as exported .py files for efficiency. These expressions ingest a cosmology (via CLASS) and a flexible set of bias models, and have been thoroughly validated with sanity checks and against existing literature results.
24
+
25
+ To enable realistic forecasts, the associated machinery has been built around the core: thorough bias modelling with HOD/luminosity functions, theoretical covariances, Fisher matrices, and MCMC modules. These tools are easily accessible and can be used flexibly for a wide range of survey scenarios.
26
+
27
+ ## [Documentation](https://cosmowap.readthedocs.io/en/latest/)
28
+
29
+ > [!NOTE]
30
+ > Note this is still in progress as this is an evolving repo!
31
+ > Occasionally parts will be outdated and will contain deprecated methods.
32
+
33
+ ## Installation
34
+
35
+ > [!NOTE]
36
+ > Requires at least Python >=3.10 for full functionality.
37
+ > For use of CosmoPower emulators we recommend using Python 3.10 or 3.11 - See Docs for full details.
38
+
39
+ ``` sh
40
+ pip install cosmowap
41
+
42
+ ```
43
+ For Development mode...
44
+
45
+ Clone repository:
46
+
47
+ ``` sh
48
+ git clone https://github.com/craddis1/CosmoWAP.git
49
+ ```
50
+ and then make editable install:
51
+ ``` sh
52
+ cd CosmoWAP
53
+ pip install -e .
54
+ ```
55
+
56
+ See requirements.txt for full list of dependencies (most are common python libraries). classy (CLASS python wrapper) is necessary to fully use CosmoWAP.
57
+
58
+ ## Features
59
+
60
+ **Core Observables**
61
+
62
+ 3D redshift space Fourier statistics: Multipoles and full line-of-sight (LOS) dependent expressions (fully multi-tracer compatible).
63
+
64
+ * **$P_{\ell}(k)$:** Legendre Power spectrum multipoles.
65
+ * **$B_{\ell,m}(k_1,k_2,k_3)$:** Scoccimarro Bispectrum multipoles (TriPosH extension to come).
66
+
67
+ ---
68
+
69
+ **Physical Contributions**
70
+ * **Wide-separation (WS) corrections:** Wide-angle and radial redshift contributions up to second order in the WS expansion.
71
+ * **Local Relativistic (GR) effects:** Projection and dynamical effects up to $(\mathcal{H}/k)^2$.
72
+ * **Integrated effects:** Lensing, ISW, and time delay contributions (currently implemented for the power spectrum only).
73
+ * **Primordial non-Gaussianity (PNG):** Contributions for local, equilateral, and orthogonal types — uses peak background split approach for biases.
74
+ * **Non-linearities:** Finger-of-God damping and non-linear `HaloFit`/`HMcode` $P(k)$.
75
+
76
+ ---
77
+
78
+ **Forecasting and Analysis**
79
+ * **Bias modelling:** Uses a range literature Luminosity Functions, HOD/HMF and peak-background split approach for different surveys.
80
+ * **Multi-tracer covariances:** Multipole covariances assuming Gaussianity for power spectrum (including wide-separation corrections) and bispectrum.
81
+ * **Forecasting modules:** Fisher matrices and MCMC capabilities through [`Cobaya`](https://github.com/CobayaSampler/cobaya) and emulated $P(k)$ with [`CosmoPower`](https://github.com/alessiospuriomancini/cosmopower).
82
+ * **Built-in plotting library:** Designed for exploring theoretical expressions, covariances and forecasts — plots of parameter posteriors implemented with [`ChainConsumer`](https://github.com/Samreay/ChainConsumer).
83
+
84
+ ## Usage
85
+
86
+ If you use CosmoWAP in your research, please cite the relevant papers:
87
+
88
+ * Original code: [arXiv:2407.00168](https://arxiv.org/abs/2407.00168)
89
+ * Integrated effects in the power spectrum and forecasting routines: [arXiv:2511.09466](https://arxiv.org/abs/2511.09466)
90
+ * PNG, HODs and forecasting routines : arXiv:26xx.xxxx
91
+
92
+
93
+ ## Contact
94
+
95
+ If you find any bugs or errors or have any questions and suggestions feel free to get in touch :) - c.l.j.addis@qmul.ac.uk
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cosmowap"
7
- version = "0.7.0"
7
+ version = "0.7.1"
8
8
  authors = [
9
9
  { name="Chris Addis", email="c.l.j.addis@qmul.ac.uk" },
10
10
  ]
@@ -6,7 +6,7 @@ Multiplicity functions:
6
6
  - Sheth-Tormen (arXiv:astro-ph/9901122)
7
7
 
8
8
  Halo Mass Function:
9
- - n_h(zz) - R, M, sigma_R are all defined/computed as arrays in ClassWAP
9
+ - n_h(zz) - R, M, sigma_R are all defined/computed as arrays in HMF
10
10
 
11
11
  Bias models:
12
12
  - Lagrangian bias from Numeric or analytic derivatives of multiplicity functions
@@ -16,11 +16,30 @@ from __future__ import annotations
16
16
 
17
17
  import numpy as np
18
18
  import scipy.special as sp
19
+ from scipy.integrate import simpson
20
+
21
+
22
+ def sigma_R_n(cosmo_funcs, R: np.ndarray, n: int, K_MIN: float = 5e-5, N_k: int = 200) -> np.ndarray:
23
+ """
24
+ Compute sigma^2 for a given radius and n, i.e. does integral over k.
25
+ Vectorised over R using Simpson's rule on a log-spaced k-grid.
26
+ """
27
+ k = np.logspace(np.log10(K_MIN), np.log10(cosmo_funcs.K_MAX), N_k)
28
+ pk_arr = np.array([cosmo_funcs.pk(ki) for ki in k])
29
+ kR = k[:, None] * R[None, :] # (Nk, NR)
30
+ W = 3.0 * (np.sin(kR) - kR * np.cos(kR)) / kR**3
31
+ integrand = k[:, None] ** (2 + n) * pk_arr[:, None] * W**2
32
+ return simpson(integrand, x=k, axis=0) / (2.0 * np.pi**2)
19
33
 
20
34
 
21
35
  class HMF:
22
36
  def __init__(self, cosmo_funcs, hmf="Tinker10"):
23
37
  self.cosmo_funcs = cosmo_funcs
38
+
39
+ # setup HMF prerequisites if not already computed
40
+ if not hasattr(cosmo_funcs, "delta_c"):
41
+ self._setup_hmf()
42
+
24
43
  self.delta_c = cosmo_funcs.delta_c
25
44
 
26
45
  # peak height (z,R)
@@ -38,6 +57,39 @@ class HMF:
38
57
  self
39
58
  ) # do numerics derivs of multiplicity - default is tinker2010 mass function
40
59
 
60
+ def _setup_hmf(self, R=None):
61
+ """
62
+ Setup for HMF stuff and store some computation - cosmology stuff
63
+ """
64
+ cf = self.cosmo_funcs
65
+ if R is None:
66
+ R = np.logspace(-1.5, 1.5, 100, dtype=np.float32) # radius [Mpc/h]
67
+ cf.R = R
68
+
69
+ # precompute sigma^2 - for HMF
70
+ cf.sigmaR0 = sigma_R_n(cf, R, 0)
71
+ cf.sigmaR1 = sigma_R_n(cf, R, -1)
72
+ cf.sigmaR2 = sigma_R_n(cf, R, -2)
73
+
74
+ # store sigmas as functions of (R,) for scalar z or (R,z) for array z
75
+ cf.sig_R = {}
76
+ cf.sig_R["0"] = lambda xx: cf.sigmaR0[:, None] * np.atleast_1d(cf.D(xx))[None, :] ** 2
77
+ cf.sig_R["1"] = lambda xx: cf.sigmaR1[:, None] * np.atleast_1d(cf.D(xx))[None, :] ** 2
78
+ cf.sig_R["2"] = lambda xx: cf.sigmaR2[:, None] * np.atleast_1d(cf.D(xx))[None, :] ** 2
79
+
80
+ cf.delta_c = 1.686 # from spherical collapse model
81
+
82
+ # for critical density
83
+ GG = 4.300917e-3 # [pc M_sun^-1 (km/s)^2]
84
+ G = GG / (1e6 * cf.c**2) # gravitational constant # [Mpc M_sun^-1]
85
+ cf.rho_crit = lambda xx: (
86
+ 3 * (cf.H_c(xx) * (1 + xx)) ** 2 / (8 * np.pi * G)
87
+ ) # in units of h^2 Mo/ Mpc^3 where Mo is solar mass
88
+ cf.rho_m = lambda xx: cf.rho_crit(xx) * cf.Om_m(xx) # in units of h^2 Mo/ Mpc^3
89
+
90
+ # M_halo - mass enclosed within the radius
91
+ cf.M_halo = (4 * np.pi * cf.rho_m(0) * R**3) / 3 # [M_sun/h] - array in R
92
+
41
93
  ####################################### Which HMF: f(nu)
42
94
  def halo_bias_params(self, zz: float) -> tuple[float, float, float, float, float]:
43
95
  """
@@ -82,21 +134,17 @@ class HMF:
82
134
  return part1 * part2
83
135
 
84
136
  #############################################################################################
85
- def n_h(self, zz: float) -> np.ndarray:
137
+ def n_h(self, zz: float | np.ndarray) -> np.ndarray:
86
138
  """
87
139
  define halo mass function - number density of halos per unit mass - Tinker10
88
140
  Return array in (R,z)
89
141
  """
90
142
  sig_R = self.cosmo_funcs.sig_R["0"](zz) # array in R,z
143
+ M = self.cosmo_funcs.M_halo[:, None] # (R,1) for broadcasting
91
144
  # derivative of sigma wrt to M
92
- dSdM = np.gradient(np.sqrt(sig_R), self.cosmo_funcs.M_halo, axis=-1) # is 2D array R,z
145
+ dSdM = np.gradient(np.sqrt(sig_R), self.cosmo_funcs.M_halo, axis=0) # 2D array R,z
93
146
 
94
- return (
95
- (self.cosmo_funcs.rho_m(0) / self.cosmo_funcs.M_halo)
96
- * self.multiplicity(zz)
97
- * np.abs(dSdM)
98
- / np.sqrt(sig_R)
99
- )
147
+ return (self.cosmo_funcs.rho_m(0) / M) * self.multiplicity(zz) * np.abs(dSdM) / np.sqrt(sig_R)
100
148
 
101
149
  ###############################################################################################
102
150
  # get langrangian and then eulerian biases
@@ -111,9 +159,9 @@ class HMF:
111
159
  def get_bn(self, zz, N):
112
160
  coef = (-self.pc.nu_func(zz)) ** N / (self.pc.delta_c**N * self.pc.multiplicity(zz))
113
161
  # computes derivatives of the multiplicity function
114
- deriv = self.pc.multiplicity(zz) # so only 1D - only for 1 z value
162
+ deriv = self.pc.multiplicity(zz)
115
163
  for _ in range(N):
116
- deriv = np.gradient(deriv, self.pc.nu_func(zz), axis=-1)
164
+ deriv = np.gradient(deriv, self.pc.nu_func(zz), axis=0)
117
165
 
118
166
  return coef * deriv
119
167
 
@@ -7,7 +7,7 @@ from scipy.interpolate import CubicSpline
7
7
  from scipy.optimize import newton
8
8
  from scipy.special import erf
9
9
 
10
- from cosmo_wap.lib.luminosity_funcs import BGSLuminosityFunction_HOD
10
+ from cosmo_wap.lib.luminosity_funcs import BGSLuminosityFunction
11
11
 
12
12
 
13
13
  class BaseHOD(ABC):
@@ -48,17 +48,17 @@ class YP(BaseHOD):
48
48
  NO = self.NO_func(zz)
49
49
  return (M0, NO)
50
50
 
51
- def HOD(self, zz: float, M0: float, NHO: float) -> np.ndarray:
51
+ def HOD(self, zz, M0, NHO) -> np.ndarray:
52
52
  """
53
- Define the HOD - N(r,z) (N(M)) mean number of galaxies per halo - from Yankelevich and porciani 2018: arXiv:1807.07076
53
+ Define the HOD - N(M, z) mean number of galaxies per halo - from Yankelevich and porciani 2018: arXiv:1807.07076
54
54
  """
55
- M = self.cosmo_funcs.M_halo
55
+ M = self.cosmo_funcs.M_halo[:, None] # (R,1) for broadcasting
56
56
 
57
57
  theta_HoD = 1 + erf(2 * np.log10(M / M0))
58
58
  N_c = np.exp(-10 * (np.log10(M / M0)) ** 2) + 0.05 * theta_HoD # central galaxies
59
59
  N_s = 0.003 * (M / M0) * theta_HoD
60
60
 
61
- return NHO * (N_c + N_s) # 2D (r,z)
61
+ return NHO * (N_c + N_s) # (R,z)
62
62
 
63
63
  ########################### fit M0 and NO to given n_g and b_1
64
64
  def fit_M0(self, z_arr: np.ndarray) -> CubicSpline:
@@ -100,7 +100,8 @@ class Smith_BGS(BaseHOD):
100
100
  def __init__(self, cosmo_funcs):
101
101
  self.cosmo_funcs = cosmo_funcs
102
102
  cosmo = cosmo_funcs.cosmo
103
- self.lf = BGSLuminosityFunction_HOD(cosmo)
103
+ self.lf = BGSLuminosityFunction(cosmo)
104
+ self.lf.get_Q = self.lf.get_Q2 # use number density based Q method
104
105
 
105
106
  # read the best-fitting HOD parameters
106
107
  # The parameters in the file are in the order:
@@ -172,7 +173,7 @@ class Smith_BGS(BaseHOD):
172
173
  # use best fits from AbacusSummit_base_c000_ph000_best_params.txt with m_c =20
173
174
  logMmin, sigma, logM0, logM1, alpha = self.get_params(zz, m_c)
174
175
 
175
- logM = np.log10(self.cosmo_funcs.M_halo)
176
+ logM = np.log10(self.cosmo_funcs.M_halo[:, None]) # (R,1) for broadcasting with z
176
177
  Ncen = self.number_centrals(logM, logMmin, sigma)
177
178
  Nsat = self.number_satellites(logM, logM0, logM1, alpha)
178
179
  return Ncen + Nsat * Ncen
@@ -8,7 +8,6 @@ from scipy.interpolate import CubicSpline
8
8
 
9
9
  from cosmo_wap.HOD import HMF
10
10
  from cosmo_wap.HOD.hods import YP, Smith_BGS
11
- from cosmo_wap.lib.luminosity_funcs import BGSLuminosityFunction_HOD
12
11
 
13
12
  if TYPE_CHECKING:
14
13
  from cosmo_wap.main import ClassWAP
@@ -37,21 +36,21 @@ class PBBias:
37
36
  survey_params: SurveyParams.SurveyBase,
38
37
  hmf: str = "Tinker10",
39
38
  hod: str = "YP",
40
- m_c: float | None = None,
39
+ cut: float | None = None,
41
40
  ):
42
41
  self.cosmo_funcs = cosmo_funcs # for later
43
42
  self.survey_params = survey_params
44
- # unpack from cosmo_funcs
45
- self.R = cosmo_funcs.R # [Mpc/h]
46
- self.M = cosmo_funcs.M_halo # [Msun/h] # array in R,z
47
- self.sig_R = cosmo_funcs.sig_R
48
- self.delta_c = cosmo_funcs.delta_c
49
- self.m_c = m_c # only needed for Smith_BGS HOD, is ignored for YP
43
+ self.cut = cut # only needed for Smith_BGS HOD, is ignored for YP
50
44
 
51
45
  # init hmf
52
46
  self.hmf = HMF(
53
47
  cosmo_funcs, hmf
54
48
  ) # initiate HMF class to get multiplicity function and lagrangian bias functions
49
+ # unpack from cosmo_funcs
50
+ self.R = cosmo_funcs.R # [Mpc/h]
51
+ self.M = cosmo_funcs.M_halo # [Msun/h] # array in R
52
+ self.sig_R = cosmo_funcs.sig_R
53
+ self.delta_c = cosmo_funcs.delta_c
55
54
  # and Eulerian bias conversions
56
55
  self.eulbias = self.EulBias(self)
57
56
 
@@ -64,8 +63,8 @@ class PBBias:
64
63
 
65
64
  #################################################################################################
66
65
  # so save all required params to object
67
- self.z_samps = np.linspace(self.survey_params.z_range[0], self.survey_params.z_range[1], int(40))
68
- self.params = self.hod.get_hod_params(self.z_samps, self.m_c)
66
+ self.z_samps = np.linspace(self.survey_params.z_range[0], self.survey_params.z_range[1], 100)
67
+ self.params = self.hod.get_hod_params(self.z_samps, self.cut)
69
68
 
70
69
  self.n_g = self.get_number_density()
71
70
  self.b_1 = self.get_galaxy_bias(self.eulbias.b1)
@@ -78,16 +77,23 @@ class PBBias:
78
77
  self.orth = self.Orth(self)
79
78
 
80
79
  if hod == "Smith_BGS":
81
- # ok so we need an m_c dependent n_g!
80
+ # ok so we need a cut dependent n_g!
82
81
  # compute Q and b_e from luminosity function using HOD-derived n_g
83
- def ng_tmp(m_c, zz):
84
- """n_g(m_c,zz) - compatible with lum_funcs"""
85
- return self.number_density(zz, m_c)
86
-
87
- lf = BGSLuminosityFunction_HOD(cosmo_funcs.cosmo, n_g=ng_tmp)
88
- zz = np.linspace(survey_params.z_range[0], survey_params.z_range[1], 40)
89
- self.Q = CubicSpline(zz, lf.get_Q(self.m_c, zz))
90
- self.be = CubicSpline(zz, lf.get_be(self.m_c, zz))
82
+ def ng_tmp(cut, zz):
83
+ """n_g(cut,zz) - compatible with lum_funcs"""
84
+ return self.number_density(zz, cut)
85
+
86
+ self.hod.lf.number_density = ng_tmp # set number density function
87
+
88
+ zz = self.hod.lf.z_values
89
+ zz = zz[
90
+ (zz >= self.z_samps[0]) & (zz <= self.z_samps[-1])
91
+ ] # clip to survey range to avoid extrapolating n_g
92
+ Q_arr = self.hod.lf.get_Q(self.cut, zz)
93
+ self.Q = CubicSpline(zz, Q_arr)
94
+ self.be = CubicSpline(
95
+ zz, self.hod.lf.get_be(self.cut, zz, Q=Q_arr, n_g=self.n_g(zz))
96
+ ) # passing Q to avoid redundant computation
91
97
 
92
98
  #########################################################################################
93
99
  def number_density(self, zz: float | np.ndarray, *hod_params) -> float | np.ndarray:
@@ -95,15 +101,7 @@ class PBBias:
95
101
  Number density as function of redshift and HOD params
96
102
  Integrate HOD-weighted halo mass function to get galaxy number density at redshift zz.
97
103
  """
98
- if not np.isscalar(zz):
99
- return np.array(
100
- [
101
- self.number_density(z, *[p[i] if not np.isscalar(p) else p for p in hod_params])
102
- for i, z in enumerate(zz)
103
- ]
104
- )
105
-
106
- return simpson(self.hod.HOD(zz, *hod_params) * self.hmf.n_h(zz), self.M, axis=-1)
104
+ return simpson(self.hod.HOD(zz, *hod_params) * self.hmf.n_h(zz), self.M, axis=0).squeeze()
107
105
 
108
106
  # so implement
109
107
  def general_galaxy_bias(
@@ -113,20 +111,8 @@ class PBBias:
113
111
  Galaxy bias as function of redshift and HOD params
114
112
  Compute HOD-weighted average of halo bias b_h over the halo mass function at redshift zz.
115
113
  """
116
- if not np.isscalar(zz):
117
- return np.array(
118
- [
119
- self.general_galaxy_bias(
120
- b_h, z, *[p[i] if not np.isscalar(p) else p for p in hod_params], A=A, alpha=alpha
121
- )
122
- for i, z in enumerate(zz)
123
- ]
124
- )
125
-
126
114
  # Integrate over M for each value of z
127
- integral_values = simpson(b_h(zz, A, alpha) * self.hmf.n_h(zz) * self.hod.HOD(zz, *hod_params), self.M, axis=-1)
128
-
129
- return integral_values
115
+ return simpson(b_h(zz, A, alpha) * self.hmf.n_h(zz) * self.hod.HOD(zz, *hod_params), self.M, axis=0).squeeze()
130
116
 
131
117
  ######################### return cubic spline objects
132
118
  def get_number_density(self):
@@ -191,8 +177,8 @@ class PBBias:
191
177
  Compute dy/dx using finite differences along the R axis.
192
178
  """
193
179
  # Fit cubic splines and caclulate their derivatives for each R coord
194
- dum1 = np.gradient(dy, self.R, axis=-1)
195
- dum2 = np.gradient(dx, self.R, axis=-1)
180
+ dum1 = np.gradient(dy, self.R, axis=0)
181
+ dum2 = np.gradient(dx, self.R, axis=0)
196
182
 
197
183
  return dum1 / dum2 # Compute the ratio of the derivatives
198
184