calc_bkg_stat

sherpa.astro.ui.calc_bkg_stat(id: IdType | None = None, *otherids: IdType)

Calculate the fit statistic for a background data set.

Evaluate the current background models for the background datasets, calculate the statistic for each background, and return the sum. No fitting is done, as the current model parameter, and any filters, are used. The calc_bkg_stat_info routine should be used if the result for a particular background component needs to be returned.

Added in version 4.16.0.

Parameters:
  • id (int, str, or None, optional) – The data set that provides the data. If not given then all background data sets with an associated background model are used simultaneously.

  • *otherids (int or str, optional) – Other data sets to use in the calculation.

Returns:

stat – The current statistic value.

Return type:

number

Examples

Calculate the statistic for the background in the default data set:

>>> stat = calc_bkg_stat()

Find the statistic for the background for data set 3:

>>> stat = calc_bkg_stat(3)

Calculate the background statistic value using two different statistics:

>>> set_stat('chi2datavar')
>>> s1 = calc_bkg_stat()
>>> set_stat('chi2gehrels')
>>> s2 = calc_bkg_stat()