load_filter¶
-
sherpa.astro.ui.
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.
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 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
None
. - sep (str, optional) – The separator character. The default is
' '
. - comment (str, optional) – The comment character. The default is
'#'
.
See also
get_filter()
- Return the filter expression for a data set.
ignore()
- Exclude data from the fit.
notice()
- Include data in the fit.
save_filter()
- Save the filter array to a file.
set_filter()
- Set the filter array of a 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.
Examples
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)