set_quality¶
-
sherpa.astro.ui.
set_quality
(id, val=None, bkg_id=None)¶ Apply a set of quality flags to a PHA data set.
A quality value of 0 indicates a good channel, otherwise (values >=1) the channel is considered bad and can be excluded using the ignore_bad function, as discussed in [1].
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.
- val (array of int) – This must be an array of quality values of the same length as the data array.
- bkg_id (int or str, optional) – Set if the quality values should be associated with the background associated with the data set.
Raises: sherpa.utils.err.ArgumentErr
– If the data set does not contain a PHA data set.See also
fit()
- Fit one or more data sets.
get_quality()
- Return the quality array for a PHA data set.
ignore_bad()
- Exclude channels marked as bad in a PHA data set.
load_quality()
- Load the quality array from a file and add to a PHA data set.
set_grouping()
- Apply a set of grouping flags to a PHA data set.
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 val parameter. If given two un-named arguments, then they are interpreted as the id and val parameters, respectively.
References
[1] Arnaud., K. & George, I., “The OGIP Spectral File Format”, http://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/spectra/ogip_92_007/ogip_92_007.html Examples
Copy the quality array from data set 2 into the default data set, and then ensure that any ‘bad’ channels are ignored:
>>> qual = get_data(2).quality >>> set_quality(qual) >>> ignore_bad()
Copy the quality array from data set “src1” to the source and background data sets of “src2”:
>>> qual = get_data("src1").quality >>> set_quality("src2", qual) >>> set_quality("src2", qual, bkg_id=1)