probfit is a set of functions that helps you construct a complex fit. It’s 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 function that’s normally used in B physics is also provided.
From pip:
pip install probfit
or get the latest development from github:
git clone git://github.com/iminuit/probfit.git
Tutorial is in the tutorial directory. You can view it online too.
Refer to Full API Documentation for complete reference.
Refer to Cost Function.
| UnbinnedLH | UnbinnedLH(f, data, weights=None, extended=False, extended_bound=None, extended_nint=100, badvalue=-100000) |
| BinnedLH | BinnedLH(f, data, bins=40, weights=None, bound=None, badvalue=1000000, extended=False, use_w2=False, nint_subdiv=1) |
| Chi2Regression | Chi2Regression(f, x, y, error=None, weights=None) |
| BinnedChi2 | BinnedChi2(f, data, bins=40, weights=None, bound=None, sumw2=False, nint_subdiv=1) |
| SimultaneousFit | SimultaneousFit(factors=None, *arg, prefix=None, skip_prefix=None) |
Refer to Functor
| Normalized | Normalized(f, bound, nint=300, warnfloat=1) |
| Extended | Extended(f, extname=’N’) |
| Convolve | Convolve(f, g, gbound, nbins=1000) |
| AddPdf | AddPdf(prefix=None, *arg, factors=None, skip_prefix=None) |
| AddPdfNorm | AddPdfNorm(facname=None, *arg, prefix=None, skip_prefix=None) |
| rename(f, newarg) | Rename function parameters. |
And corresponding decorator
| normalized(bound[, nint]) | Normalized decorator |
| extended([extname]) | Extended decorator |
Refer to Builtin PDF. This list can grow: implement your favorite function and send us pull request.
| gaussian((double x, double mean, ...) | Normalized gaussian. |
| crystalball((double x, double alpha, ...) | Unnormalized crystal ball function .. |
| cruijff((double x, double m_0, ...) | Unnormalized cruijff function .. |
| cauchy((double x, double m, ...) | Cauchy distribution aka non-relativistic Breit-Wigner |
| rtv_breitwigner((double x, double m, ...) | Normalized Relativistic Breit-Wigner |
| doublegaussian((double x, double mean, ...) | Unnormalized double gaussian .. |
| argus((double x, double c, double chi, ...) | Unnormalized argus distribution .. |
| linear | _Linear() |
| poly2((double x, double a, double b, ...) | Parabola .. |
| poly3((double x, double a, double b, ...) | Polynomial of third order .. |
| novosibirsk((double x, double width, ...) | Unnormalized Novosibirsk |
| HistogramPdf | HistogramPdf(hy, binedges, xname=’x’) |
| Polynomial | Polynomial(order, xname=’x’) .. |
You may find these functions useful in interactive environment.
| vector_apply(f, x, *arg) | apply f to array x with given arguments fast. This is a fast |
| draw_pdf(f, arg, bound[, bins, scale, ...]) | draw pdf with given argument and bounds. |
| draw_compare_hist(f, arg, data[, bins, ...]) | draw histogram of data with poisson error bar and f(x,*arg). |