A novel reinterpretation method for high-energy physics results.
Overview
This is the implementation of a reweighing method for the reinterpretation of binned analyses in high energy physics. The method is based on calculating the change in the distributions of observables, given changes in the decay channel's kinematic distributions.
Check out the paper here.
Installation
You can install redist from pypi
pip install redistpy
Manual installation
You can install manually with
# Clone this repository
git clone https://github.com/lorenzennio/redist.git
# Install
pip install -e redist
Dependencies
This implementation is based on the pyhf software for statistical inference. The examples use the EOS software to calculate theoretical predictions.
Gradients with JAX (optional)
redist runs on any pyhf backend. On the JAX backend the likelihood becomes
differentiable, so it can be used with jax.grad, jax.jit and jax.vmap:
pip install redistpy[jax]
import pyhf, jax, jax.numpy as jnp
from redist import modifier
pyhf.set_backend("jax") # set the backend *before* building the modifier
model = modifier.load("model.json", alt_dist, null_dist)
grad = jax.grad(lambda pars: model.logpdf(pars, data)[0])(pars)
The distributions must accept broadcast arrays and be written with operations
JAX can trace: jax.numpy rather than scipy, and no Python if on parameter
values. Adaptive quadrature cannot be traced, so the fallback described below
does not apply here.
Theory codes that are not written in JAX — EOS, for example — therefore
cannot be differentiated through. Using them still works on the NumPy backend.
Bayesian inference (optional)
If you want to perform Bayesian inference with redist (or pyhf) you'll need to install bayesian_pyhf.
You can do so with::
pip install git+https://github.com/malin-horstmann/bayesian_pyhf.git
For visualization of the posterior distribution, corner is very useful:
pip install corner
Bin integrals
The bin integrals use fixed-order Gauss-Legendre quadrature, which calls each
distribution once with one broadcast array per kinematic dimension. A theory
code that can only be evaluated a point at a time — EOS, for example — is
detected when the modifier is built and falls back to adaptive quadrature, one
to two orders of magnitude slower. cmod.quad reports which rule was picked,
and quad="gauss" or quad="nquad" forces one.
Contact
If you come across a bug, have an issue or a question, please file an issue. For further inquiries, you can talk to us via Discord.
License
MIT
Metadata
Release files for redistpy 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| redistpy-2.0.0.tar.gz | 17.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| redistpy-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.7 kB
Release files / redistpy-2.0.0.tar.gz
| Download URL | redistpy-2.0.0.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00060200f62de6f92c07502502138539505ca80634edf9e1752a1048c46db9a4
|
|
BLAKE2b-256 checksum How to use checksums |
1ec869543e2d083775714a6b6f338e0bec98f97230344a0899c2c8ff9feb17e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency logRelease files / redistpy-2.0.0-py3-none-any.whl
| Download URL | redistpy-2.0.0-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04be984c09dddc88330afab7f204e7183c48237e8950bbc8a4bb99db8f3e4860
|
|
BLAKE2b-256 checksum How to use checksums |
7b7bb2737540c2df8f8ffa7a16929e0461b553af34f0613d092ed3799c9004c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency log