Metadata-Version: 2.4
Name: sum_stat
Version: 0.4.0
Summary: Cosmological summary statistics from galaxy catalogues and lensing data
Author-email: Johan Comparat <johan.comparat@pm.me>
License: MIT License
        
        Copyright (c) 2026 Johan Comparat
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/JohanComparat/sum_stat
Project-URL: Documentation, https://sum-stat.readthedocs.io
Project-URL: Repository, https://github.com/JohanComparat/sum_stat
Project-URL: Bug Tracker, https://github.com/JohanComparat/sum_stat/issues
Keywords: cosmology,summary statistics,galaxy surveys,JAX,two-point correlation,luminosity function,stellar mass function,galaxy-galaxy lensing,Sunyaev-Zeldovich effect
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: astropy
Requires-Dist: jax
Requires-Dist: h5py
Requires-Dist: healpy
Requires-Dist: treecorr
Requires-Dist: corrfunc
Requires-Dist: scikit-learn
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Provides-Extra: knn
Requires-Dist: pyfnntw; extra == "knn"
Provides-Extra: lensing
Requires-Dist: dsigma; extra == "lensing"
Provides-Extra: sz
Requires-Dist: pixell; extra == "sz"
Provides-Extra: numba
Requires-Dist: numba; extra == "numba"
Provides-Extra: scripts
Requires-Dist: matplotlib; extra == "scripts"
Requires-Dist: tqdm; extra == "scripts"
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"
Requires-Dist: sphinxcontrib-napoleon; extra == "docs"
Requires-Dist: numpydoc; extra == "docs"
Requires-Dist: myst-parser; extra == "docs"
Dynamic: license-file

# sum_stat

[![PyPI version](https://img.shields.io/pypi/v/sum-stat)](https://pypi.org/project/sum-stat/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
[![CI](https://github.com/JohanComparat/sum_stat/actions/workflows/ci.yml/badge.svg)](https://github.com/JohanComparat/sum_stat/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/JohanComparat/sum_stat/branch/main/graph/badge.svg)](https://codecov.io/gh/JohanComparat/sum_stat)
[![Documentation](https://readthedocs.org/projects/sum-stat/badge/?version=latest)](https://sum-stat.readthedocs.io/en/latest/)

Python wrapper package for measuring cosmological summary statistics from galaxy catalogues and lensing data. Careful, this is an early version, use at own risk !

## Estimators

**Stable** — production-ready, covered by shape, consistency, and analytic-recovery tests:

* Luminosity and stellar mass functions (1/V<sub>max</sub>, SWML, C⁻, STY, Efron–Petrosian τ, Rauzy)
* Angular correlation function w(θ)
* Projected correlation function w<sub>p</sub>(r<sub>p</sub>), ξ(r), ξ<sub>ℓ</sub>(s)
* Excess surface density ΔΣ (galaxy-galaxy lensing)

**In development** — APIs may change, not yet validated for science; see
[development_estimators](https://sum-stat.readthedocs.io/en/latest/development_estimators.html):

* Thermal SZ: stacked galaxy × Compton-y Σ<sub>y</sub>(r<sub>p</sub>) and compensated
  aperture photometry T<sub>AP</sub>(θ<sub>d</sub>) on ACT DR6 maps
* Power spectra C<sub>ℓ</sub>, P<sub>ℓ</sub>(k)
* k-nearest-neighbour CDFs
* Redshift distributions n(z)

All estimators write self-documenting HDF5 with units and cosmology provenance.

## Installation

```bash
pip install sum-stat
```

Some estimators need optional extras:

```bash
pip install 'sum-stat[sz]'        # pixell — thermal SZ on CAR maps
pip install 'sum-stat[lensing]'   # dsigma — ΔΣ pipeline
pip install 'sum-stat[knn]'       # pyfnntw — kNN backend (needs a Rust toolchain)
pip install 'sum-stat[scripts]'   # matplotlib, tqdm — the scripts/ pipeline and plots
```

See [pypi.org/project/sum-stat](https://pypi.org/project/sum-stat/) for details, and the
[documentation](https://sum-stat.readthedocs.io/en/latest/) for the user guide and API reference.

## Citation

If you use `sum_stat` in your research, please cite it as:

```bibtex
@software{comparat2026sumstat,
  author  = {Comparat, Johan},
  title   = {{sum\_stat}: Cosmological summary statistics from galaxy catalogues and lensing data}, 
  year    = {2026},
  version = {0.4.0},
  url     = {https://github.com/JohanComparat/sum_stat},
  license = {MIT},
}
```

A `CITATION.cff` file is also provided for automated citation tools (GitHub "Cite this repository" button).

## Contributing

Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, coding conventions, and how to submit a pull request.

## License

MIT — see [LICENSE](LICENSE).

## Package structure

```
sum_stat/
├── sum_stat/
│   ├── catalogue.py       # GalaxyCatalogue, ShapeCatalogue, PhotoZCalibTable
│   ├── cosmology.py       # JAX-differentiable distances and Σ_crit
│   ├── covariance/        # jackknife_covariance, bootstrap_covariance
│   ├── io/                # SummaryStatWriter, SummaryStatReader
│   ├── lensing/           # delta_sigma
│   ├── lf_smf/            # 1/Vmax, SWML, C⁻, STY, EP τ, Rauzy
│   ├── twopcf/            # w_theta, wp, xi_r, xi_multipoles
│   ├── sz/                # stacked_y, stacked_cap, binning  [development]
│   ├── knn/               # knn_cdf, cross_knn_cdf          [development]
│   ├── nz/                # nz_histogram, nz_kde            [development]
│   └── powspec/           # cl_angular, pk3d, pk_multipoles [development]
├── tests/
├── docs/
├── environment.yml
└── pyproject.toml
```
