Repository navigation
Releases
Releases · mirkobunse/caife
v0.1.0: First release
caife is a Python package for unfolding: the reconstruction of a target distribution, like an energy spectrum, from indirect and smeared observations. Its name stands for Composable and Auto-differentiable Inversion of Fredholm Equations.
pip install caife
The package is in an early stage of development (alpha). Its API might change in future 0.x releases.
What caife offers
- Models of the measurement process:
LinearCountModelfor a single target quantity andMultiTargetModelfor joint, multi-dimensional target spectra, e.g., over energy and zenith angle. Their counterpartsLinearSystematicsCountModelandMultiTargetSystematicsModelfit systematic parameters of the detector jointly with the spectrum. All models can account for a background distribution. - Representations of the observed features:
UnivariateBinning,GridBinning,TreeBinning(data-driven bins from a decision tree), andGridSearchRepresentationfor tuning the hyper-parameters of a representation. - Freely definable losses: you write the negative log-likelihood of your analysis with JAX, e.g., from
poisson_nllandtikhonov_regularization, which can penalize deviations from polynomials of any order. caife differentiates it automatically. - Robust fits:
ScipySolverminimizes your loss with second-order optimization, starting from several random points. Only solutions with a positive definite Hessian count as valid. Latent parameterizations guarantee positive spectra with the observed total number of events and keep systematic parameters within their simulated range. - Uncertainties:
uncertainty_from_auxsamples around the solution in the latent space, so that the asymmetric ±1 sigma intervals respect all constraints, including the regularization and the fitted systematics. - Choosing the regularization strength:
gcc_from_auxandpcs_from_auxcompute global correlation coefficients and pair-wise correlation scores of the fitted parameters, marginalizing nuisance parameters like overflow bins and systematics. - Toy data and examples:
caife.examplesgenerates simulated data with a known truth, which the notebooksexamples/quickstart.ipynbandexamples/systematics.ipynbuse to walk through complete analyses.
Getting started
caife requires Python 3.9 or later and depends on JAX (version 0.4.25 or later). A GPU-powered JAX backend is optional.
- Quickstart: https://github.com/mirkobunse/caife/blob/main/examples/quickstart.ipynb
- Documentation: https://mirkobunse.github.io/caife
caife is licensed under the GNU Lesser General Public License, version 2.1 only (LGPL-2.1-only).