get_rate

sherpa.astro.ui.get_rate(id=None, filter=False, bkg_id=None)

Return the count rate of a PHA data set.

Parameters:
  • id (int or str, optional) – The identifier for the data set to use. If not given then the default identifier is used, as returned by get_default_id.
  • filter (bool, optional) – Should the filter attached to the data set be applied to the return value or not. The default is False.
  • bkg_id (int or str, optional) – Set if the rate should be taken from the background associated with the data set.
Returns:

rate – The rate array. The output matches the grouping of the data set. The units are controlled by the set_analysis setting for this data set; that is, the units used in plot_data. The return array will match the grouping scheme applied to the data set.

Return type:

array

Raises:

sherpa.utils.err.ArgumentErr – If the data set does not contain PHA data.

See also

get_dep()
Return the data for a data set.
ignore()
Exclude data from the fit.
notice()
Include data in the fit.
plot_data()
Plot the data values.
set_analysis()
Set the units used when fitting and displaying spectral data.

Examples

>>> rate = get_rate()

The rate of data set 2 will be in units of count/s/Angstrom and only cover the range 20 to 22 Angstroms:

>>> set_analysis(2, 'wave')
>>> notice_id(2, 20, 22)
>>> r2 = get_rate(2, filter=True)