- sherpa.astro.ui.set_quality(id, val=None, bkg_id=None)¶
Apply a set of quality flags to a PHA data set.
val (array of int) – This must be an array of quality values of the same length as the data array.
sherpa.utils.err.ArgumentErr – If the data set does not contain a PHA data set.
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
valparameter. If given two un-named arguments, then they are interpreted as the
The meaning of the quality column is taken from 1, which says that 0 indicates a “good” channel, 1 and 2 are for channels that are identified as “bad” or “dubious” (respectively) by software, 5 indicates a “bad” channel set by the user, and values of 3 or 4 are not used.
“The OGIP Spectral File Format”, https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/spectra/ogip_92_007/ogip_92_007.html
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)