larray.LArray.clip

LArray.clip(a_min, a_max, out=None)[source]

Clip (limit) the values in an array.

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.

Parameters:

a_min : scalar or array-like

Minimum value.

a_max : scalar or array-like

Maximum value.

out : LArray, optional

The results will be placed in this array.

Returns:

LArray

An array with the elements of the current array, but where values < a_min are replaced with a_min, and those > a_max with a_max.

Notes

If a_min and/or a_max are array_like, broadcast will occur between self, a_min and a_max.