pixpoint 8.0.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 (86) hide show
  1. pixpoint-8.0.0/LICENSE +21 -0
  2. pixpoint-8.0.0/PKG-INFO +169 -0
  3. pixpoint-8.0.0/README.md +119 -0
  4. pixpoint-8.0.0/pyproject.toml +132 -0
  5. pixpoint-8.0.0/setup.cfg +4 -0
  6. pixpoint-8.0.0/src/pixpoint/__init__.py +86 -0
  7. pixpoint-8.0.0/src/pixpoint/_numba.py +23 -0
  8. pixpoint-8.0.0/src/pixpoint/backend/__init__.py +22 -0
  9. pixpoint-8.0.0/src/pixpoint/backend/aperture.py +387 -0
  10. pixpoint-8.0.0/src/pixpoint/backend/combinations.py +177 -0
  11. pixpoint-8.0.0/src/pixpoint/backend/core.py +641 -0
  12. pixpoint-8.0.0/src/pixpoint/backend/degrade.py +139 -0
  13. pixpoint-8.0.0/src/pixpoint/backend/density.py +687 -0
  14. pixpoint-8.0.0/src/pixpoint/backend/moments.py +1262 -0
  15. pixpoint-8.0.0/src/pixpoint/backend/raw.py +407 -0
  16. pixpoint-8.0.0/src/pixpoint/backend/shear.py +532 -0
  17. pixpoint-8.0.0/src/pixpoint/backend/three_by_two.py +483 -0
  18. pixpoint-8.0.0/src/pixpoint/backend/threepoint.py +236 -0
  19. pixpoint-8.0.0/src/pixpoint/compute_context.py +176 -0
  20. pixpoint-8.0.0/src/pixpoint/correlation_helpers.py +784 -0
  21. pixpoint-8.0.0/src/pixpoint/correlations.py +6577 -0
  22. pixpoint-8.0.0/src/pixpoint/cuda/aperture_moments.cuh +68 -0
  23. pixpoint-8.0.0/src/pixpoint/cuda/aperture_tomo.cu +436 -0
  24. pixpoint-8.0.0/src/pixpoint/cuda/common.cuh +123 -0
  25. pixpoint-8.0.0/src/pixpoint/cuda/degrade_rows.cu +199 -0
  26. pixpoint-8.0.0/src/pixpoint/cuda/density_density_tomo_vectorized.cu +156 -0
  27. pixpoint-8.0.0/src/pixpoint/cuda/density_shear_tomo_vectorized.cu +255 -0
  28. pixpoint-8.0.0/src/pixpoint/cuda/moment_rows.cu +144 -0
  29. pixpoint-8.0.0/src/pixpoint/cuda/pair_tiles.cuh +989 -0
  30. pixpoint-8.0.0/src/pixpoint/cuda/threepoint_multipoles.cu +168 -0
  31. pixpoint-8.0.0/src/pixpoint/cuda/tomo_fused_3x2pt.cu +376 -0
  32. pixpoint-8.0.0/src/pixpoint/cuda/tomo_tiled_3x2pt.cu +161 -0
  33. pixpoint-8.0.0/src/pixpoint/cuda/tomo_vectorized_xipm.cu +277 -0
  34. pixpoint-8.0.0/src/pixpoint/global_2pcf.py +1118 -0
  35. pixpoint-8.0.0/src/pixpoint/global_3pcf.py +970 -0
  36. pixpoint-8.0.0/src/pixpoint/global_geometry.py +440 -0
  37. pixpoint-8.0.0/src/pixpoint/io_handler.py +607 -0
  38. pixpoint-8.0.0/src/pixpoint/moments.py +411 -0
  39. pixpoint-8.0.0/src/pixpoint/multi_device.py +334 -0
  40. pixpoint-8.0.0/src/pixpoint/onepoint.py +838 -0
  41. pixpoint-8.0.0/src/pixpoint/packing.py +317 -0
  42. pixpoint-8.0.0/src/pixpoint/pair_finder.py +210 -0
  43. pixpoint-8.0.0/src/pixpoint/pair_geometry.py +878 -0
  44. pixpoint-8.0.0/src/pixpoint/pipeline.py +288 -0
  45. pixpoint-8.0.0/src/pixpoint/py.typed +0 -0
  46. pixpoint-8.0.0/src/pixpoint/result_writer.py +481 -0
  47. pixpoint-8.0.0/src/pixpoint/results.py +445 -0
  48. pixpoint-8.0.0/src/pixpoint/treecode.py +416 -0
  49. pixpoint-8.0.0/src/pixpoint/utils.py +238 -0
  50. pixpoint-8.0.0/src/pixpoint/zeta_writer.py +222 -0
  51. pixpoint-8.0.0/src/pixpoint.egg-info/PKG-INFO +169 -0
  52. pixpoint-8.0.0/src/pixpoint.egg-info/SOURCES.txt +84 -0
  53. pixpoint-8.0.0/src/pixpoint.egg-info/dependency_links.txt +1 -0
  54. pixpoint-8.0.0/src/pixpoint.egg-info/requires.txt +28 -0
  55. pixpoint-8.0.0/src/pixpoint.egg-info/top_level.txt +1 -0
  56. pixpoint-8.0.0/tests/test_aperture_fused.py +304 -0
  57. pixpoint-8.0.0/tests/test_backend.py +1959 -0
  58. pixpoint-8.0.0/tests/test_cell_moments.py +1154 -0
  59. pixpoint-8.0.0/tests/test_correlation_helpers.py +629 -0
  60. pixpoint-8.0.0/tests/test_correlations_calculations.py +468 -0
  61. pixpoint-8.0.0/tests/test_correlations_core.py +857 -0
  62. pixpoint-8.0.0/tests/test_correlations_coverage.py +3402 -0
  63. pixpoint-8.0.0/tests/test_degrade_kernel.py +317 -0
  64. pixpoint-8.0.0/tests/test_degrade_treecorr.py +210 -0
  65. pixpoint-8.0.0/tests/test_end_to_end.py +583 -0
  66. pixpoint-8.0.0/tests/test_estimator_parity.py +269 -0
  67. pixpoint-8.0.0/tests/test_global_2pcf.py +481 -0
  68. pixpoint-8.0.0/tests/test_global_3pcf.py +482 -0
  69. pixpoint-8.0.0/tests/test_global_multi_device.py +313 -0
  70. pixpoint-8.0.0/tests/test_gpu_kernel_emulation.py +585 -0
  71. pixpoint-8.0.0/tests/test_host_packed_pairs.py +270 -0
  72. pixpoint-8.0.0/tests/test_identity_caches.py +279 -0
  73. pixpoint-8.0.0/tests/test_kernel_signatures.py +202 -0
  74. pixpoint-8.0.0/tests/test_map_loader.py +249 -0
  75. pixpoint-8.0.0/tests/test_multi_device.py +167 -0
  76. pixpoint-8.0.0/tests/test_onepoint.py +454 -0
  77. pixpoint-8.0.0/tests/test_pair_packing.py +460 -0
  78. pixpoint-8.0.0/tests/test_pipeline.py +152 -0
  79. pixpoint-8.0.0/tests/test_result_writer.py +180 -0
  80. pixpoint-8.0.0/tests/test_results.py +251 -0
  81. pixpoint-8.0.0/tests/test_row_layouts.py +441 -0
  82. pixpoint-8.0.0/tests/test_row_space.py +446 -0
  83. pixpoint-8.0.0/tests/test_scalar_aperture.py +291 -0
  84. pixpoint-8.0.0/tests/test_static_treecode.py +1180 -0
  85. pixpoint-8.0.0/tests/test_utils.py +414 -0
  86. pixpoint-8.0.0/tests/test_zeta_writer.py +372 -0
