sherpa.astro.ui.load_quality(id, filename=None, bkg_id=None, *args, **kwargs)

Load the quality array from a file and add to a PHA data set.

This function sets the quality column but does not automatically ignore any columns marked as “bad”. Use the ignore_bad function to apply the new quality information.

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.

• filename (str) – The name of the file that contains the quality information. This file can be a FITS table or an ASCII file. Selection of the relevant column depends on the I/O library in use (Crates or AstroPy).

• bkg_id (int or str, optional) – Set if the quality array should be associated with the background associated with the data set.

• colkeys (array of str, optional) – An array of the column name to read in. The default is None.

• sep (str, optional) – The separator character. The default is ' '.

• comment (str, optional) – The comment character. The default is '#'.

get_quality()

Return the quality array for a PHA data set.

ignore_bad()

Exclude channels marked as bad in a PHA data set.

load_grouping()

Load the grouping scheme from a file and add to a PHA data set.

save_quality()

Save the quality array to a file.

set_quality()

Apply a set of quality 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 filename parameter. If given two un-named arguments, then they are interpreted as the id and filename parameters, respectively. The remaining parameters are expected to be given as named arguments.

There is no check made to see if the quality array contains valid data.

Examples

When using Crates as the I/O library, select the quality column from the file ‘src.pi’, and use it to set the values in the default data set:

>>> load_quality('src.pi[cols quality]')


Use the colkeys option to define the column in the input file:

>>> load_quality('src.pi', colkeys=['quality'])


Load the first column in ‘grp.dat’ and use it to populate the quality array of the data set called ‘core’.

>>> load_quality('core', 'grp.dat')