calc_stat

sherpa.astro.ui.calc_stat(id=None, *otherids)

Calculate the fit statistic for a data set.

Evaluate the model for one or more data sets, compare it to the data using the current statistic, and return the value. No fitting is done, as the current model parameter, and any filters, are used.

Parameters:
  • id (int or str, optional) – The data set to use. If not given then the default identifier is used, as returned by get_default_id.
  • *otherids (int or str, optional) – Include multiple data sets in the calculation.
Returns:

stat – The current statistic value.

Return type:

number

See also

calc_chisqr()
Calculate the per-bin chi-squared statistic.
calc_stat_info()
Display the statistic values for the current models.
set_stat()
Set the statistical method.

Examples

Calculate the statistic for the model and data in the default data set:

>>> stat = calc_stat()

Use the data sets labelled “core” and “jet”:

>>> stat = calc_stat("core", "jet")

Calculate the statistic value using two different statistics:

>>> set_stat('cash')
>>> s1 = calc_stat()
>>> set_stat('cstat')
>>> s2 = calc_stat()