filter_bins

sherpa.utils.filter_bins(mins, maxes, axislist)[source]

What mask represents the given set of filters?

Parameters:
  • mins (sequence of values) – The minimum value of the valid range (elements may be None). When not None, it is treated as an inclusive limit, so points >= min are included.
  • maxes (sequence of values) – The maximum value of the valid range (elements may be None). When not None, it is treated as an inclusive limit, so points <= max are included.
  • axislist (sequence of arrays) – The axis to apply the range to. There must be the same number of elements in mins, maxes, and axislist. The number of elements of each element of axislist must also agree (the cell values do not need to match).
Returns:

mask – A mask indicating whether the values are included (True) or excluded (False).

Return type:

ndarray

Examples

Calculate those points in xs which are in the range 1.5 <= x <= 2.3.

>>> mask = filter_bins([1.5], [2.3], [xs])

Repeat the above calculation by combining filters for x >= 1.5 and x <= 2.3.

>>> mask = filter_bins([1.5, None], [None, 2.3], [xs, xs])