Last modified: December 2023

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/ignore.html
AHELP for CIAO 4.16 Sherpa

ignore

Context: filtering

Synopsis

Exclude data from the fit.

Syntax

ignore(lo=None, hi=None, **kwargs)

lo - number or str, optional
hi - number, optional
bkg_id - int or str, optional

Description

Select one or more ranges of data to exclude by filtering on the independent axis value. The filter is applied to all data sets.


Examples

Example 1

Ignore all data points with an X value (the independent axis) between 12 and 18. For this one-dimensional data set, this means that the second bin is ignored:

>>> load_arrays(1, [10, 15, 20, 30], [5, 10, 7, 13])
>>> ignore(12, 18)
dataset 1: 10:30 -> 10,20:30 x
>>> get_dep(filter=True)
array([ 5,  7, 13])

Example 2

Filtering X values that are 25 or larger means that the last point is also ignored:

>>> ignore(lo=25)
dataset 1: 10,20:30 -> 10,20 x
>>> get_dep(filter=True)
array([ 5,  7])

Example 3

The `notice` call removes the previous filter, and then a multi-range filter is applied to exclude values between 8 and 12 and 18 and 22:

>>> notice()
dataset 1: 10,20 -> 10:30 x
>>> ignore("8:12, 18:22")
dataset 1: 10:30 -> 15:30 x
dataset 1: 15:30 -> 15,30 x
>>> get_dep(filter=True)
array([10, 13])

Example 4

The `SherpaVerbosity` context manager can be used to hide the screen output:

>>> from sherpa.utils.logging import SherpaVerbosity
>>> with SherpaVerbosity("WARN"):
...     ignore(hi=12)
...

PARAMETERS

The parameters for this function are:

Parameter Definition
lo The lower bound of the filter (when a number) or a string expression listing ranges in the form a:b , with multiple ranges allowed, where the ranges are separated by a , . The term :b means exclude everything up to b (an exclusive limit for integrated datasets), and a: means exclude everything that is higher than, or equal to, a .
hi The upper bound of the filter when lo is not a string.
bkg_id The filter will be applied to the associated background component of the data set if bkg_id is set. Only PHA data sets support this option; if not given, then the filter is applied to all background components as well as the source data.

Notes

The order of `ignore` and `notice` calls is important, and the results are a union, rather than intersection, of the combination.

For binned data sets, the bin is excluded if the ignored range falls anywhere within the bin.

The units used depend on the analysis setting of the data set, if appropriate.

To filter a 2D data set by a shape use `ignore2d` .

The report of the change in the filter expression can be controlled with the `SherpaVerbosity` context manager, as shown in the examples below.

Changes in CIAO

Changed in CIAO 4.15

The change in the filter is now reported for each dataset.

Changed in CIAO 4.14

Integrated data sets - so Data1DInt and DataPHA when using energy or wavelengths - now ensure that the `hi` argument is exclusive and better handling of the `lo` argument when it matches a bin edge. This can result in the same filter selecting a smaller number of bins than in earlier versions of Sherpa.


Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

data
group, group_adapt, group_adapt_snr, group_bins, group_counts, group_snr, group_width
filtering
get_filter, ignore2d, ignore2d_id, ignore_bad, ignore_id, notice, notice2d, notice2d_id, notice_id, show_filter