Metadata-Version: 2.5
Name: binference
Version: 0.1.0
Summary: Population and hierarchical inference with PDFs: honest population distributions from noisy per-object PDFs over bins.
Project-URL: Homepage, https://github.com/joshspeagle/binference
Project-URL: Source, https://github.com/joshspeagle/binference
Project-URL: Documentation, https://joshspeagle.github.io/binference/
Project-URL: Issues, https://github.com/joshspeagle/binference/issues
Author: Joshua S. Speagle
License-Expression: MIT
License-File: LICENSE
Keywords: bayesian,deconvolution,dirichlet,hierarchical,mcmc,photometric redshifts,population inference,quantification,unfolding
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.13
Requires-Dist: numpy>=2.1
Requires-Dist: scipy>=1.14.1
Requires-Dist: threadpoolctl>=3.1
Provides-Extra: all
Requires-Dist: matplotlib>=3.9.2; extra == 'all'
Requires-Dist: xarray>=2024.10; extra == 'all'
Provides-Extra: dev
Requires-Dist: fonttools>=4.47; extra == 'dev'
Requires-Dist: ipykernel>=6; extra == 'dev'
Requires-Dist: matplotlib>=3.9.2; extra == 'dev'
Requires-Dist: myst-nb>=1.1; extra == 'dev'
Requires-Dist: numpydoc>=1.6; extra == 'dev'
Requires-Dist: pre-commit>=3; extra == 'dev'
Requires-Dist: pytest-cov>=5; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: sphinx-copybutton>=0.5; extra == 'dev'
Requires-Dist: sphinx>=7.2; extra == 'dev'
Requires-Dist: sphinxcontrib-bibtex>=2.6; extra == 'dev'
Requires-Dist: xarray>=2024.10; extra == 'dev'
Provides-Extra: docs
Requires-Dist: fonttools>=4.47; extra == 'docs'
Requires-Dist: ipykernel>=6; extra == 'docs'
Requires-Dist: matplotlib>=3.9.2; extra == 'docs'
Requires-Dist: myst-nb>=1.1; extra == 'docs'
Requires-Dist: numpydoc>=1.6; extra == 'docs'
Requires-Dist: sphinx-copybutton>=0.5; extra == 'docs'
Requires-Dist: sphinx>=7.2; extra == 'docs'
Requires-Dist: sphinxcontrib-bibtex>=2.6; extra == 'docs'
Provides-Extra: plot
Requires-Dist: matplotlib>=3.9.2; extra == 'plot'
Provides-Extra: test
Requires-Dist: matplotlib>=3.9.2; extra == 'test'
Requires-Dist: pytest-cov>=5; extra == 'test'
Requires-Dist: pytest>=8; extra == 'test'
Provides-Extra: xarray
Requires-Dist: xarray>=2024.10; extra == 'xarray'
Description-Content-Type: text/markdown

# binference

**Population and hierarchical inference with PDFs.**

Many objects are each measured with noise: galaxies, merger events, patients,
classified documents. binference reads each object's likelihood, posterior, samples,
binned measurement or classifier output. From these it infers the population the objects
come from, with calibrated uncertainty, and each object's posterior under that
population.

![Population posteriors for a mock catalogue][figure]

[figure]: https://raw.githubusercontent.com/joshspeagle/binference/main/docs/_static/quickstart.png

*The population inferred from 2000 simulated objects, under the default Dirichlet prior
(top) and a Gaussian-process prior (bottom). Each panel shows the posterior median, its
68% and 95% intervals, the true density (dashed) and the stacked estimate (dotted).*

## Install

```bash
pip install "binference[plot]"
```

The [installation page](https://joshspeagle.github.io/binference/start/install.html)
lists the extras and the supported Python versions.

## Example

```python
import binference

bins = binference.Bins.linear(0.0, 3.0, 15)

# a simulated stand-in for your arrays: measured values and their Gaussian errors
mock = binference.simulate.mock_1d(2000, bins, rng=42)
z_obs, z_err = mock.measurements["mean"], mock.measurements["sigma"]

lk = binference.Likelihoods.from_gaussian(z_obs, z_err, bins)
result = binference.infer(lk, rng=1)  # method="auto" chooses the engine
print(result.summary())
```

## Documentation

- [Quick start][quickstart]
- [Is binference right for my data?][is-it-right]
- [Tutorials][tutorials]
- [Full documentation][docs]

[quickstart]: https://joshspeagle.github.io/binference/start/quickstart.html
[is-it-right]: https://joshspeagle.github.io/binference/start/is-it-right.html
[tutorials]: https://joshspeagle.github.io/binference/tutorials/index.html
[docs]: https://joshspeagle.github.io/binference/

To contribute, see [`CONTRIBUTING.md`][contributing].

[contributing]: https://github.com/joshspeagle/binference/blob/main/CONTRIBUTING.md

## Status and citing

binference is alpha software, and its API may change before 1.0. If you use it, please
cite it as described on the [citing page][citing].

[citing]: https://joshspeagle.github.io/binference/reference/citing.html

## License

MIT; see [LICENSE](https://github.com/joshspeagle/binference/blob/main/LICENSE).
