PyUnfold

PyUnfold is a Python package for implementing iterative unfolding [1]

PyUnfold provides an unfolding toolkit for members of all scientific disciplines with a simple, user-friendly API. Implementing an unfolding with PyUnfold only takes a few lines of code.

from pyunfold import iterative_unfold

# Observed distributions
data = [100, 150]
data_err = [10, 12.2]

# Response matrix
response = [[0.9, 0.1],
            [0.1, 0.9]]
response_err = [[0.01, 0.01],
                [0.01, 0.01]]

# Detection efficiencies
efficiencies = [1, 1]
efficiencies_err = [0.01, 0.01]

# Perform iterative unfolding
unfolded_result = iterative_unfold(data=data,
                                   data_err=data_err,
                                   response=response,
                                   response_err=response_err,
                                   efficiencies=efficiencies,
                                   efficiencies_err=efficiencies_err)

Questions & Bug Reports

PyUnfold is an open-source project and contributions are always welcome from anyone. If you have a question, would like to propose a new feature, or submit a bug report, feel free to open up an issue on our issue tracker on GitHub.

[1]
  1. D’Agostini, “A Multidimensional unfolding method based on Bayes’ theorem”, Nucl. Instrum. Meth. A 362 (1995) 487.