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:
idint or str, optional

The data set to use. If not given then the default identifier is used, as returned by get_default_id.

valarray

The array of filter values (0 or 1). The size should match the array returned by get_dep.

bkg_idint, 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.

ignorebool, 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 the id and val parameters, respectively.

Examples

Ignore those bins with a value less 20.

>>> d = get_dep()
>>> set_filter(d >= 20)