sherpa.astro.ui.set_filter(id, val=None, bkg_id=None, ignore=False)

Set the filter array of a data set.

  • 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 or 1). The size should match the array returned by get_dep.

  • bkg_id (int or str, 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


Return the dependent axis of a data set.


Return the filter expression for a data set.


Exclude data from the fit.


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


Include data in the fit.


Save the filter array to a file.


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.


Ignore those bins with a value less 20.

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