- sherpa.ui.calc_chisqr(id=None, *otherids)
Calculate the per-bin chi-squared statistic.
Evaluate the model for one or more data sets, compare it to the data using the current statistic, and return an array of chi-squared values for each bin. No fitting is done, as the current model parameter, and any filters, are used.
chisq – The chi-square value for each bin of the data, using the current statistic (as set by
set_stat). A value of
Noneis returned if the statistic is not a chi-square distribution.
- Return type
The output array length equals the sum of the arrays lengths of the requested data sets.
When called with no arguments, the return value is the chi-squared statistic for each bin in the data sets which have a defined model.
Supplying a specific data set ID to calc_chisqr - such as “1” or “src” - will return the chi-squared statistic array for only that data set.
>>> calc_chisqr(1) >>> calc_chisqr("src")
Restrict the calculation to just datasets 1 and 3:
>>> calc_chisqr(1, 3)