set_filter
- sherpa.astro.ui.set_filter(id, val=None, bkg_id: IdType | None = None, ignore=False) None
Set the filter array of a data set.
- Parameters:
id (int or str, optional) – The data set to use. If not given then the default identifier is used, as returned by
get_default_id
.val (array) – The array of filter values (
0
or1
). The size should match the array returned byget_dep
.bkg_id (int, str, or None, optional) – Set to identify which background component to set. The default value (
None
) means that this is for the source component of the data set.ignore (bool, optional) – If
False
(the default) then include bins with a non-zero filter value, otherwise exclude these bins.
See also
get_dep
Return the dependent axis of a data set.
get_filter
Return the filter expression for a data set.
ignore
Exclude data from the fit.
load_filter
Load the filter array from a file and add to a data set.
notice
Include data in the fit.
save_filter
Save the filter array to a file.
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
val
parameter. If given two un-named arguments, then they are interpreted as theid
andval
parameters, respectively.Examples
Ignore those bins with a value less 20.
>>> d = get_dep() >>> set_filter(d >= 20)