pixpoint-8.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 David Gebauer
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,169 @@
1
+ Metadata-Version: 2.4
2
+ Name: pixpoint
3
+ Version: 8.0.0
4
+ Summary: Two-point, three-point, integrated three-point and one-point statistics of HEALPix maps, on CPUs and GPUs
5
+ Author-email: David Gebauer <git@gebauer.ai>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/D-Gebauer/PixPoint
8
+ Project-URL: Repository, https://github.com/D-Gebauer/PixPoint
9
+ Project-URL: Documentation, https://pixpoint.readthedocs.io
10
+ Project-URL: Bug Tracker, https://github.com/D-Gebauer/PixPoint/issues
11
+ Keywords: astronomy,cosmology,correlation-functions,three-point-functions,weak-lensing,galaxy-clustering,galaxy-galaxy-lensing,healpix,gpu
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
20
+ Classifier: Topic :: Scientific/Engineering :: Physics
21
+ Requires-Python: >=3.12
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: numpy>=1.20.0
25
+ Requires-Dist: scipy>=1.9.0
26
+ Requires-Dist: numba>=0.50.0
27
+ Requires-Dist: healpy>=1.10.0
28
+ Requires-Dist: h5py>=3.0.0
29
+ Requires-Dist: tqdm
30
+ Provides-Extra: gpu
31
+ Requires-Dist: cupy-cuda12x>=13.0.0; extra == "gpu"
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
34
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
35
+ Requires-Dist: pytest-env>=0.8.0; extra == "dev"
36
+ Requires-Dist: black>=22.0.0; extra == "dev"
37
+ Requires-Dist: isort>=5.0.0; extra == "dev"
38
+ Requires-Dist: flake8>=5.0.0; extra == "dev"
39
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
40
+ Requires-Dist: scipy-stubs; extra == "dev"
41
+ Requires-Dist: pre-commit>=2.0.0; extra == "dev"
42
+ Requires-Dist: treecorr; extra == "dev"
43
+ Provides-Extra: docs
44
+ Requires-Dist: sphinx>=7.0; extra == "docs"
45
+ Requires-Dist: myst-parser>=3.0; extra == "docs"
46
+ Requires-Dist: furo>=2024.1; extra == "docs"
47
+ Requires-Dist: sphinx-copybutton>=0.5; extra == "docs"
48
+ Requires-Dist: sphinx-design>=0.6; extra == "docs"
49
+ Dynamic: license-file
50
+
51
+ # PixPoint
52
+
53
+ [![CI](https://github.com/D-Gebauer/PixPoint/actions/workflows/ci.yml/badge.svg)](https://github.com/D-Gebauer/PixPoint/actions/workflows/ci.yml)
54
+ [![codecov](https://codecov.io/github/D-Gebauer/PixPoint/graph/badge.svg?token=F4JC08UEJP)](https://codecov.io/github/D-Gebauer/PixPoint)
55
+ [![Documentation](https://img.shields.io/readthedocs/pixpoint/latest?logo=readthedocs&logoColor=white)](https://pixpoint.readthedocs.io)
56
+ [![PyPI](https://img.shields.io/pypi/v/pixpoint?logo=pypi&logoColor=white)](https://pypi.org/project/pixpoint/)
57
+ [![DOI](https://zenodo.org/badge/1161690205.svg)](https://zenodo.org/badge/latestdoi/1161690205)
58
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/D-Gebauer/PixPoint/blob/main/LICENSE)
59
+
60
+ **Correlation functions of HEALPix maps, fast.**
61
+
62
+ <p align="center">
63
+ <a href="https://pixpoint.readthedocs.io"><b>Documentation</b></a> ·
64
+ <a href="https://pixpoint.readthedocs.io/en/latest/quickstart.html">Getting started</a> ·
65
+ <a href="https://pixpoint.readthedocs.io/en/latest/install.html">Installation</a> ·
66
+ <a href="https://pixpoint.readthedocs.io/en/latest/citing.html">Citing</a>
67
+ </p>
68
+
69
+ PixPoint measures two-point, three-point, integrated three-point and one-point
70
+ statistics of cosmological fields on HEALPix maps: cosmic shear, galaxy
71
+ clustering, galaxy-galaxy lensing, convergence. You give it maps and weights,
72
+ it gives you labelled results. The pixel pairs of a footprint are found once
73
+ and reused for every map, so a simulation suite costs one pair search and one
74
+ fast pass per map, on a CPU or, with the same code, on NVIDIA GPUs.
75
+
76
+ ```python
77
+ from pixpoint import Global2PCF
78
+
79
+ g2 = Global2PCF(nside=512, mask=mask, nbins=20, theta_min=2.5, theta_max=250)
80
+ g2.preprocess() # find the pixel pairs once (save_pairs / load_pairs to reuse)
81
+
82
+ res = g2.gg(shear_maps, weights) # shear_maps (nz, 2, npix), weights (nz, npix)
83
+ res.theta # bin centres, arcmin
84
+ res.xi_p, res.xi_m # (n_combinations, nbins)
85
+ res.combinations # which tomographic bins each row is
86
+
87
+ g2.kk(delta_maps, w_cov).xi # clustering w(theta)
88
+ g2.kg(delta_maps, shear_maps, w_lens, w_source).xi # galaxy-galaxy lensing gamma_t
89
+ ```
90
+
91
+ ## What it measures
92
+
93
+ | estimator | measures | methods | result |
94
+ |---|---|---|---|
95
+ | `Global2PCF` | two-point functions of the whole footprint: ξ±, w(θ), γ_t | `gg`, `kk`, `kg`, `three_by_two_pt` | `TwoPointResult` |
96
+ | `Global3PCF` | three-point functions of the whole footprint, by multipoles | `ggg`, `kkk`, `kgg`, `kkg`, `measure` | `ThreePointResult` |
97
+ | `Integrated3PCF` | aperture masses and 2PCFs in patches: the integrated 3PCF | `gg`, `kk`, `kg`, `three_by_two_pt`, `m_a`, `m_g` | `IntegratedResult` |
98
+ | `OnePoint` | PDFs and moments of aperture mass and smoothed scalar fields | `g`, `k` | `OnePointResult` |
99
+
100
+ Method names follow TreeCorr's field codes: `g` is a shear field, `k` a scalar
101
+ field such as a density contrast or convergence map. Every estimator is
102
+ tomographic, and every result carries the labels of its rows.
103
+
104
+ ## Why PixPoint
105
+
106
+ - **Exact pixel-pair estimators.** The two-point functions are ratios of
107
+ weighted sums over every pair of unmasked pixels, and agree with TreeCorr on
108
+ the pixel centres to rounding.
109
+ - **Find pairs once, measure many maps.** A full-footprint tomographic shear
110
+ 2PCF of DES Y3 at nside 512 (6.7 × 10⁸ pairs) takes 33 ms per map on an A100
111
+ after a one-off pair search; the same code runs on a laptop CPU.
112
+ - **Everything in one vocabulary.** Shear, clustering, galaxy-galaxy lensing
113
+ and 3×2pt from one object; 3PCF multipoles for any mix of spin-0 and spin-2
114
+ fields; the integrated 3PCF with its aperture filters; aperture-mass PDFs
115
+ and moments.
116
+ - **Built for suites.** Streaming HDF5 writers with provenance and resume,
117
+ loaders that hide the upload behind the measurement, multi-GPU splitting,
118
+ and an optional treecode that cuts the pair count at large separations.
119
+ - **Checked.** Every GPU kernel has a NumPy twin and a brute-force reference
120
+ test at machine precision; `mypy --strict` clean; ships `py.typed`.
121
+
122
+ ## Installation
123
+
124
+ Python 3.12 or newer:
125
+
126
+ ```bash
127
+ pip install pixpoint # CPU
128
+ pip install "pixpoint[gpu]" # + CuPy for NVIDIA GPUs (CUDA 12 build)
129
+ ```
130
+
131
+ The `gpu` extra installs `cupy-cuda12x`, which runs on any driver that
132
+ supports CUDA 12 or newer; for a CUDA 13 build install `pixpoint` and
133
+ `cupy-cuda13x` instead. PixPoint picks the GPU automatically. Details, including the
134
+ development install, in the
135
+ [installation guide](https://pixpoint.readthedocs.io/en/latest/install.html).
136
+
137
+ ## Learn more
138
+
139
+ - [Concepts](https://pixpoint.readthedocs.io/en/latest/concepts.html): maps
140
+ versus catalogues, weights and masks, what the estimators compute.
141
+ - [Two-point functions](https://pixpoint.readthedocs.io/en/latest/global2pcf.html),
142
+ [three-point functions](https://pixpoint.readthedocs.io/en/latest/global3pcf.html),
143
+ [integrated 3PCF](https://pixpoint.readthedocs.io/en/latest/integrated3pcf.html),
144
+ [one-point statistics](https://pixpoint.readthedocs.io/en/latest/onepoint.html).
145
+ - [Running on GPUs](https://pixpoint.readthedocs.io/en/latest/performance.html)
146
+ and [files and streaming](https://pixpoint.readthedocs.io/en/latest/io.html).
147
+ - [Conventions](https://pixpoint.readthedocs.io/en/latest/conventions.html)
148
+ (shear signs, bin labels, the 3PCF projection) and the formal
149
+ [estimator definitions](https://pixpoint.readthedocs.io/en/latest/estimator_note.html).
150
+
151
+ PixPoint was called CosmoFuse before version 8.0.0; `import CosmoFuse` is now
152
+ `import pixpoint`, nothing else in the API changed, and old pair files are
153
+ still read.
154
+
155
+ ## Citing
156
+
157
+ Until PixPoint has a software paper of its own, please cite the paper it was
158
+ developed for, Gebauer et al. 2026, *SBi3PCF: simulation-based inference with
159
+ the integrated 3PCF*, JCAP 06 (2026) 036
160
+ ([arXiv:2510.13805](https://arxiv.org/abs/2510.13805)), and name the PixPoint
161
+ version you used. Please also cite the papers behind the estimators you use.
162
+ The BibTeX entry and those papers are on the
163
+ [Citing](https://pixpoint.readthedocs.io/en/latest/citing.html) page.
164
+
165
+ ## Contributing
166
+
167
+ Issues and pull requests are welcome; see
168
+ [CONTRIBUTING.md](https://github.com/D-Gebauer/PixPoint/blob/main/CONTRIBUTING.md). PixPoint is released under the
169
+ [MIT licence](https://github.com/D-Gebauer/PixPoint/blob/main/LICENSE).
@@ -0,0 +1,119 @@
1
+ # PixPoint
2
+
3
+ [![CI](https://github.com/D-Gebauer/PixPoint/actions/workflows/ci.yml/badge.svg)](https://github.com/D-Gebauer/PixPoint/actions/workflows/ci.yml)
4
+ [![codecov](https://codecov.io/github/D-Gebauer/PixPoint/graph/badge.svg?token=F4JC08UEJP)](https://codecov.io/github/D-Gebauer/PixPoint)
5
+ [![Documentation](https://img.shields.io/readthedocs/pixpoint/latest?logo=readthedocs&logoColor=white)](https://pixpoint.readthedocs.io)
6
+ [![PyPI](https://img.shields.io/pypi/v/pixpoint?logo=pypi&logoColor=white)](https://pypi.org/project/pixpoint/)
7
+ [![DOI](https://zenodo.org/badge/1161690205.svg)](https://zenodo.org/badge/latestdoi/1161690205)
8
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/D-Gebauer/PixPoint/blob/main/LICENSE)
9
+
10
+ **Correlation functions of HEALPix maps, fast.**
11
+
12
+ <p align="center">
13
+ <a href="https://pixpoint.readthedocs.io"><b>Documentation</b></a> ·
14
+ <a href="https://pixpoint.readthedocs.io/en/latest/quickstart.html">Getting started</a> ·
15
+ <a href="https://pixpoint.readthedocs.io/en/latest/install.html">Installation</a> ·
16
+ <a href="https://pixpoint.readthedocs.io/en/latest/citing.html">Citing</a>
17
+ </p>
18
+
19
+ PixPoint measures two-point, three-point, integrated three-point and one-point
20
+ statistics of cosmological fields on HEALPix maps: cosmic shear, galaxy
21
+ clustering, galaxy-galaxy lensing, convergence. You give it maps and weights,
22
+ it gives you labelled results. The pixel pairs of a footprint are found once
23
+ and reused for every map, so a simulation suite costs one pair search and one
24
+ fast pass per map, on a CPU or, with the same code, on NVIDIA GPUs.
25
+
26
+ ```python
27
+ from pixpoint import Global2PCF
28
+
29
+ g2 = Global2PCF(nside=512, mask=mask, nbins=20, theta_min=2.5, theta_max=250)
30
+ g2.preprocess() # find the pixel pairs once (save_pairs / load_pairs to reuse)
31
+
32
+ res = g2.gg(shear_maps, weights) # shear_maps (nz, 2, npix), weights (nz, npix)
33
+ res.theta # bin centres, arcmin
34
+ res.xi_p, res.xi_m # (n_combinations, nbins)
35
+ res.combinations # which tomographic bins each row is
36
+
37
+ g2.kk(delta_maps, w_cov).xi # clustering w(theta)
38
+ g2.kg(delta_maps, shear_maps, w_lens, w_source).xi # galaxy-galaxy lensing gamma_t
39
+ ```
40
+
41
+ ## What it measures
42
+
43
+ | estimator | measures | methods | result |
44
+ |---|---|---|---|
45
+ | `Global2PCF` | two-point functions of the whole footprint: ξ±, w(θ), γ_t | `gg`, `kk`, `kg`, `three_by_two_pt` | `TwoPointResult` |
46
+ | `Global3PCF` | three-point functions of the whole footprint, by multipoles | `ggg`, `kkk`, `kgg`, `kkg`, `measure` | `ThreePointResult` |
47
+ | `Integrated3PCF` | aperture masses and 2PCFs in patches: the integrated 3PCF | `gg`, `kk`, `kg`, `three_by_two_pt`, `m_a`, `m_g` | `IntegratedResult` |
48
+ | `OnePoint` | PDFs and moments of aperture mass and smoothed scalar fields | `g`, `k` | `OnePointResult` |
49
+
50
+ Method names follow TreeCorr's field codes: `g` is a shear field, `k` a scalar
51
+ field such as a density contrast or convergence map. Every estimator is
52
+ tomographic, and every result carries the labels of its rows.
53
+
54
+ ## Why PixPoint
55
+
56
+ - **Exact pixel-pair estimators.** The two-point functions are ratios of
57
+ weighted sums over every pair of unmasked pixels, and agree with TreeCorr on
58
+ the pixel centres to rounding.
59
+ - **Find pairs once, measure many maps.** A full-footprint tomographic shear
60
+ 2PCF of DES Y3 at nside 512 (6.7 × 10⁸ pairs) takes 33 ms per map on an A100
61
+ after a one-off pair search; the same code runs on a laptop CPU.
62
+ - **Everything in one vocabulary.** Shear, clustering, galaxy-galaxy lensing
63
+ and 3×2pt from one object; 3PCF multipoles for any mix of spin-0 and spin-2
64
+ fields; the integrated 3PCF with its aperture filters; aperture-mass PDFs
65
+ and moments.
66
+ - **Built for suites.** Streaming HDF5 writers with provenance and resume,
67
+ loaders that hide the upload behind the measurement, multi-GPU splitting,
68
+ and an optional treecode that cuts the pair count at large separations.
69
+ - **Checked.** Every GPU kernel has a NumPy twin and a brute-force reference
70
+ test at machine precision; `mypy --strict` clean; ships `py.typed`.
71
+
72
+ ## Installation
73
+
74
+ Python 3.12 or newer:
75
+
76
+ ```bash
77
+ pip install pixpoint # CPU
78
+ pip install "pixpoint[gpu]" # + CuPy for NVIDIA GPUs (CUDA 12 build)
79
+ ```
80
+
81
+ The `gpu` extra installs `cupy-cuda12x`, which runs on any driver that
82
+ supports CUDA 12 or newer; for a CUDA 13 build install `pixpoint` and
83
+ `cupy-cuda13x` instead. PixPoint picks the GPU automatically. Details, including the
84
+ development install, in the
85
+ [installation guide](https://pixpoint.readthedocs.io/en/latest/install.html).
86
+
87
+ ## Learn more
88
+
89
+ - [Concepts](https://pixpoint.readthedocs.io/en/latest/concepts.html): maps
90
+ versus catalogues, weights and masks, what the estimators compute.
91
+ - [Two-point functions](https://pixpoint.readthedocs.io/en/latest/global2pcf.html),
92
+ [three-point functions](https://pixpoint.readthedocs.io/en/latest/global3pcf.html),
93
+ [integrated 3PCF](https://pixpoint.readthedocs.io/en/latest/integrated3pcf.html),
94
+ [one-point statistics](https://pixpoint.readthedocs.io/en/latest/onepoint.html).
95
+ - [Running on GPUs](https://pixpoint.readthedocs.io/en/latest/performance.html)
96
+ and [files and streaming](https://pixpoint.readthedocs.io/en/latest/io.html).
97
+ - [Conventions](https://pixpoint.readthedocs.io/en/latest/conventions.html)
98
+ (shear signs, bin labels, the 3PCF projection) and the formal
99
+ [estimator definitions](https://pixpoint.readthedocs.io/en/latest/estimator_note.html).
100
+
101
+ PixPoint was called CosmoFuse before version 8.0.0; `import CosmoFuse` is now
102
+ `import pixpoint`, nothing else in the API changed, and old pair files are
103
+ still read.
104
+
105
+ ## Citing
106
+
107
+ Until PixPoint has a software paper of its own, please cite the paper it was
108
+ developed for, Gebauer et al. 2026, *SBi3PCF: simulation-based inference with
109
+ the integrated 3PCF*, JCAP 06 (2026) 036
110
+ ([arXiv:2510.13805](https://arxiv.org/abs/2510.13805)), and name the PixPoint
111
+ version you used. Please also cite the papers behind the estimators you use.
112
+ The BibTeX entry and those papers are on the
113
+ [Citing](https://pixpoint.readthedocs.io/en/latest/citing.html) page.
114
+
115
+ ## Contributing
116
+
117
+ Issues and pull requests are welcome; see
118
+ [CONTRIBUTING.md](https://github.com/D-Gebauer/PixPoint/blob/main/CONTRIBUTING.md). PixPoint is released under the
119
+ [MIT licence](https://github.com/D-Gebauer/PixPoint/blob/main/LICENSE).
@@ -0,0 +1,132 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pixpoint"
7
+ version = "8.0.0"
8
+ authors = [
9
+ { name="David Gebauer", email="git@gebauer.ai" },
10
+ ]
11
+ description = "Two-point, three-point, integrated three-point and one-point statistics of HEALPix maps, on CPUs and GPUs"
12
+ readme = "README.md"
13
+ license = {text = "MIT"}
14
+ requires-python = ">=3.12"
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Science/Research",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Topic :: Scientific/Engineering :: Astronomy",
24
+ "Topic :: Scientific/Engineering :: Physics",
25
+ ]
26
+ keywords = [
27
+ "astronomy", "cosmology", "correlation-functions", "three-point-functions",
28
+ "weak-lensing", "galaxy-clustering", "galaxy-galaxy-lensing", "healpix", "gpu",
29
+ ]
30
+ dependencies = [
31
+ "numpy>=1.20.0",
32
+ "scipy>=1.9.0",
33
+ "numba>=0.50.0",
34
+ "healpy>=1.10.0",
35
+ "h5py>=3.0.0",
36
+ "tqdm",
37
+ ]
38
+
39
+ [project.optional-dependencies]
40
+ gpu = [
41
+ # The CUDA 12 wheel: plain "cupy" is the source distribution and compiles
42
+ # CuPy on install. CUDA 13 users install cupy-cuda13x themselves.
43
+ "cupy-cuda12x>=13.0.0",
44
+ ]
45
+ dev = [
46
+ "pytest>=7.0.0",
47
+ "pytest-cov>=4.0.0",
48
+ "pytest-env>=0.8.0",
49
+ "black>=22.0.0",
50
+ "isort>=5.0.0",
51
+ "flake8>=5.0.0",
52
+ "mypy>=1.0.0",
53
+ "scipy-stubs",
54
+ "pre-commit>=2.0.0",
55
+ "treecorr",
56
+ ]
57
+ docs = [
58
+ "sphinx>=7.0",
59
+ "myst-parser>=3.0",
60
+ "furo>=2024.1",
61
+ "sphinx-copybutton>=0.5",
62
+ "sphinx-design>=0.6",
63
+ ]
64
+
65
+ [project.urls]
66
+ Homepage = "https://github.com/D-Gebauer/PixPoint"
67
+ Repository = "https://github.com/D-Gebauer/PixPoint"
68
+ Documentation = "https://pixpoint.readthedocs.io"
69
+ "Bug Tracker" = "https://github.com/D-Gebauer/PixPoint/issues"
70
+
71
+ [tool.setuptools.packages.find]
72
+ where = ["src"]
73
+
74
+ [tool.setuptools.package-dir]
75
+ "" = "src"
76
+
77
+ [tool.setuptools.package-data]
78
+ "pixpoint" = ["cuda/*.cu", "cuda/*.cuh", "py.typed"]
79
+
80
+ [tool.black]
81
+ line-length = 88
82
+ target-version = ['py312']
83
+ include = '\.pyi?$'
84
+ extend-exclude = '''
85
+ /(
86
+ # directories
87
+ \.eggs
88
+ | \.git
89
+ | \.hg
90
+ | \.mypy_cache
91
+ | \.tox
92
+ | \.venv
93
+ | build
94
+ | dist
95
+ )/
96
+ '''
97
+
98
+ [tool.isort]
99
+ profile = "black"
100
+ multi_line_output = 3
101
+ line_length = 88
102
+ known_first_party = ["pixpoint"]
103
+
104
+ [tool.mypy]
105
+ python_version = "3.12"
106
+ strict = true
107
+ warn_unreachable = true
108
+
109
+ # No stubs or py.typed marker: these are typed as Any.
110
+ [[tool.mypy.overrides]]
111
+ module = ["cupy", "cupy.*", "cupyx", "cupyx.*", "h5py", "h5py.*", "healpy", "healpy.*", "tqdm", "tqdm.*"]
112
+ ignore_missing_imports = true
113
+
114
+ [tool.pytest.ini_options]
115
+ testpaths = ["tests"]
116
+ python_files = ["test_*.py"]
117
+ python_classes = ["Test*"]
118
+ python_functions = ["test_*"]
119
+ env = [
120
+ "NUMBA_DISABLE_JIT=1",
121
+ ]
122
+ # Coverage is a CI concern, not a default: forcing it here made every
123
+ # invocation -- including a single-test debug run -- instrument the whole
124
+ # package and rewrite htmlcov/. `make coverage` and the CI job ask for it.
125
+ addopts = [
126
+ "--strict-markers",
127
+ "--strict-config",
128
+ ]
129
+ markers = [
130
+ "slow: marks tests as slow (deselect with '-m \"not slow\"')",
131
+ "gpu: marks tests that require GPU",
132
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,86 @@
1
+ """
2
+ PixPoint: GPU/CPU measurement of integrated, two- and three-point correlations.
3
+
4
+ Three estimators on HEALPix maps, named after the statistic they deliver:
5
+ :class:`Integrated3PCF` (per-patch aperture masses and 2PCFs, the i3PCF
6
+ ingredients), :class:`Global2PCF` (footprint-wide 2PCFs),
7
+ :class:`Global3PCF` (footprint-wide 3PCF multipoles) and :class:`OnePoint`
8
+ (PDFs and moments of aperture fields: ``g`` for the aperture mass, ``k`` for a
9
+ filtered scalar field). Methods are TreeCorr
10
+ field codes (``g`` = shear, ``k`` = scalar field): ``gg``, ``kk``, ``kg``,
11
+ ``three_by_two_pt``, ``ggg``, ``kkk``, ``kgg``, ``kkg``. Every call returns a
12
+ labelled result (:class:`IntegratedResult`, :class:`TwoPointResult`,
13
+ :class:`ThreePointResult`, :class:`OnePointResult`).
14
+ """
15
+
16
+ from .correlation_helpers import (
17
+ Q_crittenden,
18
+ Q_schneider,
19
+ U_crittenden,
20
+ U_schneider,
21
+ U_tophat,
22
+ calculate_all_zetas,
23
+ zeta_a_g,
24
+ zeta_a_minus,
25
+ zeta_a_plus,
26
+ zeta_a_t,
27
+ zeta_g_g,
28
+ zeta_g_minus,
29
+ zeta_g_plus,
30
+ zeta_g_t,
31
+ )
32
+ from .correlations import Integrated3PCF
33
+ from .global_2pcf import Global2PCF
34
+ from .global_3pcf import Global3PCF
35
+ from .onepoint import OnePoint
36
+ from .pipeline import MapFileLoader, MapLoader
37
+ from .result_writer import OnePointWriter, ResultWriter, result_arrays
38
+ from .results import (
39
+ Component,
40
+ IntegratedResult,
41
+ OnePointResult,
42
+ ThreePointResult,
43
+ TwoPointResult,
44
+ )
45
+ from .treecode import DEFAULT_RESOLUTION_FACTOR
46
+ from .utils import pixel2RaDec, select_patch_centers
47
+ from .zeta_writer import ZetaWriter
48
+
49
+ __version__ = "8.0.0"
50
+ __author__ = "David Gebauer"
51
+ __email__ = "git@gebauer.ai"
52
+
53
+ __all__ = [
54
+ "Component",
55
+ "Global2PCF",
56
+ "Global3PCF",
57
+ "Integrated3PCF",
58
+ "IntegratedResult",
59
+ "OnePoint",
60
+ "OnePointResult",
61
+ "OnePointWriter",
62
+ "ResultWriter",
63
+ "result_arrays",
64
+ "ThreePointResult",
65
+ "TwoPointResult",
66
+ "DEFAULT_RESOLUTION_FACTOR",
67
+ "MapLoader",
68
+ "MapFileLoader",
69
+ "Q_crittenden",
70
+ "Q_schneider",
71
+ "U_crittenden",
72
+ "U_schneider",
73
+ "U_tophat",
74
+ "calculate_all_zetas",
75
+ "zeta_g_plus",
76
+ "zeta_g_minus",
77
+ "zeta_a_plus",
78
+ "zeta_a_minus",
79
+ "zeta_g_g",
80
+ "zeta_a_g",
81
+ "zeta_g_t",
82
+ "zeta_a_t",
83
+ "pixel2RaDec",
84
+ "select_patch_centers",
85
+ "ZetaWriter",
86
+ ]
@@ -0,0 +1,23 @@
1
+ """Numba entry points with types mypy can check.
2
+
3
+ ``numba.prange`` is typed as a class without ``__iter__``; to a type checker
4
+ it is ``range`` (which is also what it is with ``NUMBA_DISABLE_JIT=1``). At
5
+ run time the jitted functions see the real ``numba.prange``.
6
+ """
7
+
8
+ from typing import TYPE_CHECKING, Any, Callable
9
+
10
+ import numba
11
+ from numba import njit
12
+
13
+ if TYPE_CHECKING:
14
+ prange = range
15
+ else:
16
+ from numba import prange
17
+
18
+ #: ``numba.get_num_threads``, typed (numba < 0.68 leaves it untyped; going
19
+ #: through ``Any`` is correct for both).
20
+ _numba: Any = numba
21
+ get_num_threads: Callable[[], int] = _numba.get_num_threads
22
+
23
+ __all__ = ["get_num_threads", "njit", "prange"]
@@ -0,0 +1,22 @@
1
+ """
2
+ Backend abstraction layer for CPU (NumPy/Numba) and GPU (CuPy/CUDA) execution.
3
+
4
+ All correlation measurement kernels exist in two forms:
5
+ - **CPU**: Numba @njit functions with parallel=True for multi-core execution
6
+ - **GPU**: CuPy ElementwiseKernels for simple per-pair operations, and
7
+ compiled CUDA kernels (.cu files in cuda/) for fused/vectorised
8
+ tomographic operations, launched through :class:`raw.TypedKernel`
9
+ (every launch checked against the signature parsed from the source)
10
+
11
+ One module per kernel family, CPU kernel and GPU wrapper side by side:
12
+ :mod:`.aperture` (M_ap, M_g), :mod:`.density` (ξ_g, ξ_t), :mod:`.shear`
13
+ (ξ±), :mod:`.three_by_two` (the fused 3x2pt path), :mod:`.degrade` (treecode
14
+ rows), :mod:`.threepoint` (step 1 of Global3PCF); :mod:`.combinations` holds
15
+ the tomographic layouts of the tiled kernels, :mod:`.raw` compiling and
16
+ launching, :mod:`.core` the :class:`Backend` that holds the active kernel set
17
+ and provides to_device()/to_numpy() for data movement.
18
+ """
19
+
20
+ from .core import Backend, get_backend, safe_divide
21
+
22
+ __all__ = ["Backend", "get_backend", "safe_divide"]