ignore_id
- sherpa.astro.ui.ignore_id(ids: IdType | Sequence[IdType], lo=None, hi=None, **kwargs) None
Exclude data from the fit for a data set.
Select one or more ranges of data to exclude by filtering on the independent axis value. The filter is applied to the given data set, or sets.
Changed in version 4.15.0: The change in the filter is now reported for the dataset.
Changed in version 4.14.0: Integrated data sets - so Data1DInt and DataPHA when using energy or wavelengths - now ensure that the
hi
argument is exclusive and better handling of thelo
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.- Parameters:
ids (int or str, or array of int or str) – The data set, or sets, to use.
lo (number or str, optional) – 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 tob
(an exclusive limit for integrated datasets), anda:
means exclude everything that is higher than, or equal to,a
.hi (number, optional) – The upper bound of the filter when
lo
is not a string.bkg_id (int or str, optional) – 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.
See also
ignore
Exclude data from the fit.
sherpa.astro.ui.ignore2d
Exclude a spatial region from an image.
notice_id
Include data from the fit for a data set.
show_filter
Show any filters applied to a data set.
Notes
The order of
ignore
andnotice
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
.Examples
Ignore all data points with an X value (the independent axis) between 12 and 18 for data set 1:
>>> ignore_id(1, 12, 18) dataset 1: 10:30 -> 10,20:30 x
Ignore the range up to 0.5 and 7 and above, for data sets 1, 2, and 3:
>>> ignore_id([1, 2, 3], hi=0.5) dataset 1: 0.00146:14.9504 -> 0.584:14.9504 Energy (keV) dataset 2: 0.00146:14.9504 -> 0.6424:14.9504 Energy (keV) dataset 3: 0.00146:14.9504 -> 0.511:14.9504 Energy (keV) >>> ignore_id([1, 2, 3], lo=7) dataset 1: 0.584:14.9504 -> 0.584:4.4384 Energy (keV) dataset 2: 0.6424:14.9504 -> 0.6424:5.1392 Energy (keV) dataset 3: 0.511:14.9504 -> 0.511:4.526 Energy (keV)
Apply the same filter as the previous example, but to data sets “core” and “jet”, and hide the screen output:
>>> from sherpa.utils.logging import SherpaVerbosity >>> with SherpaVerbsity("WARN"): ... ignore_id(["core", "jet"], ":0.5,7:") ...