slophep.Fitting.CostFuncs

class slophep.Fitting.CostFuncs.Chi2Correlated(pdf: PDFBase, param_manager: ParameterManager, data: ndarray, cov: ndarray, normPDF_before_eval: bool = False, ignore_constraint: bool = False)[source]

Bases: FigureOfMerit

chi2_correlated() float[source]

Return chi2 for correlated bins, (obs - pred) * invcov * (obs - pred)

property cov: ndarray

Covariance matrix

property invcov: ndarray

Inverse covariance matrix

class slophep.Fitting.CostFuncs.Chi2Uncorrelated(pdf: PDFBase, param_manager: ParameterManager, data: ndarray, dataErr: ndarray, normPDF_before_eval: bool = False, ignore_constraint: bool = False)[source]

Bases: FigureOfMerit

class slophep.Fitting.CostFuncs.FigureOfMerit(pdf: PDFBase, param_manager: ParameterManager, data: ndarray, dataErr: ndarray = array([], dtype=float64), normPDF_before_eval: bool = False, ignore_constraint: bool = False)[source]

Bases: object

calc_nllW2(paramvals: list[float]) float[source]

Calculate -2LL with SumW2 for particular set of parameters

Parameters:

paramvals (list[float])

Return type:

float

chi2_uncorrelated() float[source]

Uncorrelated chi2

property data: ndarray

Data to fit

property dataErr: ndarray

Uncertainties of data

property dataNorm: float

Sum of data yield

get_constraint_term() float[source]

Get FoM constraint term

Returns:

Gaussian likelihood term. Return 0 if ignore_constraint == True.

Return type:

float

get_model() ndarray[source]

Fit model

property ignore_constraint: bool

Whether to ignore constraint terms in the likelihood/figure of merit

nll() float[source]

Returns -2LL

nllW2() float[source]

Return -2LL with SumW2, to use for uncertainties

property param_list: list[str]

List of parameters

property param_manager: ParameterManager

The parameter manager

property pdf: PDFBase

PDF to calculate FoM for

property scaleFactorW2: ndarray

Scale factor for sumW2 likelihood

setVal(parname_man: str, val: float)[source]

Set parameter value

setVals(pars_man: dict[str, float])[source]

Set value for several parameters, with dictionary {manager_name : value}

updateVals(paramvals: list[float])[source]

Update all parameter values with list input in order of self.param_list