UserStat

class sherpa.stats.UserStat(statfunc=None, errfunc=None, name='userstat')[source]

Bases: sherpa.stats.Stat

Support simple user-supplied statistic calculations.

Notes

This class is used by the sherpa.ui.load_user_stat to provide a user-definable statistic calculation as a function. For more complicated cases it is suggested that users should write their own class instead of using this one.

Methods Summary

calc_stat(data, model) Return the statistic value for the data and model.
calc_staterror(data) Return the statistic error values for the data.
set_errfunc(func)
set_statfunc(func)

Methods Documentation

calc_stat(data, model)[source]

Return the statistic value for the data and model.

Parameters:
  • data (a Data or DataSimulFit instance) – The data set, or sets, to use.
  • model (a Model or SimulFitModel instance) – The model expression, or expressions. If a SimulFitModel is given then it must match the number of data sets in the data parameter.
Returns:

statval, fvec – The statistic value and the per-bin “statistic” value.

Return type:

number, array of numbers

calc_staterror(data)[source]

Return the statistic error values for the data.

Parameters:data (scalar or 1D array of numbers) – The data values.
Returns:staterror – The errors for the input data values (matches the data argument).
Return type:scalar or array of numbers
set_errfunc(func)[source]
set_statfunc(func)[source]