ptp#
- class saiunit.math.ptp(x, axis=None, keepdims=False, **kwargs)#
Return the range of the array elements (maximum - minimum).
- Parameters:
x (saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex) – Input array.axis (
int|Sequence[int] |None) –Axis along which to find the peaks. By default, flatten the array. axis may be negative, in which case it counts from the last to the first axis.
If this is a tuple of ints, a reduction is performed on multiple axes, instead of a single axis or all the axes as before.
keepdims (
bool) –If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
If the default value is passed, then keepdims will not be passed through to the ptp method of sub-classes of ndarray, however any non-default value will be. If the sub-class’ method does not implement keepdims any exceptions will be raised.
- Returns:
out – Quantity if x is a Quantity, else an array.
- Return type:
saiunit.Quantity |
Array
Examples
>>> import saiunit as u >>> a = [1, 2, 3, 4, 5] * u.meter >>> u.math.ptp(a)