professor is hosted by Hepforge, IPPP Durham


GoF calculators

Interface for the generic Professor goodness of fit (GoF) calculator object, and commonly-used derivations and concrete implementations of that interface for various kinds of chi^2 and similar measures.

TODO: make interface sufficiently generic that it can do very specific things like optimising the difference between sets of histograms (e.g. for observable optimisation.)

class professor.fitfunctions.SimpleIpolChi2(tunedata, epsilon=0.0, withcorrelation=False)

Bases: professor.fitfunctions.BaseChi2

Calculating chi^2/Ndf from the interpolations.

The parameter point needs to be set before the chi^2 calculation with setParams().

The use_ref_error and use_mc_error properties determine how the error terms in the chi^2 are defined. The “epsilon” term is an extra fractional error to be used as a regulariser, i.e. a minimum possible systematic error beyond that seen from the reference or statistical plot errors.

TODO: allow the epsilon factors to be set in a distribution-specific way like the observable weights (including by ranges, by specific bins, etc.)



Calculate and return the chi^2 at the currently-set parameter point.

When correlation consideration is disabled from command line, the old code is used where chi2 is calculated cumulatively.

Otherwise, a dictionary for all observables considered in the tuning is built-up.

From the bins in this dictionary a covariance matrix can be calculated (from a given correlation file), and later on the chi2 can be obtained from a matrix relation.

findCovarianceMatrix(obsname, binval)

Reads covariance matrix from file.

Every line corresponds to one bin in the reference data definition. Following form has to be followed: uncorr uncertainties — corr uncertainties There can be multiple entries for uncertainties separated by whitespace. Remember to separate correlated from uncorrelated unc. by —.

The files should be created with prof-lsobs (for correct filename and path) and filled afterwards.

minimumOverlapCovariance(referr2, err2)

This method is a first-guess-method if there’s no exact information about correlations. We assume the covariance between bins i, j to be:

cov_i,j = min(sigma_i, sigma_j)**2

This gives a conservative guess of the correlations and uncertainties.

The method was applied e.g. in CERN-PH-EP-2010-089 (OPAL), arXiv:1101.1470.


Set the parameter point. Argument type should either be a ParameterPoint or a dict.

Returns self to allow chaining for convenience.

class professor.fitfunctions.SimpleMCChi2(tunedata, run)

Bases: professor.fitfunctions.SimpleIpolChi2

Chi2 between MC data from `run’ and ref data.



Calculate the Ndof as sum of weights.

setParams(*args, **kwargs)

Overwrite setParams method of SimpleIpolChi2.

Overwrite setParams to make programming errors more obvious.

class professor.fitfunctions.SingleSimpleIpolChi2(tunedata, obs)

Bases: professor.fitfunctions.SimpleIpolChi2

Class for calculating GoF of a single observable. Obs is a string with the observable name.



Return the chi2 per bin measure.


This returns the number of bins - number of parameters are unaccounted for, should be sensible in case of 1Bin observables.


The number of bins in self.obs.


Number of bins in observable self.obs


observable path to calculate chi2 for.


Set the observable to calculate the GoF for.

class professor.fitfunctions.SingleSimpleMCChi2(tunedata, obs, run)

Bases: professor.fitfunctions.SingleSimpleIpolChi2

setParams(*args, **kwargs)

Overwrite setParams method of SimpleIpolChi2.

Overwrite setParams to make programming errors more obvious.

Previous topic


Next topic


This Page