    Calculate the per-bin chi-squared statistic.

calc_chisqr(id=None, *otherids)
id - int or str, optional
*otherids - int or str, optional

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.

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.

>>> calc_chisqr()

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)

PARAMETERS

The parameters for this function are:

Parameter
Definition
id
The data set that provides the data. If not given then all data sets with an associated model are used simultaneously.
*otherids
Other data sets to use in the calculation.

The return value from this function is:

chisq -- The chi-square value for each bin of the data, using the current statistic (as set by `set_stat` ). A value of

none is returned if the statistic is not a chi-square distribution.

Notes

The output array length equals the sum of the arrays lengths of the requested data sets.

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

December 2023