load_filter(id, filename=None, bkg_id=None, ignore=False, ncols=2, *args, **kwargs)¶
Load the filter array from a file and add to a data set.
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 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 (int or str, optional) – Set if the filter array should be associated with the background associated with the data set.
ignore (bool, optional) – If
False(the default) then include bins with a non-zero filter value, otherwise exclude these bins.
colkeys (array of str, optional) – An array of the column name to read in. The default is
sep (str, optional) – The separator character. The default is
comment (str, optional) – The comment character. The default is
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.
Read in the first column of the file and apply it to the default data set:
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)