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

load_filter(id, filename=None, bkg_id=None, ignore=False, ncols=2, *args, **kwargs)
id - int or str, optional
filename - str
bkg_id - int or str, optional
ignore - bool, optional
colkeys - array of str, optional
sep - str, optional
comment - str, optional

Read in the first column of the file and apply it to the default data set:

>>> load_filter('filt.dat')

Select the FILTER column of the file:

>>> load_filter(2, 'filt.dat', colkeys=['FILTER'])

When using Crates as the I/O library, the above can also be written as

>>> load_filter(2, 'filt.dat[cols filter]')

Read in a filter for an image. The image must match the size of the data and, as ignore=true , pixels with a non-zero value are excluded (rather than included):

>>> load_filter('img', 'filt.img', ignore=True)

PARAMETERS

The parameters for this function are:

Parameter
Definition
id
The identifier for the data set to use. If not given then the default identifier is used, as returned by

`get_default_id` .
filename
The name of the file that contains the filter 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
Set if the filter array should be associated with the background associated with the data set.
ignore
If False (the default) then include bins with a non-zero filter value, otherwise exclude these bins.
colkeys
An array of the column name to read in. The default is

none .
sep
The separator character. The default is ' ' .
comment
The comment character. The default is '#' .

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.

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

December 2023