spectrochempy.clip
- clip(dataset, a_min=None, a_max=None, **kwargs)[source]
Clip (limit) the values in a dataset.
Given an interval, values outside the interval are clipped to the interval edges. For example, if an interval of
[0, 1]
is specified, values smaller than 0 become 0, and values larger than 1 become 1.No check is performed to ensure
a_min < a_max
.- Parameters:
dataset (array_like) – Input array or object that can be converted to an array.
a_min (scalar or array_like or None) – Minimum value. If None, clipping is not performed on lower interval edge. Not more than one of
a_min
anda_max
may be None.a_max (scalar or array_like or None) – Maximum value. If None, clipping is not performed on upper interval edge. Not more than one of
a_min
anda_max
may be None. Ifa_min
ora_max
are array_like, then the three arrays will be broadcasted to match their shapes.
- Returns:
clip – An array with the elements of
a
, but where values <a_min
are replaced witha_min
, and those >a_max
witha_max
.