Last modified: December 2023

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/calc_bkg_stat.html
AHELP for CIAO 4.16 Sherpa

calc_bkg_stat

Context: sherpaish

Synopsis

Calculate the fit statistic for a background data set.

Syntax

calc_bkg_stat(id=None, *otherids)

id - int or str, optional
*otherids - int or str, optional

Description

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.


Examples

Example 1

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

>>> stat = calc_bkg_stat()

Example 2

Find the statistic for the background for data set 3:

>>> stat = calc_bkg_stat(3)

Example 3

Calculate the background statistic value using two different statistics:

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

PARAMETERS

The parameters for this function are:

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

Return value

The return value from this function is:

stat -- The current statistic value.

Changes in CIAO

Added in CIAO 4.16


Bugs

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

See Also

fitting
fit_bkg
sherpaish
calc_bkg_stat_info, get_bkg_stat_info