get_filter

sherpa.astro.ui.get_filter(id=None)

Return the filter expression for a data set.

This returns the filter expression, created by one or more calls to ignore and notice, for the 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.
Returns:filter – The empty string or a string expression representing the filter used. For PHA data dets the units are controlled by the analysis setting for the data set.
Return type:str
Raises:sherpa.utils.err.ArgumentErr – If the data set does not exist.

See also

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.
show_filter()
Show any filters applied to a data set.
set_filter()
Set the filter array of a data set.

Examples

The default filter is the full dataset, given in the format lowval:hival (both are inclusive limits):

>>> load_arrays(1, [10,15,20,25], [5,7,4,2])
>>> get_filter()
'10.0000:25.0000'

The notice call restricts the data to the range between 14 and 30. The resulting filter is the combination of this range and the data:

>>> notice(14,30)
>>> get_filter()
'15.0000:25.0000'

Ignoring the point at x=20 means that only the points at x=15 and x=25 remain, so a comma-separated list is used:

>>> ignore(19,22)
>>> get_filter()
'15.0000,25.0000'

The filter equivalent to the per-bin array of filter values:

>>> set_filter([1,1,0,1])
>>> get_filter()
'10.0000,15.0000,25.0000'