Last modified: December 2023

AHELP for CIAO 4.16 Sherpa


Context: filtering


Include data from the fit for a data set.


notice_id(ids, lo=None, hi=None, **kwargs)

ids - int or str, or array of int or str
lo - number or str, optional
hi - number, optional
bkg_id - int or str, optional


Select one or more ranges of data to include by filtering on the independent axis value. The filter is applied to the given data set, or data sets.


Example 1

Include all data points with an X value (the independent axis) between 12 and 18 for data set 1:

>>> notice_id(1, 12, 18)
dataset 1: 10:30 -> 15:20 x

Example 2

Include the range 0.5 to 7, for data sets 1, 2, and 3 (the screen output will depend on the existing data and filters applied to them):

>>> notice_id([1, 2, 3], 0.5, 7)
dataset 1: 0.00146:14.9504 -> 0.4818:9.0374 Energy (keV)
dataset 2: 0.00146:14.9504 -> 0.4964:13.6072 Energy (keV)
dataset 3: 0.00146:14.9504 -> 0.4234:9.3878 Energy (keV)

Example 3

Apply the filter 0.5 to 2 and 2.2 to 7 to the data sets "core" and "jet", and hide the screen output:

>>> from sherpa.utils.logging import SherpaVerbosity
>>> with SherpaVerbsity("WARN"):
...     notice_id(["core", "jet"], "0.5:2, 2.2:7")


The parameters for this function are:

Parameter Definition
ids The data set, or sets, to use.
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 include everything up to b (an exclusive limit for integrated datasets), and a: means include 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.


The order of `ignore` and `notice` calls is important.

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 the 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.


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

See Also

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