    Set the units used when fitting and displaying spectral data.

set_analysis(id, quantity=None, type='rate', factor=0)
id - int or str
quantity - { 'channel', 'chan', 'bin', 'energy', 'ener', 'wavelength', 'wave' }
type - { 'rate', 'counts' }, optional
factor - int, optional

The set_analysis command sets the units for spectral analysis. Note that in order to change the units of a data set from 'channel' to 'energy' or 'wavelength', the appropriate ARF and RMF instrument response files must be loaded for that data set. The type and factor arguments control how the data is plotted.

Set all loaded data sets to use wavelength for any future fitting or display.

>>> set_analysis('wave')

Set the data set with an identifier of 2 to use energy units.

>>> set_analysis(2, 'energy')

Set data set 1 to use channel units. Plots will use a Y axis of count/bin rather than the default count/s/bin.

>>> set_analysis(1, 'bin', 'counts')

Set data set 1 to use energy units. Plots of this data set will display keV on the X axis and counts keV (i.e. counts/keV * keV^2) in the Y axis.

>>> set_analysis(1, 'energy', 'counts', 2)

PARAMETERS

The parameters for this function are:

Parameter
Definition
id
If only one argument is given then this is taken to be the quantity argument (in which case, the change is made to all data sets). If multiple arguments are given then this is the identifier for the data set to change.
quantity
The units to use for the analysis.
type
The units to use on the Y axis of plots. The default is 'rate'.
factor
The Y axis of plots is multiplied by Energy^factor or Wavelength^factor before display. The default is 0.

Notes

The function does not follow the normal Python standards for parameter use, since it is designed for easy interactive use. When called with a single un-named argument, it is taken to be the `quantity` parameter. If given two un-named arguments, then they are interpreted as the `id` and `quantity` parameters, respectively.

Changes in CIAO

The filter is now reported after the call for each dataset that is processed.

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

December 2023