pyhermes-cosmo 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyhermes_cosmo-1.1.0/LICENSE +21 -0
- pyhermes_cosmo-1.1.0/PKG-INFO +230 -0
- pyhermes_cosmo-1.1.0/README.md +173 -0
- pyhermes_cosmo-1.1.0/pyhermes/__init__.py +1 -0
- pyhermes_cosmo-1.1.0/pyhermes/base/__init__.py +2 -0
- pyhermes_cosmo-1.1.0/pyhermes/base/default_params.json +36 -0
- pyhermes_cosmo-1.1.0/pyhermes/base/sfc_projection.py +419 -0
- pyhermes_cosmo-1.1.0/pyhermes/io/__init__.py +14 -0
- pyhermes_cosmo-1.1.0/pyhermes/io/base.py +130 -0
- pyhermes_cosmo-1.1.0/pyhermes/io/corr2pcf.py +163 -0
- pyhermes_cosmo-1.1.0/pyhermes/io/corr3pcf.py +124 -0
- pyhermes_cosmo-1.1.0/pyhermes/io/corr3pcf_multipole.py +93 -0
- pyhermes_cosmo-1.1.0/pyhermes/io/counting.py +62 -0
- pyhermes_cosmo-1.1.0/pyhermes/io/funcs.py +84 -0
- pyhermes_cosmo-1.1.0/pyhermes/io/pickle_compat.py +90 -0
- pyhermes_cosmo-1.1.0/pyhermes/io/readers.py +635 -0
- pyhermes_cosmo-1.1.0/pyhermes/io/resources.py +161 -0
- pyhermes_cosmo-1.1.0/pyhermes/io/sfc_field.py +586 -0
- pyhermes_cosmo-1.1.0/pyhermes/io/window.py +548 -0
- pyhermes_cosmo-1.1.0/pyhermes/param/__init__.py +0 -0
- pyhermes_cosmo-1.1.0/pyhermes/param/logbase.py +92 -0
- pyhermes_cosmo-1.1.0/pyhermes/param/parambase.py +282 -0
- pyhermes_cosmo-1.1.0/pyhermes/pipeline/__init__.py +8 -0
- pyhermes_cosmo-1.1.0/pyhermes/pipeline/custom_exceptions.py +56 -0
- pyhermes_cosmo-1.1.0/pyhermes/pipeline/pipeline.py +74 -0
- pyhermes_cosmo-1.1.0/pyhermes/theory/__init__.py +6 -0
- pyhermes_cosmo-1.1.0/pyhermes/theory/corr2pcf.py +1264 -0
- pyhermes_cosmo-1.1.0/pyhermes/theory/corr3pcf.py +1645 -0
- pyhermes_cosmo-1.1.0/pyhermes/theory/corr3pcf_multipole.py +1715 -0
- pyhermes_cosmo-1.1.0/pyhermes/theory/counting.py +259 -0
- pyhermes_cosmo-1.1.0/pyhermes/theory/default_params.json +193 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/__init__.py +0 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/convolution.py +295 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/corr3pcf_kernels.py +175 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/corr3pcf_multipoles.py +579 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/func_util.py +111 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/legendre_fast.py +1342 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/legendre_windows.py +119 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/mpi_util.py +169 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/plot.py +733 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/plot_styles.json +115 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/radial_multipole_windows.py +316 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/radial_profiles.py +709 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/redshift_space.py +107 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/runtime.py +21 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/sampling.py +43 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/special_functions.py +409 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/wavelet_grid.py +186 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/window_functions.py +473 -0
- pyhermes_cosmo-1.1.0/pyhermes/utils/window_params.py +189 -0
- pyhermes_cosmo-1.1.0/pyhermes_cosmo.egg-info/PKG-INFO +230 -0
- pyhermes_cosmo-1.1.0/pyhermes_cosmo.egg-info/SOURCES.txt +58 -0
- pyhermes_cosmo-1.1.0/pyhermes_cosmo.egg-info/dependency_links.txt +1 -0
- pyhermes_cosmo-1.1.0/pyhermes_cosmo.egg-info/requires.txt +38 -0
- pyhermes_cosmo-1.1.0/pyhermes_cosmo.egg-info/top_level.txt +1 -0
- pyhermes_cosmo-1.1.0/pyproject.toml +107 -0
- pyhermes_cosmo-1.1.0/setup.cfg +4 -0
- pyhermes_cosmo-1.1.0/tests/test_no_mpi.py +133 -0
- pyhermes_cosmo-1.1.0/tests/test_pickle_compat.py +57 -0
- pyhermes_cosmo-1.1.0/tests/test_remote_particle_reader.py +165 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 PyHermes Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyhermes-cosmo
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: High-performance multiresolution cosmic statistics in Python
|
|
5
|
+
Author-email: PyHermes Team <dingdluan@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://pyhermes.astroslacker.com
|
|
8
|
+
Project-URL: Documentation, https://pyhermes.astroslacker.com
|
|
9
|
+
Project-URL: Repository, https://github.com/SYSUSPA-Projects/PyHermes
|
|
10
|
+
Project-URL: Issues, https://github.com/SYSUSPA-Projects/PyHermes/issues
|
|
11
|
+
Keywords: cosmology,large-scale structure,correlation function,MPI,scientific computing
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: h5py
|
|
25
|
+
Requires-Dist: hdf5plugin
|
|
26
|
+
Requires-Dist: json5
|
|
27
|
+
Requires-Dist: numba
|
|
28
|
+
Requires-Dist: numpy
|
|
29
|
+
Requires-Dist: PyWavelets
|
|
30
|
+
Requires-Dist: pyyaml
|
|
31
|
+
Requires-Dist: requests
|
|
32
|
+
Requires-Dist: rich
|
|
33
|
+
Requires-Dist: scipy
|
|
34
|
+
Requires-Dist: termcolor>=1.1
|
|
35
|
+
Provides-Extra: mpi
|
|
36
|
+
Requires-Dist: mpi4py>=4; extra == "mpi"
|
|
37
|
+
Provides-Extra: plot
|
|
38
|
+
Requires-Dist: matplotlib>=3.7; extra == "plot"
|
|
39
|
+
Provides-Extra: camb
|
|
40
|
+
Requires-Dist: camb>=1.5; extra == "camb"
|
|
41
|
+
Provides-Extra: docs
|
|
42
|
+
Requires-Dist: ipython-pygments-lexers>=1.1; extra == "docs"
|
|
43
|
+
Requires-Dist: nbsphinx>=0.9; extra == "docs"
|
|
44
|
+
Requires-Dist: nbsphinx-link>=1.4; extra == "docs"
|
|
45
|
+
Requires-Dist: pypandoc-binary>=1.15; extra == "docs"
|
|
46
|
+
Requires-Dist: sphinx>=8; extra == "docs"
|
|
47
|
+
Requires-Dist: pydata-sphinx-theme<0.21,>=0.20; extra == "docs"
|
|
48
|
+
Requires-Dist: sphinx-copybutton>=0.5; extra == "docs"
|
|
49
|
+
Provides-Extra: test
|
|
50
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
51
|
+
Provides-Extra: dev
|
|
52
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
53
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
54
|
+
Requires-Dist: ruff>=0.12; extra == "dev"
|
|
55
|
+
Requires-Dist: twine>=5; extra == "dev"
|
|
56
|
+
Dynamic: license-file
|
|
57
|
+
|
|
58
|
+
<p align="center">
|
|
59
|
+
<img src="https://pyhermes.astroslacker.com/_static/pyhermes_logo_transparent.png" alt="PyHermes logo" width="220">
|
|
60
|
+
</p>
|
|
61
|
+
|
|
62
|
+
# PyHermes
|
|
63
|
+
|
|
64
|
+
**PyHermes** is the Python implementation of **Hermes** (HypER-speed
|
|
65
|
+
MultirEsolution cosmic Statistics), an in situ framework for measuring cosmic
|
|
66
|
+
statistics with reusable multiresolution fields and window operators.
|
|
67
|
+
|
|
68
|
+
A catalogue is projected once into an `SFCField`. Smoothing, geometric binning,
|
|
69
|
+
multipole decomposition, differentiation, and inverse-Laplacian operations are
|
|
70
|
+
then expressed through `WindowFunc` objects. The same field can therefore feed
|
|
71
|
+
counting, 2PCF, conventional 3PCF, 3PCF multipoles, marked statistics, and
|
|
72
|
+
derived physical-field calculations without returning to particle-level tuple
|
|
73
|
+
counting for every configuration.
|
|
74
|
+
|
|
75
|
+
- **Documentation:** [pyhermes.astroslacker.com](https://pyhermes.astroslacker.com)
|
|
76
|
+
- **Source:** [SYSUSPA-Projects/PyHermes](https://github.com/SYSUSPA-Projects/PyHermes)
|
|
77
|
+
- **Tutorials:** [`examples/notebooks/`](https://github.com/SYSUSPA-Projects/PyHermes/tree/main/examples/notebooks)
|
|
78
|
+
- **Runnable configurations:** [`examples/configs/`](https://github.com/SYSUSPA-Projects/PyHermes/tree/main/examples/configs) and
|
|
79
|
+
[`examples/scripts/`](https://github.com/SYSUSPA-Projects/PyHermes/tree/main/examples/scripts)
|
|
80
|
+
|
|
81
|
+

|
|
82
|
+
|
|
83
|
+
## What It Covers
|
|
84
|
+
|
|
85
|
+
- catalogue-to-field projection with configurable compactly supported scaling
|
|
86
|
+
functions and resolution `J`;
|
|
87
|
+
- built-in and user-defined smoothing, binning, multipole, and operator windows;
|
|
88
|
+
- one-point counting and field sampling;
|
|
89
|
+
- isotropic and anisotropic 2PCF measurements;
|
|
90
|
+
- Monte Carlo and spherical-harmonic 3PCF estimators;
|
|
91
|
+
- MPI/thread parallelism and CPU or CUDA contraction for 3PCF multipoles;
|
|
92
|
+
- weighted fields, velocity derivatives, Poisson potential, acceleration, and
|
|
93
|
+
density-dependent marks.
|
|
94
|
+
|
|
95
|
+
## Installation
|
|
96
|
+
|
|
97
|
+
For notebooks, development, and other single-process work, install PyHermes
|
|
98
|
+
from PyPI:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
python -m pip install pyhermes-cosmo
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This installs PyHermes and its regular Python dependencies automatically. MPI
|
|
105
|
+
and CUDA are optional, so neither is required for the default installation.
|
|
106
|
+
|
|
107
|
+
The Python import name remains unchanged:
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
import pyhermes
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
For a ready-to-use MPICH environment on Linux or macOS:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
conda create -n pyhermes -c conda-forge python=3.12 mpi4py mpich pip
|
|
117
|
+
conda activate pyhermes
|
|
118
|
+
python -m pip install pyhermes-cosmo
|
|
119
|
+
mpiexec -n 2 python -c "from mpi4py import MPI; print(MPI.COMM_WORLD.rank)"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Here conda provides a mutually compatible MPI runtime and Python binding, while
|
|
123
|
+
pip installs PyHermes and the remaining Python dependencies. PyHermes does not
|
|
124
|
+
yet require a separate conda package for this workflow.
|
|
125
|
+
|
|
126
|
+
Without `mpi4py`, PyHermes automatically uses its single-process MPI fallback.
|
|
127
|
+
Users of an existing cluster MPI should follow the
|
|
128
|
+
[installation guide](https://pyhermes.astroslacker.com/install.html) for
|
|
129
|
+
the matching `mpi4py` and GPU setup.
|
|
130
|
+
|
|
131
|
+
## Smallest Workflow
|
|
132
|
+
|
|
133
|
+
The tracked Quick Start configurations use paths relative to `examples/`:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
cd examples
|
|
137
|
+
python scripts/run_sfc_projection.py configs/param_sfc_projection.yaml
|
|
138
|
+
python scripts/run_2pcf.py configs/param_2pcf.yaml
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The first command downloads and caches the original single-file Quijote
|
|
142
|
+
`group_tab` catalogue from the URL in the YAML, verifies its SHA256 digest,
|
|
143
|
+
and writes the base `SFCField`. The second command consumes that exact field
|
|
144
|
+
and writes an isotropic `Corr2PCFData` result. The matching
|
|
145
|
+
`quick_start.ipynb` executes the same configs and plotting code rather than
|
|
146
|
+
maintaining a parallel example.
|
|
147
|
+
|
|
148
|
+
The dedicated `particle_io.ipynb` reuses that catalogue and shows how the
|
|
149
|
+
native FoF reader, an NPZ conversion, and a raw BIN layout all feed the same
|
|
150
|
+
projection API. The converted NPZ and BIN files are local teaching products,
|
|
151
|
+
not additional public downloads.
|
|
152
|
+
`sfc_projection.ipynb` then builds the J=9, weighted, redshift-space, and
|
|
153
|
+
explicit sampled-random fields used by later examples;
|
|
154
|
+
`scripts/prepare_sfc_fields.py` provides the equivalent non-interactive batch
|
|
155
|
+
entry point. The optional dark-matter snapshot builder accepts the local
|
|
156
|
+
Gadget HDF5 snapshot prefix explicitly; no cluster-specific path is embedded
|
|
157
|
+
in the code:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
python scripts/build_quijote_dm_sfc_field.py /path/to/snapdir_004/snap_004
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
from pyhermes.base.sfc_projection import SFCProjection
|
|
165
|
+
from pyhermes.io import WindowFunc
|
|
166
|
+
from pyhermes.param.parambase import read_param
|
|
167
|
+
|
|
168
|
+
params = read_param("./configs/param_sfc_projection.yaml")
|
|
169
|
+
field = SFCProjection(params).run()
|
|
170
|
+
|
|
171
|
+
gaussian = WindowFunc(
|
|
172
|
+
{"type": "gaussian", "len_args": {"R": 10.0}},
|
|
173
|
+
field.sfc_info,
|
|
174
|
+
threads=8,
|
|
175
|
+
)
|
|
176
|
+
smoothed_field = field @ gaussian
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
This is the core language of PyHermes: **field @ window**. Statistical tasks
|
|
180
|
+
build the required window families and normalizations around the same objects.
|
|
181
|
+
|
|
182
|
+
## Start With The Notebooks
|
|
183
|
+
|
|
184
|
+
The recommended route through
|
|
185
|
+
[`examples/notebooks/`](https://github.com/SYSUSPA-Projects/PyHermes/tree/main/examples/notebooks)
|
|
186
|
+
is:
|
|
187
|
+
|
|
188
|
+
1. [`quick_start.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/quick_start.ipynb)
|
|
189
|
+
2. [`particle_io.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/particle_io.ipynb)
|
|
190
|
+
3. [`sfc_projection.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/sfc_projection.ipynb)
|
|
191
|
+
4. [`window.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/window.ipynb)
|
|
192
|
+
5. [`physical_fields.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/physical_fields.ipynb)
|
|
193
|
+
6. [`counting.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/counting.ipynb)
|
|
194
|
+
7. [`corr2pcf.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/corr2pcf.ipynb)
|
|
195
|
+
8. [`corr3pcf.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/corr3pcf.ipynb)
|
|
196
|
+
|
|
197
|
+
The first four notebooks establish the common catalogue-to-field-to-window
|
|
198
|
+
workflow. Continue with physical fields, one-point Counting, or the
|
|
199
|
+
2PCF-to-3PCF statistics path according to the calculation you need.
|
|
200
|
+
|
|
201
|
+
Generated catalogues and estimator products are intentionally not committed.
|
|
202
|
+
The notebooks state which lightweight cells run locally and which script/YAML
|
|
203
|
+
pairs are intended for a workstation or cluster.
|
|
204
|
+
|
|
205
|
+
## Documentation
|
|
206
|
+
|
|
207
|
+
The full guide at [pyhermes.astroslacker.com](https://pyhermes.astroslacker.com)
|
|
208
|
+
follows the terminology and estimator definitions of the Hermes paper. It
|
|
209
|
+
covers the mathematical construction, current APIs, window catalogue,
|
|
210
|
+
parameter mappings, numerical validation, and performance interpretation.
|
|
211
|
+
|
|
212
|
+
To build the documentation locally:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
python -m pip install ".[docs]"
|
|
216
|
+
sphinx-build -W -b html docs docs/_build/html
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Citing PyHermes
|
|
220
|
+
|
|
221
|
+
If PyHermes contributes to a publication, please cite the software and, once
|
|
222
|
+
available, the accompanying Hermes/PyHermes paper. Citation metadata is
|
|
223
|
+
provided in [`CITATION.cff`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/CITATION.cff),
|
|
224
|
+
with BibTeX examples in the
|
|
225
|
+
[citation guide](https://pyhermes.astroslacker.com/citing.html).
|
|
226
|
+
|
|
227
|
+
The current citation author list is Long-Long Feng, Tengpeng Xu, Tian-Cheng
|
|
228
|
+
Luan and collaborators. The manuscript entry remains clearly
|
|
229
|
+
marked as a placeholder until its final title, journal, and identifier are
|
|
230
|
+
available.
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://pyhermes.astroslacker.com/_static/pyhermes_logo_transparent.png" alt="PyHermes logo" width="220">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# PyHermes
|
|
6
|
+
|
|
7
|
+
**PyHermes** is the Python implementation of **Hermes** (HypER-speed
|
|
8
|
+
MultirEsolution cosmic Statistics), an in situ framework for measuring cosmic
|
|
9
|
+
statistics with reusable multiresolution fields and window operators.
|
|
10
|
+
|
|
11
|
+
A catalogue is projected once into an `SFCField`. Smoothing, geometric binning,
|
|
12
|
+
multipole decomposition, differentiation, and inverse-Laplacian operations are
|
|
13
|
+
then expressed through `WindowFunc` objects. The same field can therefore feed
|
|
14
|
+
counting, 2PCF, conventional 3PCF, 3PCF multipoles, marked statistics, and
|
|
15
|
+
derived physical-field calculations without returning to particle-level tuple
|
|
16
|
+
counting for every configuration.
|
|
17
|
+
|
|
18
|
+
- **Documentation:** [pyhermes.astroslacker.com](https://pyhermes.astroslacker.com)
|
|
19
|
+
- **Source:** [SYSUSPA-Projects/PyHermes](https://github.com/SYSUSPA-Projects/PyHermes)
|
|
20
|
+
- **Tutorials:** [`examples/notebooks/`](https://github.com/SYSUSPA-Projects/PyHermes/tree/main/examples/notebooks)
|
|
21
|
+
- **Runnable configurations:** [`examples/configs/`](https://github.com/SYSUSPA-Projects/PyHermes/tree/main/examples/configs) and
|
|
22
|
+
[`examples/scripts/`](https://github.com/SYSUSPA-Projects/PyHermes/tree/main/examples/scripts)
|
|
23
|
+
|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
## What It Covers
|
|
27
|
+
|
|
28
|
+
- catalogue-to-field projection with configurable compactly supported scaling
|
|
29
|
+
functions and resolution `J`;
|
|
30
|
+
- built-in and user-defined smoothing, binning, multipole, and operator windows;
|
|
31
|
+
- one-point counting and field sampling;
|
|
32
|
+
- isotropic and anisotropic 2PCF measurements;
|
|
33
|
+
- Monte Carlo and spherical-harmonic 3PCF estimators;
|
|
34
|
+
- MPI/thread parallelism and CPU or CUDA contraction for 3PCF multipoles;
|
|
35
|
+
- weighted fields, velocity derivatives, Poisson potential, acceleration, and
|
|
36
|
+
density-dependent marks.
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
For notebooks, development, and other single-process work, install PyHermes
|
|
41
|
+
from PyPI:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
python -m pip install pyhermes-cosmo
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This installs PyHermes and its regular Python dependencies automatically. MPI
|
|
48
|
+
and CUDA are optional, so neither is required for the default installation.
|
|
49
|
+
|
|
50
|
+
The Python import name remains unchanged:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
import pyhermes
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
For a ready-to-use MPICH environment on Linux or macOS:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
conda create -n pyhermes -c conda-forge python=3.12 mpi4py mpich pip
|
|
60
|
+
conda activate pyhermes
|
|
61
|
+
python -m pip install pyhermes-cosmo
|
|
62
|
+
mpiexec -n 2 python -c "from mpi4py import MPI; print(MPI.COMM_WORLD.rank)"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Here conda provides a mutually compatible MPI runtime and Python binding, while
|
|
66
|
+
pip installs PyHermes and the remaining Python dependencies. PyHermes does not
|
|
67
|
+
yet require a separate conda package for this workflow.
|
|
68
|
+
|
|
69
|
+
Without `mpi4py`, PyHermes automatically uses its single-process MPI fallback.
|
|
70
|
+
Users of an existing cluster MPI should follow the
|
|
71
|
+
[installation guide](https://pyhermes.astroslacker.com/install.html) for
|
|
72
|
+
the matching `mpi4py` and GPU setup.
|
|
73
|
+
|
|
74
|
+
## Smallest Workflow
|
|
75
|
+
|
|
76
|
+
The tracked Quick Start configurations use paths relative to `examples/`:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
cd examples
|
|
80
|
+
python scripts/run_sfc_projection.py configs/param_sfc_projection.yaml
|
|
81
|
+
python scripts/run_2pcf.py configs/param_2pcf.yaml
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The first command downloads and caches the original single-file Quijote
|
|
85
|
+
`group_tab` catalogue from the URL in the YAML, verifies its SHA256 digest,
|
|
86
|
+
and writes the base `SFCField`. The second command consumes that exact field
|
|
87
|
+
and writes an isotropic `Corr2PCFData` result. The matching
|
|
88
|
+
`quick_start.ipynb` executes the same configs and plotting code rather than
|
|
89
|
+
maintaining a parallel example.
|
|
90
|
+
|
|
91
|
+
The dedicated `particle_io.ipynb` reuses that catalogue and shows how the
|
|
92
|
+
native FoF reader, an NPZ conversion, and a raw BIN layout all feed the same
|
|
93
|
+
projection API. The converted NPZ and BIN files are local teaching products,
|
|
94
|
+
not additional public downloads.
|
|
95
|
+
`sfc_projection.ipynb` then builds the J=9, weighted, redshift-space, and
|
|
96
|
+
explicit sampled-random fields used by later examples;
|
|
97
|
+
`scripts/prepare_sfc_fields.py` provides the equivalent non-interactive batch
|
|
98
|
+
entry point. The optional dark-matter snapshot builder accepts the local
|
|
99
|
+
Gadget HDF5 snapshot prefix explicitly; no cluster-specific path is embedded
|
|
100
|
+
in the code:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
python scripts/build_quijote_dm_sfc_field.py /path/to/snapdir_004/snap_004
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from pyhermes.base.sfc_projection import SFCProjection
|
|
108
|
+
from pyhermes.io import WindowFunc
|
|
109
|
+
from pyhermes.param.parambase import read_param
|
|
110
|
+
|
|
111
|
+
params = read_param("./configs/param_sfc_projection.yaml")
|
|
112
|
+
field = SFCProjection(params).run()
|
|
113
|
+
|
|
114
|
+
gaussian = WindowFunc(
|
|
115
|
+
{"type": "gaussian", "len_args": {"R": 10.0}},
|
|
116
|
+
field.sfc_info,
|
|
117
|
+
threads=8,
|
|
118
|
+
)
|
|
119
|
+
smoothed_field = field @ gaussian
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
This is the core language of PyHermes: **field @ window**. Statistical tasks
|
|
123
|
+
build the required window families and normalizations around the same objects.
|
|
124
|
+
|
|
125
|
+
## Start With The Notebooks
|
|
126
|
+
|
|
127
|
+
The recommended route through
|
|
128
|
+
[`examples/notebooks/`](https://github.com/SYSUSPA-Projects/PyHermes/tree/main/examples/notebooks)
|
|
129
|
+
is:
|
|
130
|
+
|
|
131
|
+
1. [`quick_start.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/quick_start.ipynb)
|
|
132
|
+
2. [`particle_io.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/particle_io.ipynb)
|
|
133
|
+
3. [`sfc_projection.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/sfc_projection.ipynb)
|
|
134
|
+
4. [`window.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/window.ipynb)
|
|
135
|
+
5. [`physical_fields.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/physical_fields.ipynb)
|
|
136
|
+
6. [`counting.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/counting.ipynb)
|
|
137
|
+
7. [`corr2pcf.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/corr2pcf.ipynb)
|
|
138
|
+
8. [`corr3pcf.ipynb`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/examples/notebooks/corr3pcf.ipynb)
|
|
139
|
+
|
|
140
|
+
The first four notebooks establish the common catalogue-to-field-to-window
|
|
141
|
+
workflow. Continue with physical fields, one-point Counting, or the
|
|
142
|
+
2PCF-to-3PCF statistics path according to the calculation you need.
|
|
143
|
+
|
|
144
|
+
Generated catalogues and estimator products are intentionally not committed.
|
|
145
|
+
The notebooks state which lightweight cells run locally and which script/YAML
|
|
146
|
+
pairs are intended for a workstation or cluster.
|
|
147
|
+
|
|
148
|
+
## Documentation
|
|
149
|
+
|
|
150
|
+
The full guide at [pyhermes.astroslacker.com](https://pyhermes.astroslacker.com)
|
|
151
|
+
follows the terminology and estimator definitions of the Hermes paper. It
|
|
152
|
+
covers the mathematical construction, current APIs, window catalogue,
|
|
153
|
+
parameter mappings, numerical validation, and performance interpretation.
|
|
154
|
+
|
|
155
|
+
To build the documentation locally:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
python -m pip install ".[docs]"
|
|
159
|
+
sphinx-build -W -b html docs docs/_build/html
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Citing PyHermes
|
|
163
|
+
|
|
164
|
+
If PyHermes contributes to a publication, please cite the software and, once
|
|
165
|
+
available, the accompanying Hermes/PyHermes paper. Citation metadata is
|
|
166
|
+
provided in [`CITATION.cff`](https://github.com/SYSUSPA-Projects/PyHermes/blob/main/CITATION.cff),
|
|
167
|
+
with BibTeX examples in the
|
|
168
|
+
[citation guide](https://pyhermes.astroslacker.com/citing.html).
|
|
169
|
+
|
|
170
|
+
The current citation author list is Long-Long Feng, Tengpeng Xu, Tian-Cheng
|
|
171
|
+
Luan and collaborators. The manuscript entry remains clearly
|
|
172
|
+
marked as a placeholder until its final title, journal, and identifier are
|
|
173
|
+
available.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.1.0"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"enable_default_param": true, // do not change this
|
|
3
|
+
"SFCProjection": {
|
|
4
|
+
"fin": {
|
|
5
|
+
"path": "",
|
|
6
|
+
"format": "bin",
|
|
7
|
+
"download": {
|
|
8
|
+
"cache_path": "",
|
|
9
|
+
"cache_dir": "",
|
|
10
|
+
"sha256": "",
|
|
11
|
+
"timeout": 60
|
|
12
|
+
},
|
|
13
|
+
"reader_params": {
|
|
14
|
+
"dtype": "float32",
|
|
15
|
+
"ncols": 3,
|
|
16
|
+
"pos_cols": [0, 1, 2],
|
|
17
|
+
"fields": {}
|
|
18
|
+
},
|
|
19
|
+
"catalog_weight_key": null,
|
|
20
|
+
"field_value_key": null
|
|
21
|
+
},
|
|
22
|
+
"particle_pos": null,
|
|
23
|
+
"catalog_weight": null,
|
|
24
|
+
"field_value": null,
|
|
25
|
+
"weight_normalization": "catalog",
|
|
26
|
+
"box_size": 1000,
|
|
27
|
+
"J": 8,
|
|
28
|
+
"wavelet_mode": "db2",
|
|
29
|
+
"wavelet_level": 10,
|
|
30
|
+
"phi_resolution": 1024,
|
|
31
|
+
"save_particle_data": false,
|
|
32
|
+
"particle_data_path": "",
|
|
33
|
+
"threads": 1,
|
|
34
|
+
"fout_path": ""
|
|
35
|
+
}
|
|
36
|
+
}
|