probfit¶
probfit is a set of functions that helps you construct a complex fit. It is intended to be used with iminuit. The tool includes Binned/Unbinned Likelihood estimator, \(\chi^2\) regression, binned \(\chi^2\) estimator and Simultaneous fit estimator. Normalization and convolution with cache are also included. Various builtin functions used in B physics are also provided.
In a nutshell:
import numpy as np
from iminuit import Minuit
from probfit import UnbinnedLH, gaussian
data = np.random.randn(10000)
unbinned_likelihood = UnbinnedLH(gaussian, data)
minuit = Minuit(unbinned_likelihood, mean=0.1, sigma=1.1)
minuit.migrad()
unbinned_likelihood.draw(minuit)
Probfit was created by Piti Ongmongkolkul (piti118@gmail.com). It is currently maintained by the Scikit-HEP community.
Download & Install¶
From pip:
pip install probfit
or get the latest development from github:
pip install git+https://github.com/scikit-hep/probfit.git
Tutorial¶
The tutorial consists of an IPython notebook in the tutorial directory. You can view it online too.
Commonly used API¶
Refer to Full API Documentation for complete reference.
Cost Functions¶
Refer to Cost Function.
|
Construct -log(unbinned likelihood) from callable f and data points data. |
|
Create a Poisson Binned Likelihood object from given PDF f and data (raw points not histogram). |
|
Create \(\chi^2\) regression object. |
|
Create Binned Chi2 Object. |
|
Construct simultaneous fit from given cost functions. |
Functors¶
Refer to Functor
|
Transformed PDF in to a normalized version. |
|
Transformed given f into extended from. |
|
Make convolution from supplied f and g. |
|
Directly add PDF without normalization nor factor. |
|
Add PDF with normalization factor. |
|
Rename function parameters. |
And corresponding decorator
|
Normalized decorator |
|
Extended decorator |
Builtin Functions¶
Refer to Builtin PDF. This list can grow: implement your favorite function and send us pull request.
|
Normalized gaussian. |
|
Unnormalized crystal ball function. |
|
Unnormalized double crystal ball function A gaussian core with two power tails |
|
Unnormalized cruijff function |
|
Cauchy distribution aka non-relativistic Breit-Wigner |
|
Normalized Relativistic Breit-Wigner |
|
Unnormalized double gaussian |
_JohnsonSU(xname=’x’) |
|
|
Unnormalized argus distribution |
_Linear() |
|
|
Parabola |
|
Polynomial of third order |
|
Unnormalized Novosibirsk |
|
A histogram PDF. |
|
Polynomial. |
Useful utility¶
You may find these functions useful in interactive environment.
|
Apply f to array x with given arguments fast. |
|
draw pdf with given argument and bounds. |
|
draw histogram of data with poisson error bar and f(x,*arg). |
Development¶
If you’d like to develop with the probfit source code, see the Development section.