NumPy Functions¶
Workflows provides equivalents to many NumPy functions through the workflows.numpy
module, for use on the Workflows Array
type. Supported functions are listed here. For more information, see the Workflows guide.
Generally, you should use these functions from the Workflows submodule, like:
import descarteslabs.workflows as wf
from descarteslabs.workflows import numpy as wnp
wf_array = wf.Image.from_id("foo:bar").ndarray
arr_t = wnp.transpose(wf_array, [1, 2, 0])
But for convenience, you can also use NumPy versions of these functions directly on Workflows Array
:
import numpy as np
same_arr_t = np.transpose(wf_array, [1, 2, 0])
Use of these docstrings is subject to the NumPy license.
Top Level Functions¶

Calculate the absolute value elementwise. 

Add arguments elementwise. 

Test whether all array elements along a given axis evaluate to True. 

Returns True if two arrays are elementwise equal within a tolerance. 

Return the angle of the complex argument. 

Test whether any array element along a given axis evaluates to True. 

Return evenly spaced values within a given interval. 

Trigonometric inverse cosine, elementwise. 

Inverse hyperbolic cosine, elementwise. 

Inverse sine, elementwise. 

Inverse hyperbolic sine elementwise. 

Trigonometric inverse tangent, elementwise. 

Elementwise arc tangent of 

Inverse hyperbolic tangent elementwise. 

Returns the indices of the maximum values along an axis. 

Returns the indices of the minimum values along an axis. 

Find the indices of array elements that are nonzero, grouped by element. 

Evenly round to the given number of decimals. 
alias of 


Convert inputs to arrays with at least one dimension. 

View inputs as arrays with at least two dimensions. 

View inputs as arrays with at least three dimensions. 

Compute the weighted average along the specified axis. 

Count number of occurrences of each value in array of nonnegative ints. 

Compute the bitwise AND of two arrays elementwise. 

Compute the bitwise OR of two arrays elementwise. 

Compute the bitwise XOR of two arrays elementwise. 

Compute bitwise inversion, or bitwise NOT, elementwise. 

Broadcast any number of arrays against each other. 

Broadcast an array to a new shape. 

Return the cuberoot of an array, elementwise. 

Return the ceiling of the input, elementwise. 

Clip (limit) the values in an array. 

Return selected slices of an array along given axis. 

Join a sequence of arrays along an existing axis. 

Return the complex conjugate, elementwise. 

Return the complex conjugate, elementwise. 

Change the sign of x1 to that of x2, elementwise. 

Return Pearson productmoment correlation coefficients. 

Cosine elementwise. 

Hyperbolic cosine, elementwise. 

Counts the number of nonzero values in the array 

Estimate a covariance matrix, given data and weights. 

Return the cumulative product of elements along a given axis. 

Return the cumulative sum of the elements along a given axis. 

Convert angles from degrees to radians. 

Convert angles from radians to degrees. 

Extract a diagonal or construct a diagonal array. 

Return specified diagonals. 

Calculate the nth discrete difference along the given axis. 

Return the indices of the bins to which each value in input array belongs. 

Returns a true division of the inputs, elementwise. 

Dot product of two arrays. 

Stack arrays in sequence depth wise (along third axis). 

The differences between consecutive elements of an array. 

Evaluates the Einstein summation convention on the operands. 

Return (x1 == x2) elementwise. 

Calculate the exponential of all elements in the input array. 

Calculate 2**p for all p in the input array. 

Calculate 

Return a 2D array with ones on the diagonal and zeros elsewhere. 

Compute the absolute values elementwise. 

Round to nearest integer towards zero. 

Return indices that are nonzero in the flattened version of a. 

First array elements raised to powers from second array, elementwise. 

Return the floor of the input, elementwise. 

Return the largest integer smaller or equal to the division of the inputs. 

Elementwise maximum of array elements. 

Elementwise minimum of array elements. 

Return the elementwise remainder of division. 

Return a new array of given shape and type, filled with fill_value. 

Return a full array with the same shape and type as a given array. 

Return the gradient of an Ndimensional array. 

Return the truth value of (x1 > x2) elementwise. 

Return the truth value of (x1 >= x2) elementwise. 

Compute the histogram of a dataset. 

Stack arrays in sequence horizontally (column wise). 

Given the “legs” of a right triangle, return its hypotenuse. 

Return the imaginary part of the complex argument. 

Return an array representing the indices of a grid. 

Insert values along the given axis before the given indices. 

Returns a boolean array where two arrays are elementwise equal within a tolerance. 

Test elementwise for finiteness (not infinity or not Not a Number). 

Calculates element in test_elements, broadcasting over element only. 

Test elementwise for positive or negative infinity. 

Test elementwise for NaN and return result as a boolean array. 

Test elementwise for negative infinity, return result as bool array. 

Test elementwise for positive infinity, return result as bool array. 

Returns a bool array, where True if input element is real. 

Returns x1 * 2**x2, elementwise. 

Return the truth value of (x1 < x2) elementwise. 

Return the truth value of (x1 <= x2) elementwise. 

Return evenly spaced numbers over a specified interval. 

Natural logarithm, elementwise. 

Return the base 10 logarithm of the input array, elementwise. 

Return the natural logarithm of one plus the input array, elementwise. 

Base2 logarithm of x. 

Logarithm of the sum of exponentiations of the inputs. 

Logarithm of the sum of exponentiations of the inputs in base2. 

Compute the truth value of x1 AND x2 elementwise. 

Compute the truth value of NOT x elementwise. 

Compute the truth value of x1 OR x2 elementwise. 

Compute the truth value of x1 XOR x2, elementwise. 

Return the maximum of an array or maximum along an axis. 

Elementwise maximum of array elements. 

Compute the arithmetic mean along the specified axis. 

Return coordinate matrices from coordinate vectors. 

Return the minimum of an array or minimum along an axis. 

Elementwise minimum of array elements. 

Return elementwise remainder of division. 

Move axes of an array to new positions. 

Multiply arguments elementwise. 

Replace NaN with zero and infinity with large finite numbers (default behaviour) or with the numbers defined by the user using the nan, posinf and/or neginf keywords. 

Return the indices of the maximum values in the specified axis ignoring NaNs. 

Return the indices of the minimum values in the specified axis ignoring NaNs. 

Return the cumulative product of array elements over a given axis treating Not a Numbers (NaNs) as one. 

Return the cumulative sum of array elements over a given axis treating Not a Numbers (NaNs) as zero. 

Return the maximum of an array or maximum along an axis, ignoring any NaNs. 

Compute the arithmetic mean along the specified axis, ignoring NaNs. 

Return minimum of an array or minimum along an axis, ignoring any NaNs. 

Return the product of array elements over a given axis treating Not a Numbers (NaNs) as ones. 

Compute the standard deviation along the specified axis, while ignoring NaNs. 

Return the sum of array elements over a given axis treating Not a Numbers (NaNs) as zero. 

Compute the variance along the specified axis, while ignoring NaNs. 

Numerical negative, elementwise. 

Return the next floatingpoint value after x1 towards x2, elementwise. 

Return the indices of the elements that are nonzero. 

Return (x1 != x2) elementwise. 

Return a new array of given shape and type, filled with ones. 

Return an array of ones with the same shape and type as a given array. 

Compute the outer product of two vectors. 

Pad an array. 

Compute the qth percentile of the data along the specified axis. 

First array elements raised to powers from second array, elementwise. 

Return the product of array elements over a given axis. 

Range of values (maximum  minimum) along an axis. 

Convert angles from radians to degrees. 

Convert angles from degrees to radians. 

Return a contiguous flattened array. 

Return the real part of the complex argument. 

Return the reciprocal of the argument, elementwise. 

Return elementwise remainder of division. 

Repeat elements of an array. 

Gives a new shape to an array without changing its data. 

Round elements of the array to the nearest integer. 

Roll array elements along a given axis. 

Roll the specified axis backwards, until it lies in a given position. 

Round an array to the given number of decimals. 

Returns an elementwise indication of the sign of a number. 

Returns elementwise True where signbit is set (less than zero). 

Trigonometric sine, elementwise. 

Hyperbolic sine, elementwise. 

Return the distance between x and the nearest adjacent number. 

Return the nonnegative squareroot of an array, elementwise. 

Return the elementwise square of the input. 

Remove axes of length one from a. 

Join a sequence of arrays along a new axis. 

Compute the standard deviation along the specified axis. 

Subtract arguments, elementwise. 

Sum of array elements over a given axis. 

Take elements from an array along an axis. 

Compute tangent elementwise. 

Compute hyperbolic tangent elementwise. 

Compute tensor dot product along specified axes. 

Construct an array by repeating A the number of times given by reps. 

Return the sum along diagonals of the array. 

Reverse or permute the axes of an array; returns the modified array. 

Lower triangle of an array. 

Upper triangle of an array. 

Returns a true division of the inputs, elementwise. 

Return the truncated value of the input, elementwise. 

Find the unique elements of an array. 

Converts a flat index or array of flat indices into a tuple of coordinate arrays. 

Compute the variance along the specified axis. 

Return the dot product of two vectors. 

Stack arrays in sequence vertically (row wise). 

Return elements chosen from x or y depending on condition. 

Return a new array of given shape and type, filled with zeros. 

Return an array of zeros with the same shape and type as a given array. 
Linear Algebra¶
Cholesky decomposition. 


Compute the (multiplicative) inverse of a matrix. 

Return the leastsquares solution to a linear matrix equation. 

Matrix or vector norm. 

Compute the qr factorization of a matrix. 

Solve a linear matrix equation, or system of linear scalar equations. 

Singular Value Decomposition. 
Masked Arrays¶

Return the weighted average of array over the given axis. 

Return input as an array with masked data replaced by a fill value. 

Return input with invalid data masked and replaced by a fill value. 
alias of 


Mask an array where equal to a given value. 

Mask an array where greater than a given value. 

Mask an array where greater than or equal to a given value. 

Mask an array inside a given interval. 
Mask an array where invalid values occur (NaNs or infs). 


Mask an array where less than a given value. 

Mask an array where less than or equal to a given value. 

Mask an array where not equal to a given value. 

Mask an array outside a given interval. 

Mask using floating point equality. 

Mask an array where a condition is met. 

absolute
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Calculate the absolute value elementwise.
This docstring was copied from
numpy.absolute
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array.
 Returns
absolute – An ndarray containing the absolute value of each element in x. For complex input,
a + ib
, the absolute value is \(\sqrt{ a^2 + b^2 }\). This is a scalar if x is a scalar. Return type
ndarray

add
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Add arguments elementwise.
This docstring was copied from
numpy.add
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – The arrays to be added.
 Returns
add – The sum of x1 and x2, elementwise. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or scalar

all
(a: Union[Array, MaskedArray], axis: Union[NoneType, Int, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Test whether all array elements along a given axis evaluate to True.
This docstring was copied from
numpy.all
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input array or object that can be converted to an array.
axis (None or int or tuple of ints, optional) –
Axis or axes along which a logical AND reduction is performed. The default (
axis=None
) is to perform a logical AND over all the dimensions of the input array. axis may be negative, in which case it counts from the last to the first axis.New in version 1.7.0.
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.
out (ndarray, optional) – Alternate output array in which to place the result. It must have the same shape as the expected output and its type is preserved (e.g., if
dtype(out)
is float, the result will consist of 0.0’s and 1.0’s). See ufuncsoutputtype for more details.keepdims (bool, optional) –
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 all method of subclasses of ndarray, however any nondefault value will be. If the subclass’ method does not implement keepdims any exceptions will be raised.
where (array_like of bool, optional) –
Elements to include in checking for all True values. See ~numpy.ufunc.reduce for details.
New in version 1.20.0.
 Returns
all (ndarray, bool) – A new boolean or array is returned unless out is specified, in which case a reference to out is returned.
any (Test whether any element along a given axis evaluates to True.)
Notes
Not a Number (NaN), positive infinity and negative infinity evaluate to True because these are not equal to zero.

allclose
(a: Union[Array, MaskedArray, Scalar], b: Union[Array, MaskedArray, Scalar], rtol: Union[Int, Float] = 1e05, atol: Union[Int, Float] = 1e08, equal_nan: Bool = False) → Scalar¶ Returns True if two arrays are elementwise equal within a tolerance.
This docstring was copied from
numpy.allclose
Some inconsistencies with the Workflows version may exist
The tolerance values are positive, typically very small numbers. The relative difference (rtol * abs(b)) and the absolute difference atol are added together to compare against the absolute difference between a and b.
NaNs are treated as equal if they are in the same place and if
equal_nan=True
. Infs are treated as equal if they are in the same place and of the same sign in both arrays. Parameters
b (a,) – Input arrays to compare.
rtol (float) – The relative tolerance parameter (see Notes).
atol (float) – The absolute tolerance parameter (see Notes).
equal_nan (bool) –
Whether to compare NaN’s as equal. If True, NaN’s in a will be considered equal to NaN’s in b in the output array.
New in version 1.10.0.
 Returns
allclose – Returns True if the two arrays are equal within the given tolerance; False otherwise.
 Return type
bool
Notes
If the following equation is elementwise True, then allclose returns True.
absolute(a  b) <= (atol + rtol * absolute(b))
The above equation is not symmetric in a and b, so that
allclose(a, b)
might be different fromallclose(b, a)
in some rare cases.The comparison of a and b uses standard broadcasting, which means that a and b need not have the same shape in order for
allclose(a, b)
to evaluate to True. The same is true for equal but not array_equal.allclose is not defined for nonnumeric data types.

angle
(z: Union[Array, MaskedArray], deg: Bool = False) → Array¶ Return the angle of the complex argument.
This docstring was copied from
numpy.angle
Some inconsistencies with the Workflows version may exist
 Parameters
z (array_like) – A complex number or sequence of complex numbers.
deg (bool, optional) – Return angle in degrees if True, radians if False (default).
 Returns
angle – The counterclockwise angle from the positive real axis on the complex plane in the range
(pi, pi]
, with dtype as numpy.float64.Changed in version 1.16.0: This function works on subclasses of ndarray like ma.array.
 Return type
ndarray or scalar
Notes
Although the angle of the complex number 0 is undefined,
numpy.angle(0)
returns the value 0.

any
(a: Union[Array, MaskedArray], axis: Union[NoneType, Int, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Test whether any array element along a given axis evaluates to True.
This docstring was copied from
numpy.any
Some inconsistencies with the Workflows version may exist
Returns single boolean unless axis is not
None
 Parameters
a (array_like) – Input array or object that can be converted to an array.
axis (None or int or tuple of ints, optional) –
Axis or axes along which a logical OR reduction is performed. The default (
axis=None
) is to perform a logical OR over all the dimensions of the input array. axis may be negative, in which case it counts from the last to the first axis.New in version 1.7.0.
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.
out (ndarray, optional) – Alternate output array in which to place the result. It must have the same shape as the expected output and its type is preserved (e.g., if it is of type float, then it will remain so, returning 1.0 for True and 0.0 for False, regardless of the type of a). See ufuncsoutputtype for more details.
keepdims (bool, optional) –
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 any method of subclasses of ndarray, however any nondefault value will be. If the subclass’ method does not implement keepdims any exceptions will be raised.
where (array_like of bool, optional) –
Elements to include in checking for any True values. See ~numpy.ufunc.reduce for details.
New in version 1.20.0.
 Returns
any (bool or ndarray) – A new boolean or ndarray is returned unless out is specified, in which case a reference to out is returned.
all (Test whether all elements along a given axis evaluate to True.)
Notes
Not a Number (NaN), positive infinity and negative infinity evaluate to True because these are not equal to zero.

arange
(start: Union[Int, Float, Scalar] = 0, stop: Union[Int, Float, Scalar] = None, step: Union[Int, Float, Scalar] = 1) → Array¶ Return evenly spaced values within a given interval.
This docstring was copied from
numpy.arange
Some inconsistencies with the Workflows version may exist
Values are generated within the halfopen interval
[start, stop)
(in other words, the interval including start but excluding stop). For integer arguments the function is equivalent to the Python builtin range function, but returns an ndarray rather than a list.When using a noninteger step, such as 0.1, the results will often not be consistent. It is better to use numpy.linspace for these cases.
 Parameters
start (integer or real, optional) – Start of interval. The interval includes this value. The default start value is 0.
stop (integer or real) – End of interval. The interval does not include this value, except in some cases where step is not an integer and floating point roundoff affects the length of out.
step (integer or real, optional) – Spacing between values. For any output out, this is the distance between two adjacent values,
out[i+1]  out[i]
. The default step size is 1. If step is specified as a position argument, start must also be given.dtype (dtype) – The type of the output array. If dtype is not given, infer the data type from the other input arguments.
like (array_like) –
Reference object to allow the creation of arrays which are not NumPy arrays. If an arraylike passed in as
like
supports the__array_function__
protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.New in version 1.20.0.
 Returns
arange – Array of evenly spaced values.
For floating point arguments, the length of the result is
ceil((stop  start)/step)
. Because of floating point overflow, this rule may result in the last element of out being greater than stop. Return type
ndarray

arccos
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Trigonometric inverse cosine, elementwise.
This docstring was copied from
numpy.arccos
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – xcoordinate on the unit circle.
 Returns
angle – The angle of the ray intersecting the unit circle at the given xcoordinate in radians [0, pi]. This is a scalar if x is a scalar.
 Return type
ndarray

arccosh
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Inverse hyperbolic cosine, elementwise.
This docstring was copied from
numpy.arccosh
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array.
 Returns
arccosh – Array of the same shape as x. This is a scalar if x is a scalar.
 Return type
ndarray

arcsin
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Inverse sine, elementwise.
This docstring was copied from
numpy.arcsin
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – ycoordinate on the unit circle.
 Returns
angle – The inverse sine of each element in x, in radians and in the closed interval
[pi/2, pi/2]
. This is a scalar if x is a scalar. Return type
ndarray

arcsinh
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Inverse hyperbolic sine elementwise.
This docstring was copied from
numpy.arcsinh
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array.
 Returns
out – Array of the same shape as x. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

arctan
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Trigonometric inverse tangent, elementwise.
This docstring was copied from
numpy.arctan
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) –
out (ndarray, None, or tuple of ndarray and None, optional) –
 Returns
out – Out has the same shape as x. Its real part is in
[pi/2, pi/2]
(arctan(+/inf)
returns+/pi/2
). This is a scalar if x is a scalar. Return type
ndarray or scalar

arctan2
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Elementwise arc tangent of
x1/x2
choosing the quadrant correctly.This docstring was copied from
numpy.arctan2
Some inconsistencies with the Workflows version may exist
 Parameters
x1 (array_like, realvalued) – ycoordinates.
x2 (array_like, realvalued) – xcoordinates.
 Returns
angle – Array of angles in radians, in the range
[pi, pi]
. This is a scalar if both x1 and x2 are scalars. Return type
ndarray

arctanh
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Inverse hyperbolic tangent elementwise.
This docstring was copied from
numpy.arctanh
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array.
 Returns
out – Array of the same shape as x. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

argmax
(a: Union[Array, MaskedArray], axis: Optional[Int] = None) → Union[Array, Scalar]¶ Returns the indices of the maximum values along an axis.
This docstring was copied from
numpy.argmax
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input array.
axis (int, optional) – By default, the index is into the flattened array, otherwise along the specified axis.
out (array, optional) – If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype.
 Returns
index_array – Array of indices into the array. It has the same shape as a.shape with the dimension along axis removed.
 Return type
ndarray of ints
Notes
In case of multiple occurrences of the maximum values, the indices corresponding to the first occurrence are returned.

argmin
(a: Union[Array, MaskedArray], axis: Optional[Int] = None) → Union[Array, Scalar]¶ Returns the indices of the minimum values along an axis.
This docstring was copied from
numpy.argmin
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input array.
axis (int, optional) – By default, the index is into the flattened array, otherwise along the specified axis.
out (array, optional) – If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype.
 Returns
index_array – Array of indices into the array. It has the same shape as a.shape with the dimension along axis removed.
 Return type
ndarray of ints
Notes
In case of multiple occurrences of the minimum values, the indices corresponding to the first occurrence are returned.

argwhere
(a: Union[Array, MaskedArray]) → Array¶ Find the indices of array elements that are nonzero, grouped by element.
This docstring was copied from
numpy.argwhere
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input data.
 Returns
index_array – Indices of elements that are nonzero. Indices are grouped by element. This array will have shape
(N, a.ndim)
whereN
is the number of nonzero items. Return type
(N, a.ndim) ndarray
Notes
np.argwhere(a)
is almost the same asnp.transpose(np.nonzero(a))
, but produces a result of the correct shape for a 0D array.The output of
argwhere
is not suitable for indexing arrays. For this purpose usenonzero(a)
instead.

around
(a: Union[Array, MaskedArray, Scalar], decimals: Int = 0) → Union[Array, MaskedArray, Scalar]¶ Evenly round to the given number of decimals.
This docstring was copied from
numpy.around
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input data.
decimals (int, optional) – Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point.
out (ndarray, optional) – Alternative output array in which to place the result. It must have the same shape as the expected output, but the type of the output values will be cast if necessary. See ufuncsoutputtype for more details.
 Returns
rounded_array (ndarray) – An array of the same type as a, containing the rounded values. Unless out was specified, a new array is created. A reference to the result is returned.
The real and imaginary parts of complex numbers are rounded separately. The result of rounding a float is a float.
ceil, fix, floor, rint, trunc
Notes
For values exactly halfway between rounded decimal values, NumPy rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, 0.5 and 0.5 round to 0.0, etc.
np.around
uses a fast but sometimes inexact algorithm to round floatingpoint datatypes. For positive decimals it is equivalent tonp.true_divide(np.rint(a * 10**decimals), 10**decimals)
, which has error due to the inexact representation of decimal fractions in the IEEE floating point standard and errors introduced when scaling by powers of ten. For instance, note the extra “1” in the following:>>> np.round(56294995342131.5, 3) 56294995342131.51
If your goal is to print such values with a fixed number of decimals, it is preferable to use numpy’s float printing routines to limit the number of printed decimals:
>>> np.format_float_positional(56294995342131.5, precision=3) '56294995342131.5'
The float printing routines use an accurate but much more computationally demanding algorithm to compute the number of digits after the decimal point.
Alternatively, Python’s builtin round function uses a more accurate but slower algorithm for 64bit floating point values:
>>> round(56294995342131.5, 3) 56294995342131.5 >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 (16.06, 16.05)

array
(arr)¶ Proxy Array representing a multidimensional, homogenous array of fixedsize items.
Can be instantiated from a NumPy ndarray (via from_numpy), or a Python iterable. Currently, Arrays can only be constructed from small local arrays (< 10MB). Array follows the same syntax as NumPy arrays. It supports vectorized operations, broadcasting, and multidimensional indexing. There are some limitations including slicing with lists/arrays in multiple axes (
x[[1, 2, 3], [3, 2, 1]]
) and slicing with a multidimensional list/array of integers.Note
Array is an experimental API. It may be changed in the future, will not necessarily be backwards compatible, and may have unexpected bugs. Please contact us with any feedback!
Examples
>>> import descarteslabs.workflows as wf >>> # Create a 1dimensional Array of Ints >>> arr = wf.Array([1, 2, 3, 4, 5]) >>> arr <descarteslabs.workflows.types.array.array_.Array object at 0x...> >>> arr.compute(geoctx) array([1, 2, 3, 4, 5])
>>> import numpy as np >>> import descarteslabs.workflows as wf >>> ndarray = np.ones((3, 10, 10)) >>> # Create an Array from the 3dimensional numpy array >>> arr = wf.Array(ndarray) >>> arr <descarteslabs.workflows.types.array.array_.Array object at 0x...>

atleast_1d
(*arys: Union[Array, MaskedArray, Scalar]) → Union[Array, List[MaskedArray], List[Array], MaskedArray]¶ Convert inputs to arrays with at least one dimension.
This docstring was copied from
numpy.atleast_1d
Some inconsistencies with the Workflows version may exist
Scalar inputs are converted to 1dimensional arrays, whilst higherdimensional inputs are preserved.
 Parameters
arys2, .. (arys1,) – One or more input arrays.
 Returns
ret – An array, or list of arrays, each with
a.ndim >= 1
. Copies are made only if necessary. Return type
ndarray

atleast_2d
(*arys: Union[Array, MaskedArray, Scalar]) → Union[Array, List[MaskedArray], List[Array], MaskedArray]¶ View inputs as arrays with at least two dimensions.
This docstring was copied from
numpy.atleast_2d
Some inconsistencies with the Workflows version may exist
 Parameters
arys2, .. (arys1,) – One or more arraylike sequences. Nonarray inputs are converted to arrays. Arrays that already have two or more dimensions are preserved.
 Returns
res, res2, … – An array, or list of arrays, each with
a.ndim >= 2
. Copies are avoided where possible, and views with two or more dimensions are returned. Return type
ndarray

atleast_3d
(*arys: Union[Array, MaskedArray, Scalar]) → Union[Array, List[MaskedArray], List[Array], MaskedArray]¶ View inputs as arrays with at least three dimensions.
This docstring was copied from
numpy.atleast_3d
Some inconsistencies with the Workflows version may exist
 Parameters
arys2, .. (arys1,) – One or more arraylike sequences. Nonarray inputs are converted to arrays. Arrays that already have three or more dimensions are preserved.
 Returns
res1, res2, … – An array, or list of arrays, each with
a.ndim >= 3
. Copies are avoided where possible, and views with three or more dimensions are returned. For example, a 1D array of shape(N,)
becomes a view of shape(1, N, 1)
, and a 2D array of shape(M, N)
becomes a view of shape(M, N, 1)
. Return type
ndarray

average
(a: Union[Array, MaskedArray, Scalar], axis: Union[NoneType, Int, List[Int]] = None, weights: Union[Array, MaskedArray, Scalar] = None) → Union[Array, MaskedArray, Scalar]¶ Compute the weighted average along the specified axis.
This docstring was copied from
numpy.average
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Array containing data to be averaged. If a is not an array, a conversion is attempted.
axis (None or int or tuple of ints, optional) –
Axis or axes along which to average a. The default, axis=None, will average over all of the elements of the input array. If axis is negative it counts from the last to the first axis.
New in version 1.7.0.
If axis is a tuple of ints, averaging is performed on all of the axes specified in the tuple instead of a single axis or all the axes as before.
weights (array_like, optional) –
An array of weights associated with the values in a. Each value in a contributes to the average according to its associated weight. The weights array can either be 1D (in which case its length must be the size of a along the given axis) or of the same shape as a. If weights=None, then all data in a are assumed to have a weight equal to one. The 1D calculation is:
avg = sum(a * weights) / sum(weights)
The only constraint on weights is that sum(weights) must not be 0.
returned (bool, optional) – Default is False. If True, the tuple (average, sum_of_weights) is returned, otherwise only the average is returned. If weights=None, sum_of_weights is equivalent to the number of elements over which the average is taken.
 Returns
retval, [sum_of_weights] (array_type or double) – Return the average along the specified axis. When returned is True, return a tuple with the average as the first element and the sum of the weights as the second element. sum_of_weights is of the same type as retval. The result dtype follows a genereal pattern. If weights is None, the result dtype will be that of a , or
float64
if a is integral. Otherwise, if weights is not None and a is non integral, the result type will be the type of lowest precision capable of representing values of both a and weights. If a happens to be integral, the previous rules still applies but the result dtype will at least befloat64
.ma.average (average for masked arrays – useful if your data contains) – “missing” values
numpy.result_type (Returns the type that results from applying the) – numpy type promotion rules to the arguments.

bincount
(x: Union[Array, MaskedArray], weights: Union[Array, NoneType, MaskedArray] = None, minlength: Int = 0) → Array¶ Count number of occurrences of each value in array of nonnegative ints.
This docstring was copied from
numpy.bincount
Some inconsistencies with the Workflows version may exist
The number of bins (of size 1) is one larger than the largest value in x. If minlength is specified, there will be at least this number of bins in the output array (though it will be longer if necessary, depending on the contents of x). Each bin gives the number of occurrences of its index value in x. If weights is specified the input array is weighted by it, i.e. if a value
n
is found at positioni
,out[n] += weight[i]
instead ofout[n] += 1
. Parameters
x (array_like, 1 dimension, nonnegative ints) – Input array.
weights (array_like, optional) – Weights, array of the same shape as x.
minlength (int, optional) –
A minimum number of bins for the output array.
New in version 1.6.0.
 Returns
out – The result of binning the input array. The length of out is equal to
np.amax(x)+1
. Return type
ndarray of ints

bitwise_and
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Compute the bitwise AND of two arrays elementwise.
This docstring was copied from
numpy.bitwise_and
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Only integer and boolean types are handled.
 Returns
out – Result. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or scalar

bitwise_or
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Compute the bitwise OR of two arrays elementwise.
This docstring was copied from
numpy.bitwise_or
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Only integer and boolean types are handled.
 Returns
out – Result. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or scalar

bitwise_xor
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Compute the bitwise XOR of two arrays elementwise.
This docstring was copied from
numpy.bitwise_xor
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Only integer and boolean types are handled.
 Returns
out – Result. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or scalar

bitwise_not
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Compute bitwise inversion, or bitwise NOT, elementwise.
This docstring was copied from
numpy.invert
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Only integer and boolean types are handled.
 Returns
out – Result. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

broadcast_arrays
(*args: Union[Array, MaskedArray]) → Union[List[MaskedArray], List[Array]]¶ Broadcast any number of arrays against each other.
This docstring was copied from
numpy.broadcast_arrays
Some inconsistencies with the Workflows version may exist
 Parameters
*args (array_likes) – The arrays to broadcast.
subok (bool, optional) – If True, then subclasses will be passedthrough, otherwise the returned arrays will be forced to be a baseclass array (default).
 Returns
broadcasted – These arrays are views on the original arrays. They are typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location. If you need to write to the arrays, make copies first. While you can set the
writable
flag True, writing to a single output value may end up changing more than one location in the output array.Deprecated since version 1.17: The output is currently marked so that if written to, a deprecation warning will be emitted. A future version will set the
writable
flag False so writing to it will raise an error. Return type
list of arrays

broadcast_to
(array: Union[Array, MaskedArray], shape: List[Int]) → Union[Array, MaskedArray]¶ Broadcast an array to a new shape.
This docstring was copied from
numpy.broadcast_to
Some inconsistencies with the Workflows version may exist
 Parameters
array (array_like) – The array to broadcast.
shape (tuple) – The shape of the desired array.
subok (bool, optional) – If True, then subclasses will be passedthrough, otherwise the returned array will be forced to be a baseclass array (default).
 Returns
broadcast – A readonly view on the original array with the given shape. It is typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location.
 Return type
array
Notes
New in version 1.10.0.

cbrt
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Return the cuberoot of an array, elementwise.
This docstring was copied from
numpy.cbrt
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – The values whose cuberoots are required.
 Returns
y – An array of the same shape as x, containing the cube cuberoot of each element in x. If out was provided, y is a reference to it. This is a scalar if x is a scalar.
 Return type
ndarray

ceil
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Return the ceiling of the input, elementwise.
This docstring was copied from
numpy.ceil
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input data.
 Returns
y – The ceiling of each element in x, with float dtype. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

clip
(a: Union[Array, MaskedArray, Scalar], a_min: Union[Int, MaskedArray, Array, Scalar, Float], a_max: Union[Int, MaskedArray, Array, Scalar, Float]) → Union[Array, MaskedArray, Scalar]¶ Clip (limit) the values in an array.
This docstring was copied from
numpy.clip
Some inconsistencies with the Workflows version may exist
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.Equivalent to but faster than
np.minimum(a_max, np.maximum(a, a_min))
.No check is performed to ensure
a_min < a_max
. Parameters
a (array_like) – Array containing elements to clip.
a_max (a_min,) – Minimum and maximum value. If
None
, clipping is not performed on the corresponding edge. Only one of a_min and a_max may beNone
. Both are broadcast against a.out (ndarray, optional) – The results will be placed in this array. It may be the input array for inplace clipping. out must be of the right shape to hold the output. Its type is preserved.
**kwargs –
For other keywordonly arguments, see the ufunc docs.
New in version 1.17.0.
 Returns
clipped_array – An array with the elements of a, but where values < a_min are replaced with a_min, and those > a_max with a_max.
 Return type
ndarray
Notes
When a_min is greater than a_max, clip returns an array in which all values are equal to a_max, as shown in the second example.

compress
(condition: Union[Array, MaskedArray], a: Union[Array, MaskedArray], axis: Optional[Int] = None) → Union[Array, MaskedArray]¶ Return selected slices of an array along given axis.
This docstring was copied from
numpy.compress
Some inconsistencies with the Workflows version may exist
When working along a given axis, a slice along that axis is returned in output for each index where condition evaluates to True. When working on a 1D array, compress is equivalent to extract.
 Parameters
condition (1D array of bools) – Array that selects which entries to return. If len(condition) is less than the size of a along the given axis, then output is truncated to the length of the condition array.
a (array_like) – Array from which to extract a part.
axis (int, optional) – Axis along which to take slices. If None (default), work on the flattened array.
out (ndarray, optional) – Output array. Its type is preserved and it must be of the right shape to hold the output.
 Returns
compressed_array – A copy of a without the slices along axis for which condition is false.
 Return type
ndarray

concatenate
(arrays: Union[List[MaskedArray], List[Array]], axis: Int = 0) → Union[Array, MaskedArray]¶ Join a sequence of arrays along an existing axis.
This docstring was copied from
numpy.concatenate
Some inconsistencies with the Workflows version may exist
 Parameters
a2, .. (a1,) – The arrays must have the same shape, except in the dimension corresponding to axis (the first, by default).
axis (int, optional) – The axis along which the arrays will be joined. If axis is None, arrays are flattened before use. Default is 0.
out (ndarray, optional) – If provided, the destination to place the result. The shape must be correct, matching that of what concatenate would have returned if no out argument were specified.
dtype (str or dtype) –
If provided, the destination array will have this dtype. Cannot be provided together with out.
New in version 1.20.0.
casting ({'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional) –
Controls what kind of data casting may occur. Defaults to ‘same_kind’.
New in version 1.20.0.
 Returns
res – The concatenated array.
 Return type
ndarray
Notes
When one or more of the arrays to be concatenated is a MaskedArray, this function will return a MaskedArray object instead of an ndarray, but the input masks are not preserved. In cases where a MaskedArray is expected as input, use the ma.concatenate function from the masked array module instead.

conj
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Return the complex conjugate, elementwise.
This docstring was copied from
numpy.conjugate
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input value.
 Returns
y – The complex conjugate of x, with same dtype as y. This is a scalar if x is a scalar.
 Return type
ndarray

conjugate
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Return the complex conjugate, elementwise.
This docstring was copied from
numpy.conjugate
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input value.
 Returns
y – The complex conjugate of x, with same dtype as y. This is a scalar if x is a scalar.
 Return type
ndarray

copysign
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Change the sign of x1 to that of x2, elementwise.
This docstring was copied from
numpy.copysign
Some inconsistencies with the Workflows version may exist
 Parameters
x1 (array_like) – Values to change the sign of.
x2 (array_like) – The sign of x2 is copied to x1.
 Returns
out – The values of x1 with the sign of x2. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or scalar

corrcoef
(x: Union[Array, MaskedArray], y: Union[Array, NoneType, MaskedArray] = None, rowvar: Bool = True) → Union[Array, MaskedArray]¶ Return Pearson productmoment correlation coefficients.
This docstring was copied from
numpy.corrcoef
Some inconsistencies with the Workflows version may exist
Please refer to the documentation for cov for more detail. The relationship between the correlation coefficient matrix, R, and the covariance matrix, C, is
\[R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} * C_{jj} } }\]The values of R are between 1 and 1, inclusive.
 Parameters
x (array_like) – A 1D or 2D array containing multiple variables and observations. Each row of x represents a variable, and each column a single observation of all those variables. Also see rowvar below.
y (array_like, optional) – An additional set of variables and observations. y has the same shape as x.
rowvar (bool, optional) – If rowvar is True (default), then each row represents a variable, with observations in the columns. Otherwise, the relationship is transposed: each column represents a variable, while the rows contain observations.
bias (_NoValue, optional) –
Has no effect, do not use.
Deprecated since version 1.10.0.
ddof (_NoValue, optional) –
Has no effect, do not use.
Deprecated since version 1.10.0.
dtype (datatype, optional) –
Datatype of the result. By default, the return datatype will have at least numpy.float64 precision.
New in version 1.20.
 Returns
R – The correlation coefficient matrix of the variables.
 Return type
ndarray
Notes
Due to floating point rounding the resulting array may not be Hermitian, the diagonal elements may not be 1, and the elements may not satisfy the inequality abs(a) <= 1. The real and imaginary parts are clipped to the interval [1, 1] in an attempt to improve on that situation but is not much help in the complex case.
This function accepts but discards arguments bias and ddof. This is for backwards compatibility with previous versions of this function. These arguments had no effect on the return values of the function and can be safely ignored in this and previous versions of numpy.

cos
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Cosine elementwise.
This docstring was copied from
numpy.cos
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array in radians.
 Returns
y – The corresponding cosine values. This is a scalar if x is a scalar.
 Return type
ndarray

cosh
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Hyperbolic cosine, elementwise.
This docstring was copied from
numpy.cosh
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array.
 Returns
out – Output array of same shape as x. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

count_nonzero
(a: Union[Array, MaskedArray, Scalar], axis: Optional[Int] = None) → Union[Array, MaskedArray, Scalar]¶ Counts the number of nonzero values in the array
a
.This docstring was copied from
numpy.count_nonzero
Some inconsistencies with the Workflows version may exist
The word “nonzero” is in reference to the Python 2.x builtin method
__nonzero__()
(renamed__bool__()
in Python 3.x) of Python objects that tests an object’s “truthfulness”. For example, any number is considered truthful if it is nonzero, whereas any string is considered truthful if it is not the empty string. Thus, this function (recursively) counts how many elements ina
(and in subarrays thereof) have their__nonzero__()
or__bool__()
method evaluated toTrue
. Parameters
a (array_like) – The array for which to count nonzeros.
axis (int or tuple, optional) –
Axis or tuple of axes along which to count nonzeros. Default is None, meaning that nonzeros will be counted along a flattened version of
a
.New in version 1.12.0.
keepdims (bool, optional) –
If this is set to True, the axes that are counted are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
New in version 1.19.0.
 Returns
count – Number of nonzero values in the array along a given axis. Otherwise, the total number of nonzero values in the array is returned.
 Return type
int or array of int

cov
(m: Union[Array, MaskedArray], y: Union[Array, NoneType, MaskedArray] = None, rowvar: Bool = True, bias: Bool = False, ddof: Optional[Int] = None, fweights: Union[Array, Int, NoneType] = None, aweights: Optional[Array] = None) → Union[Array, MaskedArray]¶ Estimate a covariance matrix, given data and weights.
This docstring was copied from
numpy.cov
Some inconsistencies with the Workflows version may exist
Covariance indicates the level to which two variables vary together. If we examine Ndimensional samples, \(X = [x_1, x_2, ... x_N]^T\), then the covariance matrix element \(C_{ij}\) is the covariance of \(x_i\) and \(x_j\). The element \(C_{ii}\) is the variance of \(x_i\).
See the notes for an outline of the algorithm.
 Parameters
m (array_like) – A 1D or 2D array containing multiple variables and observations. Each row of m represents a variable, and each column a single observation of all those variables. Also see rowvar below.
y (array_like, optional) – An additional set of variables and observations. y has the same form as that of m.
rowvar (bool, optional) – If rowvar is True (default), then each row represents a variable, with observations in the columns. Otherwise, the relationship is transposed: each column represents a variable, while the rows contain observations.
bias (bool, optional) – Default normalization (False) is by
(N  1)
, whereN
is the number of observations given (unbiased estimate). If bias is True, then normalization is byN
. These values can be overridden by using the keywordddof
in numpy versions >= 1.5.ddof (int, optional) –
If not
None
the default value implied by bias is overridden. Note thatddof=1
will return the unbiased estimate, even if both fweights and aweights are specified, andddof=0
will return the simple average. See the notes for the details. The default value isNone
.New in version 1.5.
fweights (array_like, int, optional) –
1D array of integer frequency weights; the number of times each observation vector should be repeated.
New in version 1.10.
aweights (array_like, optional) –
1D array of observation vector weights. These relative weights are typically large for observations considered “important” and smaller for observations considered less “important”. If
ddof=0
the array of weights can be used to assign probabilities to observation vectors.New in version 1.10.
dtype (datatype, optional) –
Datatype of the result. By default, the return datatype will have at least numpy.float64 precision.
New in version 1.20.
 Returns
out – The covariance matrix of the variables.
 Return type
ndarray
Notes
Assume that the observations are in the columns of the observation array m and let
f = fweights
anda = aweights
for brevity. The steps to compute the weighted covariance are as follows:>>> m = np.arange(10, dtype=np.float64) >>> f = np.arange(10) * 2 >>> a = np.arange(10) ** 2. >>> ddof = 1 >>> w = f * a >>> v1 = np.sum(w) >>> v2 = np.sum(w * a) >>> m = np.sum(m  w, axis=None, keepdims=True) / v1 >>> cov = np.dot(m  w, m.T) * v1 / (v1**2  ddof * v2)
Note that when
a == 1
, the normalization factorv1 / (v1**2  ddof * v2)
goes over to1 / (np.sum(f)  ddof)
as it should.

cumprod
(a: Union[Array, MaskedArray, Scalar], axis: Optional[Int] = None, dtype: Optional[DType] = None) → Union[Array, MaskedArray]¶ Return the cumulative product of elements along a given axis.
This docstring was copied from
numpy.cumprod
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input array.
axis (int, optional) – Axis along which the cumulative product is computed. By default the input is flattened.
dtype (dtype, optional) – Type of the returned array, as well as of the accumulator in which the elements are multiplied. If dtype is not specified, it defaults to the dtype of a, unless a has an integer dtype with a precision less than that of the default platform integer. In that case, the default platform integer is used instead.
out (ndarray, optional) – Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type of the resulting values will be cast if necessary.
 Returns
cumprod – A new array holding the result is returned unless out is specified, in which case a reference to out is returned.
 Return type
ndarray
Notes
Arithmetic is modular when using integer types, and no error is raised on overflow.

cumsum
(a: Union[Array, MaskedArray, Scalar], axis: Optional[Int] = None, dtype: Optional[DType] = None) → Union[Array, MaskedArray]¶ Return the cumulative sum of the elements along a given axis.
This docstring was copied from
numpy.cumsum
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input array.
axis (int, optional) – Axis along which the cumulative sum is computed. The default (None) is to compute the cumsum over the flattened array.
dtype (dtype, optional) – Type of the returned array and of the accumulator in which the elements are summed. If dtype is not specified, it defaults to the dtype of a, unless a has an integer dtype with a precision less than that of the default platform integer. In that case, the default platform integer is used.
out (ndarray, optional) – Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type will be cast if necessary. See ufuncsoutputtype for more details.
 Returns
cumsum_along_axis – A new array holding the result is returned unless out is specified, in which case a reference to out is returned. The result has the same size as a, and the same shape as a if axis is not None or a is a 1d array.
 Return type
ndarray.
Notes
Arithmetic is modular when using integer types, and no error is raised on overflow.
cumsum(a)[1]
may not be equal tosum(a)
for floatingpoint values sincesum
may use a pairwise summation routine, reducing the roundofferror. See sum for more information.

deg2rad
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Convert angles from degrees to radians.
This docstring was copied from
numpy.deg2rad
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Angles in degrees.
 Returns
y – The corresponding angle in radians. This is a scalar if x is a scalar.
 Return type
ndarray

degrees
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Convert angles from radians to degrees.
This docstring was copied from
numpy.degrees
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array in radians.
 Returns
y – The corresponding degree values; if out was supplied this is a reference to it. This is a scalar if x is a scalar.
 Return type
ndarray of floats

diag
(v: Union[Array, MaskedArray]) → Array¶ Extract a diagonal or construct a diagonal array.
This docstring was copied from
numpy.diag
Some inconsistencies with the Workflows version may exist
See the more detailed documentation for
numpy.diagonal
if you use this function to extract a diagonal and wish to write to the resulting array; whether it returns a copy or a view depends on what version of numpy you are using. Parameters
v (array_like) – If v is a 2D array, return a copy of its kth diagonal. If v is a 1D array, return a 2D array with v on the kth diagonal.
k (int, optional) – Diagonal in question. The default is 0. Use k>0 for diagonals above the main diagonal, and k<0 for diagonals below the main diagonal.
 Returns
out – The extracted diagonal or constructed diagonal array.
 Return type
ndarray

diagonal
(a: Union[Array, MaskedArray], offset: Int = 0, axis1: Int = 0, axis2: Int = 1) → Union[Array, MaskedArray]¶ Return specified diagonals.
This docstring was copied from
numpy.diagonal
Some inconsistencies with the Workflows version may exist
If a is 2D, returns the diagonal of a with the given offset, i.e., the collection of elements of the form
a[i, i+offset]
. If a has more than two dimensions, then the axes specified by axis1 and axis2 are used to determine the 2D subarray whose diagonal is returned. The shape of the resulting array can be determined by removing axis1 and axis2 and appending an index to the right equal to the size of the resulting diagonals.In versions of NumPy prior to 1.7, this function always returned a new, independent array containing a copy of the values in the diagonal.
In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, but depending on this fact is deprecated. Writing to the resulting array continues to work as it used to, but a FutureWarning is issued.
Starting in NumPy 1.9 it returns a readonly view on the original array. Attempting to write to the resulting array will produce an error.
In some future release, it will return a read/write view and writing to the returned array will alter your original array. The returned array will have the same type as the input array.
If you don’t write to the array returned by this function, then you can just ignore all of the above.
If you depend on the current behavior, then we suggest copying the returned array explicitly, i.e., use
np.diagonal(a).copy()
instead of justnp.diagonal(a)
. This will work with both past and future versions of NumPy. Parameters
a (array_like) – Array from which the diagonals are taken.
offset (int, optional) – Offset of the diagonal from the main diagonal. Can be positive or negative. Defaults to main diagonal (0).
axis1 (int, optional) – Axis to be used as the first axis of the 2D subarrays from which the diagonals should be taken. Defaults to first axis (0).
axis2 (int, optional) – Axis to be used as the second axis of the 2D subarrays from which the diagonals should be taken. Defaults to second axis (1).
 Returns
array_of_diagonals – If a is 2D, then a 1D array containing the diagonal and of the same type as a is returned unless a is a matrix, in which case a 1D array rather than a (2D) matrix is returned in order to maintain backward compatibility.
If
a.ndim > 2
, then the dimensions specified by axis1 and axis2 are removed, and a new axis inserted at the end corresponding to the diagonal. Return type
ndarray

diff
(a: Union[Array, MaskedArray], n: Int = 1, axis: Int = 1) → Union[Array, MaskedArray]¶ Calculate the nth discrete difference along the given axis.
This docstring was copied from
numpy.diff
Some inconsistencies with the Workflows version may exist
The first difference is given by
out[i] = a[i+1]  a[i]
along the given axis, higher differences are calculated by using diff recursively. Parameters
a (array_like) – Input array
n (int, optional) – The number of times values are differenced. If zero, the input is returned asis.
axis (int, optional) – The axis along which the difference is taken, default is the last axis.
append (prepend,) –
Values to prepend or append to a along axis prior to performing the difference. Scalar values are expanded to arrays with length 1 in the direction of axis and the shape of the input array in along all other axes. Otherwise the dimension and shape must match a except along axis.
New in version 1.16.0.
 Returns
diff – The nth differences. The shape of the output is the same as a except along axis where the dimension is smaller by n. The type of the output is the same as the type of the difference between any two elements of a. This is the same as the type of a in most cases. A notable exception is datetime64, which results in a timedelta64 output array.
 Return type
ndarray
Notes
Type is preserved for boolean arrays, so the result will contain False when consecutive elements are the same and True when they differ.
For unsigned integer arrays, the results will also be unsigned. This should not be surprising, as the result is consistent with calculating the difference directly:
>>> u8_arr = np.array([1, 0], dtype=np.uint8) >>> np.diff(u8_arr) array([255], dtype=uint8) >>> u8_arr[1,...]  u8_arr[0,...] 255
If this is not desirable, then the array should be cast to a larger integer type first:
>>> i16_arr = u8_arr.astype(np.int16) >>> np.diff(i16_arr) array([1], dtype=int16)

digitize
(x: Union[Array, MaskedArray, Scalar], bins: Union[Array, MaskedArray], right: Bool = False) → Union[Array, Scalar]¶ Return the indices of the bins to which each value in input array belongs.
This docstring was copied from
numpy.digitize
Some inconsistencies with the Workflows version may exist
right
order of bins
returned index i satisfies
False
increasing
bins[i1] <= x < bins[i]
True
increasing
bins[i1] < x <= bins[i]
False
decreasing
bins[i1] > x >= bins[i]
True
decreasing
bins[i1] >= x > bins[i]
If values in x are beyond the bounds of bins, 0 or
len(bins)
is returned as appropriate. Parameters
x (array_like) – Input array to be binned. Prior to NumPy 1.10.0, this array had to be 1dimensional, but can now have any shape.
bins (array_like) – Array of bins. It has to be 1dimensional and monotonic.
right (bool, optional) – Indicating whether the intervals include the right or the left bin edge. Default behavior is (right==False) indicating that the interval does not include the right edge. The left bin end is open in this case, i.e., bins[i1] <= x < bins[i] is the default behavior for monotonically increasing bins.
 Returns
indices – Output array of indices, of same shape as x.
 Return type
ndarray of ints
Notes
If values in x are such that they fall outside the bin range, attempting to index bins with the indices that digitize returns will result in an IndexError.
New in version 1.10.0.
np.digitize is implemented in terms of np.searchsorted. This means that a binary search is used to bin the values, which scales much better for larger number of bins than the previous linear search. It also removes the requirement for the input array to be 1dimensional.
For monotonically _increasing_ bins, the following are equivalent:
np.digitize(x, bins, right=True) np.searchsorted(bins, x, side='left')
Note that as the order of the arguments are reversed, the side must be too. The searchsorted call is marginally faster, as it does not do any monotonicity checks. Perhaps more importantly, it supports all dtypes.

divide
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Returns a true division of the inputs, elementwise.
This docstring was copied from
numpy.true_divide
Some inconsistencies with the Workflows version may exist
 Parameters
x1 (array_like) – Dividend array.
x2 (array_like) – Divisor array.
 Returns
out – This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or scalar

dot
(a: Union[Array, MaskedArray, Scalar], b: Union[Array, MaskedArray, Scalar]) → Union[Array, MaskedArray, Scalar]¶ Dot product of two arrays. Specifically,
This docstring was copied from
numpy.dot
Some inconsistencies with the Workflows version may exist
If both a and b are 1D arrays, it is inner product of vectors (without complex conjugation).
If both a and b are 2D arrays, it is matrix multiplication, but using
matmul()
ora @ b
is preferred.If either a or b is 0D (scalar), it is equivalent to
multiply()
and usingnumpy.multiply(a, b)
ora * b
is preferred.If a is an ND array and b is a 1D array, it is a sum product over the last axis of a and b.
If a is an ND array and b is an MD array (where
M>=2
), it is a sum product over the last axis of a and the secondtolast axis of b:dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m])
 Parameters
a (array_like) – First argument.
b (array_like) – Second argument.
out (ndarray, optional) – Output argument. This must have the exact kind that would be returned if it was not used. In particular, it must have the right type, must be Ccontiguous, and its dtype must be the dtype that would be returned for dot(a,b). This is a performance feature. Therefore, if these conditions are not met, an exception is raised, instead of attempting to be flexible.
 Returns
output – Returns the dot product of a and b. If a and b are both scalars or both 1D arrays then a scalar is returned; otherwise an array is returned. If out is given, then it is returned.
 Return type
ndarray

dstack
(arrays: Union[List[MaskedArray], List[Array]]) → Union[Array, MaskedArray]¶ Stack arrays in sequence depth wise (along third axis).
This docstring was copied from
numpy.dstack
Some inconsistencies with the Workflows version may exist
This is equivalent to concatenation along the third axis after 2D arrays of shape (M,N) have been reshaped to (M,N,1) and 1D arrays of shape (N,) have been reshaped to (1,N,1). Rebuilds arrays divided by dsplit.
This function makes most sense for arrays with up to 3 dimensions. For instance, for pixeldata with a height (first axis), width (second axis), and r/g/b channels (third axis). The functions concatenate, stack and block provide more general stacking and concatenation operations.
 Parameters
tup (sequence of arrays) – The arrays must have the same shape along all but the third axis. 1D or 2D arrays must have the same shape.
 Returns
stacked – The array formed by stacking the given arrays, will be at least 3D.
 Return type
ndarray

ediff1d
(ary: Union[Array, MaskedArray, Scalar], to_end: Union[Array, NoneType, MaskedArray, Scalar] = None, to_begin: Union[Array, NoneType, MaskedArray, Scalar] = None) → Union[Array, MaskedArray]¶ The differences between consecutive elements of an array.
This docstring was copied from
numpy.ediff1d
Some inconsistencies with the Workflows version may exist
 Parameters
ary (array_like) – If necessary, will be flattened before the differences are taken.
to_end (array_like, optional) – Number(s) to append at the end of the returned differences.
to_begin (array_like, optional) – Number(s) to prepend at the beginning of the returned differences.
 Returns
ediff1d – The differences. Loosely, this is
ary.flat[1:]  ary.flat[:1]
. Return type
ndarray
Notes
When applied to masked arrays, this function drops the mask information if the to_begin and/or to_end parameters are used.

einsum
(subscripts: Str, *operands: Array, dtype: Optional[DType] = None, casting: Str = 'safe', optimize: Union[Bool, Str] = False) → Array¶ Evaluates the Einstein summation convention on the operands.
This docstring was copied from
numpy.einsum
Some inconsistencies with the Workflows version may exist
Using the Einstein summation convention, many common multidimensional, linear algebraic array operations can be represented in a simple fashion. In implicit mode einsum computes these values.
In explicit mode, einsum provides further flexibility to compute other array operations that might not be considered classical Einstein summation operations, by disabling, or forcing summation over specified subscript labels.
See the notes and examples for clarification.
 Parameters
subscripts (str) – Specifies the subscripts for summation as comma separated list of subscript labels. An implicit (classical Einstein summation) calculation is performed unless the explicit indicator ‘>’ is included as well as subscript labels of the precise output form.
operands (list of array_like) – These are the arrays for the operation.
out (ndarray, optional) – If provided, the calculation is done into this array.
dtype ({datatype, None}, optional) – If provided, forces the calculation to use the data type specified. Note that you may have to also give a more liberal casting parameter to allow the conversions. Default is None.
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘K’.
casting ({'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional) –
Controls what kind of data casting may occur. Setting this to ‘unsafe’ is not recommended, as it can adversely affect accumulations.
’no’ means the data types should not be cast at all.
’equiv’ means only byteorder changes are allowed.
’safe’ means only casts which can preserve values are allowed.
’same_kind’ means only safe casts or casts within a kind, like float64 to float32, are allowed.
’unsafe’ means any data conversions may be done.
Default is ‘safe’.
optimize ({False, True, 'greedy', 'optimal'}, optional) – Controls if intermediate optimization should occur. No optimization will occur if False and True will default to the ‘greedy’ algorithm. Also accepts an explicit contraction list from the
np.einsum_path
function. Seenp.einsum_path
for more details. Defaults to False.
 Returns
output – The calculation based on the Einstein summation convention.
 Return type
ndarray
Notes
New in version 1.6.0.
The Einstein summation convention can be used to compute many multidimensional, linear algebraic array operations. einsum provides a succinct way of representing these.
A nonexhaustive list of these operations, which can be computed by einsum, is shown below along with examples:
Trace of an array,
numpy.trace()
.Return a diagonal,
numpy.diag()
.Array axis summations,
numpy.sum()
.Transpositions and permutations,
numpy.transpose()
.Matrix multiplication and dot product,
numpy.matmul()
numpy.dot()
.Vector inner and outer products,
numpy.inner()
numpy.outer()
.Broadcasting, elementwise and scalar multiplication,
numpy.multiply()
.Tensor contractions,
numpy.tensordot()
.Chained array operations, in efficient calculation order,
numpy.einsum_path()
.
The subscripts string is a commaseparated list of subscript labels, where each label refers to a dimension of the corresponding operand. Whenever a label is repeated it is summed, so
np.einsum('i,i', a, b)
is equivalent tonp.inner(a,b)
. If a label appears only once, it is not summed, sonp.einsum('i', a)
produces a view ofa
with no changes. A further examplenp.einsum('ij,jk', a, b)
describes traditional matrix multiplication and is equivalent tonp.matmul(a,b)
. Repeated subscript labels in one operand take the diagonal. For example,np.einsum('ii', a)
is equivalent tonp.trace(a)
.In implicit mode, the chosen subscripts are important since the axes of the output are reordered alphabetically. This means that
np.einsum('ij', a)
doesn’t affect a 2D array, whilenp.einsum('ji', a)
takes its transpose. Additionally,np.einsum('ij,jk', a, b)
returns a matrix multiplication, while,np.einsum('ij,jh', a, b)
returns the transpose of the multiplication since subscript ‘h’ precedes subscript ‘i’.In explicit mode the output can be directly controlled by specifying output subscript labels. This requires the identifier ‘>’ as well as the list of output subscript labels. This feature increases the flexibility of the function since summing can be disabled or forced when required. The call
np.einsum('i>', a)
is likenp.sum(a, axis=1)
, andnp.einsum('ii>i', a)
is likenp.diag(a)
. The difference is that einsum does not allow broadcasting by default. Additionallynp.einsum('ij,jh>ih', a, b)
directly specifies the order of the output subscript labels and therefore returns matrix multiplication, unlike the example above in implicit mode.To enable and control broadcasting, use an ellipsis. Default NumPystyle broadcasting is done by adding an ellipsis to the left of each term, like
np.einsum('...ii>...i', a)
. To take the trace along the first and last axes, you can donp.einsum('i...i', a)
, or to do a matrixmatrix product with the leftmost indices instead of rightmost, one can donp.einsum('ij...,jk...>ik...', a, b)
.When there is only one operand, no axes are summed, and no output parameter is provided, a view into the operand is returned instead of a new array. Thus, taking the diagonal as
np.einsum('ii>i', a)
produces a view (changed in version 1.10.0).einsum also provides an alternative way to provide the subscripts and operands as
einsum(op0, sublist0, op1, sublist1, ..., [sublistout])
. If the output shape is not provided in this format einsum will be calculated in implicit mode, otherwise it will be performed explicitly. The examples below have corresponding einsum calls with the two parameter methods.New in version 1.10.0.
Views returned from einsum are now writeable whenever the input array is writeable. For example,
np.einsum('ijk...>kji...', a)
will now have the same effect asnp.swapaxes(a, 0, 2)
andnp.einsum('ii>i', a)
will return a writeable view of the diagonal of a 2D array.New in version 1.12.0.
Added the
optimize
argument which will optimize the contraction order of an einsum expression. For a contraction with three or more operands this can greatly increase the computational efficiency at the cost of a larger memory footprint during computation.Typically a ‘greedy’ algorithm is applied which empirical tests have shown returns the optimal path in the majority of cases. In some cases ‘optimal’ will return the superlative path through a more expensive, exhaustive search. For iterative calculations it may be advisable to calculate the optimal path once and reuse that path by supplying it as an argument. An example is given below.
See
numpy.einsum_path()
for more details.

equal
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Return (x1 == x2) elementwise.
This docstring was copied from
numpy.equal
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Input arrays.
 Returns
out – Output array, elementwise comparison of x1 and x2. Typically of type bool, unless
dtype=object
is passed. This is a scalar if both x1 and x2 are scalars. Return type
ndarray or scalar

exp
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Calculate the exponential of all elements in the input array.
This docstring was copied from
numpy.exp
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input values.
 Returns
out – Output array, elementwise exponential of x. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

exp2
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Calculate 2**p for all p in the input array.
This docstring was copied from
numpy.exp2
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input values.
 Returns
out – Elementwise 2 to the power x. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

expm1
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Calculate
exp(x)  1
for all elements in the array.This docstring was copied from
numpy.expm1
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input values.
 Returns
out – Elementwise exponential minus one:
out = exp(x)  1
. This is a scalar if x is a scalar. Return type
ndarray or scalar

eye
(N: Int, M: Optional[Int] = None, k: Int = 0, dtype: DType = <descarteslabs.workflows.types.array.dtype.DType object>) → Array¶ Return a 2D array with ones on the diagonal and zeros elsewhere.
This docstring was copied from
numpy.eye
Some inconsistencies with the Workflows version may exist
 Parameters
N (int) – Number of rows in the output.
M (int, optional) – Number of columns in the output. If None, defaults to N.
k (int, optional) – Index of the diagonal: 0 (the default) refers to the main diagonal, a positive value refers to an upper diagonal, and a negative value to a lower diagonal.
dtype (datatype, optional) – Datatype of the returned array.
order ({'C', 'F'}, optional) –
Whether the output should be stored in rowmajor (Cstyle) or columnmajor (Fortranstyle) order in memory.
New in version 1.14.0.
like (array_like) –
Reference object to allow the creation of arrays which are not NumPy arrays. If an arraylike passed in as
like
supports the__array_function__
protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.New in version 1.20.0.
 Returns
I – An array where all elements are equal to zero, except for the kth diagonal, whose values are equal to one.
 Return type
ndarray of shape (N,M)

fabs
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Compute the absolute values elementwise.
This docstring was copied from
numpy.fabs
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – The array of numbers for which the absolute values are required. If
 Returns
y – The absolute values of x, the returned values are always floats. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

fix
(x: Union[Array, MaskedArray, Scalar]) → Union[Array, MaskedArray, Scalar]¶ Round to nearest integer towards zero.
This docstring was copied from
numpy.fix
Some inconsistencies with the Workflows version may exist
Round an array of floats elementwise to nearest integer towards zero. The rounded values are returned as floats.
 Parameters
x (array_like) – An array of floats to be rounded
out (ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the input broadcasts to. If not provided or None, a freshlyallocated array is returned.
 Returns
out – A float array with the same dimensions as the input. If second argument is not supplied then a float array is returned with the rounded values.
If a second argument is supplied the result is stored there. The return value out is then a reference to that array.
 Return type
ndarray of floats

flatnonzero
(a: Union[Array, MaskedArray, Scalar]) → Array¶ Return indices that are nonzero in the flattened version of a.
This docstring was copied from
numpy.flatnonzero
Some inconsistencies with the Workflows version may exist
This is equivalent to np.nonzero(np.ravel(a))[0].
 Parameters
a (array_like) – Input data.
 Returns
res – Output array, containing the indices of the elements of a.ravel() that are nonzero.
 Return type
ndarray

float_power
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ First array elements raised to powers from second array, elementwise.
This docstring was copied from
numpy.float_power
Some inconsistencies with the Workflows version may exist
 Parameters
x1 (array_like) – The bases.
x2 (array_like) – The exponents.
 Returns
y – The bases in x1 raised to the exponents in x2. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray

floor
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Return the floor of the input, elementwise.
This docstring was copied from
numpy.floor
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input data.
 Returns
y – The floor of each element in x. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

floor_divide
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Return the largest integer smaller or equal to the division of the inputs. It is equivalent to the Python
//
operator and pairs with the Python%
(remainder), function so thata = a % b + b * (a // b)
up to roundoff.This docstring was copied from
numpy.floor_divide
Some inconsistencies with the Workflows version may exist
 Parameters
x1 (array_like) – Numerator.
x2 (array_like) – Denominator.
 Returns
y – y = floor(x1/x2) This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray

fmax
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Elementwise maximum of array elements.
This docstring was copied from
numpy.fmax
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – The arrays holding the elements to be compared.
 Returns
y – The maximum of x1 and x2, elementwise. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or scalar

fmin
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Elementwise minimum of array elements.
This docstring was copied from
numpy.fmin
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – The arrays holding the elements to be compared.
 Returns
y – The minimum of x1 and x2, elementwise. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or scalar

fmod
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Return the elementwise remainder of division.
This docstring was copied from
numpy.fmod
Some inconsistencies with the Workflows version may exist
 Parameters
x1 (array_like) – Dividend.
x2 (array_like) – Divisor.
 Returns
y – The remainder of the division of x1 by x2. This is a scalar if both x1 and x2 are scalars.
 Return type
array_like

full
(shape: Union[Int, List[Int]], fill_value: Union[Int, Bool, MaskedArray, Array, Scalar, Float], dtype: Optional[DType] = None) → Array¶ Return a new array of given shape and type, filled with fill_value.
This docstring was copied from
numpy.full
Some inconsistencies with the Workflows version may exist
 Parameters
shape (int or sequence of ints) – Shape of the new array, e.g.,
(2, 3)
or2
.fill_value (scalar or array_like) – Fill value.
dtype (datatype, optional) –
 The desired datatype for the array The default, None, means
np.array(fill_value).dtype
.
order ({'C', 'F'}, optional) – Whether to store multidimensional data in C or Fortrancontiguous (row or columnwise) order in memory.
like (array_like) –
Reference object to allow the creation of arrays which are not NumPy arrays. If an arraylike passed in as
like
supports the__array_function__
protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.New in version 1.20.0.
 Returns
out – Array of fill_value with the given shape, dtype, and order.
 Return type
ndarray

full_like
(a: Union[Array, MaskedArray, Scalar], fill_value: Union[Int, Bool, MaskedArray, Array, Scalar, Float], dtype: Optional[DType] = None) → Array¶ Return a full array with the same shape and type as a given array.
This docstring was copied from
numpy.full_like
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – The shape and datatype of a define these same attributes of the returned array.
fill_value (scalar) – Fill value.
dtype (datatype, optional) – Overrides the data type of the result.
order ({'C', 'F', 'A', or 'K'}, optional) – Overrides the memory layout of the result. ‘C’ means Corder, ‘F’ means Forder, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible.
subok (bool, optional.) – If True, then the newly created array will use the subclass type of a, otherwise it will be a baseclass array. Defaults to True.
shape (int or sequence of ints, optional.) –
Overrides the shape of the result. If order=’K’ and the number of dimensions is unchanged, will try to keep order, otherwise, order=’C’ is implied.
New in version 1.17.0.
 Returns
out – Array of fill_value with the same shape and type as a.
 Return type
ndarray

gradient
(f: Union[Array, MaskedArray], *varargs: Union[Array, Int, List[Int]], edge_order: Int = 1, axis: Optional[Int] = None) → Union[List[MaskedArray], List[Array]]¶ Return the gradient of an Ndimensional array.
This docstring was copied from
numpy.gradient
Some inconsistencies with the Workflows version may exist
The gradient is computed using second order accurate central differences in the interior points and either first or second order accurate onesides (forward or backwards) differences at the boundaries. The returned gradient hence has the same shape as the input array.
 Parameters
f (array_like) – An Ndimensional array containing samples of a scalar function.
varargs (list of scalar or array, optional) –
Spacing between f values. Default unitary spacing for all dimensions. Spacing can be specified using:
single scalar to specify a sample distance for all dimensions.
N scalars to specify a constant sample distance for each dimension. i.e. dx, dy, dz, …
N arrays to specify the coordinates of the values along each dimension of F. The length of the array must match the size of the corresponding dimension
Any combination of N scalars/arrays with the meaning of 2. and 3.
If axis is given, the number of varargs must equal the number of axes. Default: 1.
edge_order ({1, 2}, optional) –
Gradient is calculated using Nth order accurate differences at the boundaries. Default: 1.
New in version 1.9.1.
axis (None or int or tuple of ints, optional) –
Gradient is calculated only along the given axis or axes The default (axis = None) is to calculate the gradient for all the axes of the input array. axis may be negative, in which case it counts from the last to the first axis.
New in version 1.11.0.
 Returns
gradient – A list of ndarrays (or a single ndarray if there is only one dimension) corresponding to the derivatives of f with respect to each dimension. Each derivative has the same shape as f.
 Return type
ndarray or list of ndarray

greater
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Return the truth value of (x1 > x2) elementwise.
This docstring was copied from
numpy.greater
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Input arrays.
 Returns
out – Output array, elementwise comparison of x1 and x2. Typically of type bool, unless
dtype=object
is passed. This is a scalar if both x1 and x2 are scalars. Return type
ndarray or scalar

greater_equal
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Return the truth value of (x1 >= x2) elementwise.
This docstring was copied from
numpy.greater_equal
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Input arrays.
 Returns
out – Output array, elementwise comparison of x1 and x2. Typically of type bool, unless
dtype=object
is passed. This is a scalar if both x1 and x2 are scalars. Return type
bool or ndarray of bool

histogram
(a: Array, bins: Union[Int, Array, List[Float], List[Int], List[Scalar]] = 10, range: Union[Tuple[Float, Float], Tuple[Int, Int], Tuple[Scalar, Scalar], Tuple[Scalar, Int], Tuple[Int, Scalar], Tuple[Scalar, Float], Tuple[Float, Scalar], NoneType] = None, weights: Optional[Array] = None, density: Optional[Bool] = None) → Tuple[Array, Array]¶ Compute the histogram of a dataset.
This docstring was copied from
numpy.histogram
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input data. The histogram is computed over the flattened array.
bins (int or sequence of scalars or str, optional) –
If bins is an int, it defines the number of equalwidth bins in the given range (10, by default). If bins is a sequence, it defines a monotonically increasing array of bin edges, including the rightmost edge, allowing for nonuniform bin widths.
New in version 1.11.0.
If bins is a string, it defines the method used to calculate the optimal bin width, as defined by histogram_bin_edges.
range ((float, float), optional) – The lower and upper range of the bins. If not provided, range is simply
(a.min(), a.max())
. Values outside the range are ignored. The first element of the range must be less than or equal to the second. range affects the automatic bin computation as well. While bin width is computed to be optimal based on the actual data within range, the bin count will fill the entire range including portions containing no data.normed (bool, optional) –
Deprecated since version 1.6.0.
This is equivalent to the density argument, but produces incorrect results for unequal bin widths. It should not be used.
Changed in version 1.15.0: DeprecationWarnings are actually emitted.
weights (array_like, optional) – An array of weights, of the same shape as a. Each value in a only contributes its associated weight towards the bin count (instead of 1). If density is True, the weights are normalized, so that the integral of the density over the range remains 1.
density (bool, optional) –
If
False
, the result will contain the number of samples in each bin. IfTrue
, the result is the value of the probability density function at the bin, normalized such that the integral over the range is 1. Note that the sum of the histogram values will not be equal to 1 unless bins of unity width are chosen; it is not a probability mass function.Overrides the
normed
keyword if given.
 Returns
hist (array) – The values of the histogram. See density and weights for a description of the possible semantics.
bin_edges (array of dtype float) – Return the bin edges
(length(hist)+1)
.
Notes
All but the last (righthandmost) bin is halfopen. In other words, if bins is:
[1, 2, 3, 4]
then the first bin is
[1, 2)
(including 1, but excluding 2) and the second[2, 3)
. The last bin, however, is[3, 4]
, which includes 4.

hstack
(arrays: Union[List[MaskedArray], List[Array]]) → Union[Array, MaskedArray]¶ Stack arrays in sequence horizontally (column wise).
This docstring was copied from
numpy.hstack
Some inconsistencies with the Workflows version may exist
This is equivalent to concatenation along the second axis, except for 1D arrays where it concatenates along the first axis. Rebuilds arrays divided by hsplit.
This function makes most sense for arrays with up to 3 dimensions. For instance, for pixeldata with a height (first axis), width (second axis), and r/g/b channels (third axis). The functions concatenate, stack and block provide more general stacking and concatenation operations.
 Parameters
tup (sequence of ndarrays) – The arrays must have the same shape along all but the second axis, except 1D arrays which can be any length.
 Returns
stacked – The array formed by stacking the given arrays.
 Return type
ndarray

hypot
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Given the “legs” of a right triangle, return its hypotenuse.
This docstring was copied from
numpy.hypot
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Leg of the triangle(s).
 Returns
z – The hypotenuse of the triangle(s). This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray

imag
(val: Union[Array, MaskedArray, Scalar]) → Union[Array, MaskedArray]¶ Return the imaginary part of the complex argument.
This docstring was copied from
numpy.imag
Some inconsistencies with the Workflows version may exist
 Parameters
val (array_like) – Input array.
 Returns
out – The imaginary component of the complex argument. If val is real, the type of val is used for the output. If val has complex elements, the returned type is float.
 Return type
ndarray or scalar

indices
(dimensions: Union[List[Float], List[Int], List[Bool]], dtype: DType = <descarteslabs.workflows.types.array.dtype.DType object>) → Array¶ Return an array representing the indices of a grid.
This docstring was copied from
numpy.indices
Some inconsistencies with the Workflows version may exist
Compute an array where the subarrays contain index values 0, 1, … varying only along the corresponding axis.
 Parameters
dimensions (sequence of ints) – The shape of the grid.
dtype (dtype, optional) – Data type of the result.
sparse (boolean, optional) –
Return a sparse representation of the grid instead of a dense representation. Default is False.
New in version 1.17.
 Returns
grid –
 If sparse is False:
Returns one array of grid indices,
grid.shape = (len(dimensions),) + tuple(dimensions)
. If sparse is True:
Returns a tuple of arrays, with
grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)
with dimensions[i] in the ith place
 Return type
one ndarray or tuple of ndarrays
Notes
The output shape in the dense case is obtained by prepending the number of dimensions in front of the tuple of dimensions, i.e. if dimensions is a tuple
(r0, ..., rN1)
of lengthN
, the output shape is(N, r0, ..., rN1)
.The subarrays
grid[k]
contains the ND array of indices along thekth
axis. Explicitly:grid[k, i0, i1, ..., iN1] = ik

insert
(arr: Union[Array, MaskedArray], obj: Union[Int, Slice, List[Int]], values: Union[Array, MaskedArray, Scalar], axis: Int) → Union[Array, MaskedArray]¶ Insert values along the given axis before the given indices.
This docstring was copied from
numpy.insert
Some inconsistencies with the Workflows version may exist
 Parameters
arr (array_like) – Input array.
obj (int, slice or sequence of ints) –
Object that defines the index or indices before which values is inserted.
New in version 1.8.0.
Support for multiple insertions when obj is a single scalar or a sequence with one element (similar to calling insert multiple times).
values (array_like) – Values to insert into arr. If the type of values is different from that of arr, values is converted to the type of arr. values should be shaped so that
arr[...,obj,...] = values
is legal.axis (int, optional) – Axis along which to insert values. If axis is None then arr is flattened first.
 Returns
out – A copy of arr with values inserted. Note that insert does not occur inplace: a new array is returned. If axis is None, out is a flattened array.
 Return type
ndarray
Notes
Note that for higher dimensional inserts obj=0 behaves very different from obj=[0] just like arr[:,0,:] = values is different from arr[:,[0],:] = values.

isclose
(a: Union[Array, MaskedArray, Scalar], b: Union[Array, MaskedArray, Scalar], rtol: Union[Int, Float] = 1e05, atol: Union[Int, Float] = 1e08, equal_nan: Bool = False) → Union[Array, MaskedArray, Scalar]¶ Returns a boolean array where two arrays are elementwise equal within a tolerance.
This docstring was copied from
numpy.isclose
Some inconsistencies with the Workflows version may exist
The tolerance values are positive, typically very small numbers. The relative difference (rtol * abs(b)) and the absolute difference atol are added together to compare against the absolute difference between a and b.
Warning
The default atol is not appropriate for comparing numbers that are much smaller than one (see Notes).
 Parameters
b (a,) – Input arrays to compare.
rtol (float) – The relative tolerance parameter (see Notes).
atol (float) – The absolute tolerance parameter (see Notes).
equal_nan (bool) – Whether to compare NaN’s as equal. If True, NaN’s in a will be considered equal to NaN’s in b in the output array.
 Returns
y – Returns a boolean array of where a and b are equal within the given tolerance. If both a and b are scalars, returns a single boolean value.
 Return type
array_like
Notes
New in version 1.7.0.
For finite values, isclose uses the following equation to test whether two floating point values are equivalent.
absolute(a  b) <= (atol + rtol * absolute(b))
Unlike the builtin math.isclose, the above equation is not symmetric in a and b – it assumes b is the reference value – so that isclose(a, b) might be different from isclose(b, a). Furthermore, the default value of atol is not zero, and is used to determine what small values should be considered close to zero. The default value is appropriate for expected values of order unity: if the expected values are significantly smaller than one, it can result in false positives. atol should be carefully selected for the use case at hand. A zero value for atol will result in False if either a or b is zero.
isclose is not defined for nonnumeric data types.

isfinite
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Test elementwise for finiteness (not infinity or not Not a Number).
This docstring was copied from
numpy.isfinite
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input values.
 Returns
y – True where
x
is not positive infinity, negative infinity, or NaN; false otherwise. This is a scalar if x is a scalar. Return type
ndarray, bool

isin
(element: Union[Array, MaskedArray, Scalar], test_elements: Union[Array, MaskedArray, Scalar], assume_unique: Bool = False, invert: Bool = False) → Union[Array, Scalar]¶ Calculates element in test_elements, broadcasting over element only. Returns a boolean array of the same shape as element that is True where an element of element is in test_elements and False otherwise.
This docstring was copied from
numpy.isin
Some inconsistencies with the Workflows version may exist
 Parameters
element (array_like) – Input array.
test_elements (array_like) – The values against which to test each value of element. This argument is flattened if it is an array or array_like. See notes for behavior with nonarraylike parameters.
assume_unique (bool, optional) – If True, the input arrays are both assumed to be unique, which can speed up the calculation. Default is False.
invert (bool, optional) – If True, the values in the returned array are inverted, as if calculating element not in test_elements. Default is False.
np.isin(a, b, invert=True)
is equivalent to (but faster than)np.invert(np.isin(a, b))
.
 Returns
isin – Has the same shape as element. The values element[isin] are in test_elements.
 Return type
ndarray, bool
Notes
isin is an elementwise function version of the python keyword in.
isin(a, b)
is roughly equivalent tonp.array([item in b for item in a])
if a and b are 1D sequences.element and test_elements are converted to arrays if they are not already. If test_elements is a set (or other nonsequence collection) it will be converted to an object array with one element, rather than an array of the values contained in test_elements. This is a consequence of the array constructor’s way of handling nonsequence collections. Converting the set to a list usually gives the desired behavior.
New in version 1.13.0.

isinf
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Test elementwise for positive or negative infinity.
This docstring was copied from
numpy.isinf
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input values
 Returns
y – True where
x
is positive or negative infinity, false otherwise. This is a scalar if x is a scalar. Return type
bool (scalar) or boolean ndarray

isnan
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Test elementwise for NaN and return result as a boolean array.
This docstring was copied from
numpy.isnan
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array.
 Returns
y – True where
x
is NaN, false otherwise. This is a scalar if x is a scalar. Return type
ndarray or bool

isneginf
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Array, Bool, MaskedArray]¶ Test elementwise for negative infinity, return result as bool array.
This docstring was copied from
numpy.isneginf
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – The input array.
out (array_like, optional) – A location into which the result is stored. If provided, it must have a shape that the input broadcasts to. If not provided or None, a freshlyallocated boolean array is returned.
 Returns
out – A boolean array with the same dimensions as the input. If second argument is not supplied then a numpy boolean array is returned with values True where the corresponding element of the input is negative infinity and values False where the element of the input is not negative infinity.
If a second argument is supplied the result is stored there. If the type of that array is a numeric type the result is represented as zeros and ones, if the type is boolean then as False and True. The return value out is then a reference to that array.
 Return type
ndarray
Notes
NumPy uses the IEEE Standard for Binary FloatingPoint for Arithmetic (IEEE 754).
Errors result if the second argument is also supplied when x is a scalar input, if first and second arguments have different shapes, or if the first argument has complex values.

isposinf
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Array, Bool, MaskedArray]¶ Test elementwise for positive infinity, return result as bool array.
This docstring was copied from
numpy.isposinf
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – The input array.
out (array_like, optional) – A location into which the result is stored. If provided, it must have a shape that the input broadcasts to. If not provided or None, a freshlyallocated boolean array is returned.
 Returns
out – A boolean array with the same dimensions as the input. If second argument is not supplied then a boolean array is returned with values True where the corresponding element of the input is positive infinity and values False where the element of the input is not positive infinity.
If a second argument is supplied the result is stored there. If the type of that array is a numeric type the result is represented as zeros and ones, if the type is boolean then as False and True. The return value out is then a reference to that array.
 Return type
ndarray
Notes
NumPy uses the IEEE Standard for Binary FloatingPoint for Arithmetic (IEEE 754).
Errors result if the second argument is also supplied when x is a scalar input, if first and second arguments have different shapes, or if the first argument has complex values

isreal
(x: Union[Array, MaskedArray, Scalar]) → Union[Array, MaskedArray, Scalar]¶ Returns a bool array, where True if input element is real.
This docstring was copied from
numpy.isreal
Some inconsistencies with the Workflows version may exist
If element has complex type with zero complex part, the return value for that element is True.
 Parameters
x (array_like) – Input array.
 Returns
out – Boolean array of same shape as x.
 Return type
ndarray, bool
Notes
isreal may behave unexpectedly for string or object arrays (see examples)

ldexp
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Returns x1 * 2**x2, elementwise.
This docstring was copied from
numpy.ldexp
Some inconsistencies with the Workflows version may exist
 Parameters
x1 (array_like) – Array of multipliers.
x2 (array_like, int) – Array of twos exponents.
 Returns
y – The result of
x1 * 2**x2
. This is a scalar if both x1 and x2 are scalars. Return type
ndarray or scalar

less
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Return the truth value of (x1 < x2) elementwise.
This docstring was copied from
numpy.less
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Input arrays.
 Returns
out – Output array, elementwise comparison of x1 and x2. Typically of type bool, unless
dtype=object
is passed. This is a scalar if both x1 and x2 are scalars. Return type
ndarray or scalar

less_equal
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Return the truth value of (x1 <= x2) elementwise.
This docstring was copied from
numpy.less_equal
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Input arrays.
 Returns
out – Output array, elementwise comparison of x1 and x2. Typically of type bool, unless
dtype=object
is passed. This is a scalar if both x1 and x2 are scalars. Return type
ndarray or scalar

linspace
(start: Union[Int, Float], stop: Union[Int, Float], num: Int = 50, endpoint: Bool = True, dtype: Optional[DType] = None) → Array¶ Return evenly spaced numbers over a specified interval.
This docstring was copied from
numpy.linspace
Some inconsistencies with the Workflows version may exist
Returns num evenly spaced samples, calculated over the interval [start, stop].
The endpoint of the interval can optionally be excluded.
Changed in version 1.16.0: Nonscalar start and stop are now supported.
Changed in version 1.20.0: Values are rounded towards
inf
instead of0
when an integerdtype
is specified. The old behavior can still be obtained withnp.linspace(start, stop, num).astype(int)
 Parameters
start (array_like) – The starting value of the sequence.
stop (array_like) – The end value of the sequence, unless endpoint is set to False. In that case, the sequence consists of all but the last of
num + 1
evenly spaced samples, so that stop is excluded. Note that the step size changes when endpoint is False.num (int, optional) – Number of samples to generate. Default is 50. Must be nonnegative.
endpoint (bool, optional) – If True, stop is the last sample. Otherwise, it is not included. Default is True.
retstep (bool, optional) – If True, return (samples, step), where step is the spacing between samples.
dtype (dtype, optional) –
The type of the output array. If dtype is not given, the data type is inferred from start and stop. The inferred dtype will never be an integer; float is chosen even if the arguments would produce an array of integers.
New in version 1.9.0.
axis (int, optional) –
The axis in the result to store the samples. Relevant only if start or stop are arraylike. By default (0), the samples will be along a new axis inserted at the beginning. Use 1 to get an axis at the end.
New in version 1.16.0.
 Returns
samples (ndarray) – There are num equally spaced samples in the closed interval
[start, stop]
or the halfopen interval[start, stop)
(depending on whether endpoint is True or False).step (float, optional) – Only returned if retstep is True
Size of spacing between samples.

log
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Natural logarithm, elementwise.
This docstring was copied from
numpy.log
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input value.
 Returns
y – The natural logarithm of x, elementwise. This is a scalar if x is a scalar.
 Return type
ndarray

log10
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Return the base 10 logarithm of the input array, elementwise.
This docstring was copied from
numpy.log10
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input values.
 Returns
y – The logarithm to the base 10 of x, elementwise. NaNs are returned where x is negative. This is a scalar if x is a scalar.
 Return type
ndarray

log1p
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Return the natural logarithm of one plus the input array, elementwise.
This docstring was copied from
numpy.log1p
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input values.
 Returns
y – Natural logarithm of 1 + x, elementwise. This is a scalar if x is a scalar.
 Return type
ndarray

log2
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Base2 logarithm of x.
This docstring was copied from
numpy.log2
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input values.
 Returns
y – Base2 logarithm of x. This is a scalar if x is a scalar.
 Return type
ndarray

logaddexp
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Logarithm of the sum of exponentiations of the inputs.
This docstring was copied from
numpy.logaddexp
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Input values.
 Returns
result – Logarithm of
exp(x1) + exp(x2)
. This is a scalar if both x1 and x2 are scalars. Return type
ndarray

logaddexp2
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Logarithm of the sum of exponentiations of the inputs in base2.
This docstring was copied from
numpy.logaddexp2
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Input values.
 Returns
result – Base2 logarithm of
2**x1 + 2**x2
. This is a scalar if both x1 and x2 are scalars. Return type
ndarray

logical_and
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Compute the truth value of x1 AND x2 elementwise.
This docstring was copied from
numpy.logical_and
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Input arrays.
 Returns
y – Boolean result of the logical AND operation applied to the elements of x1 and x2; the shape is determined by broadcasting. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or bool

logical_not
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Compute the truth value of NOT x elementwise.
This docstring was copied from
numpy.logical_not
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Logical NOT is applied to the elements of x.
 Returns
y – Boolean result with the same shape as x of the NOT operation on elements of x. This is a scalar if x is a scalar.
 Return type
bool or ndarray of bool

logical_or
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Compute the truth value of x1 OR x2 elementwise.
This docstring was copied from
numpy.logical_or
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Logical OR is applied to the elements of x1 and x2.
 Returns
y – Boolean result of the logical OR operation applied to the elements of x1 and x2; the shape is determined by broadcasting. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or bool

logical_xor
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Compute the truth value of x1 XOR x2, elementwise.
This docstring was copied from
numpy.logical_xor
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Logical XOR is applied to the elements of x1 and x2.
 Returns
y – Boolean result of the logical XOR operation applied to the elements of x1 and x2; the shape is determined by broadcasting. This is a scalar if both x1 and x2 are scalars.
 Return type
bool or ndarray of bool

max
(a: Union[Array, MaskedArray, Scalar], axis: Union[NoneType, Int, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Return the maximum of an array or maximum along an axis.
This docstring was copied from
numpy.amax
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input data.
axis (None or int or tuple of ints, optional) –
Axis or axes along which to operate. By default, flattened input is used.
New in version 1.7.0.
If this is a tuple of ints, the maximum is selected over multiple axes, instead of a single axis or all the axes as before.
out (ndarray, optional) – Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output. See ufuncsoutputtype for more details.
keepdims (bool, optional) –
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 amax method of subclasses of ndarray, however any nondefault value will be. If the subclass’ method does not implement keepdims any exceptions will be raised.
initial (scalar, optional) –
The minimum value of an output element. Must be present to allow computation on empty slice. See ~numpy.ufunc.reduce for details.
New in version 1.15.0.
where (array_like of bool, optional) –
Elements to compare for the maximum. See ~numpy.ufunc.reduce for details.
New in version 1.17.0.
 Returns
amax (ndarray or scalar) – Maximum of a. If axis is None, the result is a scalar value. If axis is given, the result is an array of dimension
a.ndim  1
.nanmin, minimum, fmin
Notes
NaN values are propagated, that is if at least one item is NaN, the corresponding max value will be NaN as well. To ignore NaN values (MATLAB behavior), please use nanmax.
Don’t use amax for elementwise comparison of 2 arrays; when
a.shape[0]
is 2,maximum(a[0], a[1])
is faster thanamax(a, axis=0)
.

maximum
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Elementwise maximum of array elements.
This docstring was copied from
numpy.maximum
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – The arrays holding the elements to be compared.
 Returns
y – The maximum of x1 and x2, elementwise. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or scalar

mean
(a: Union[Array, MaskedArray, Scalar], axis: Union[NoneType, Int, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Compute the arithmetic mean along the specified axis.
This docstring was copied from
numpy.mean
Some inconsistencies with the Workflows version may exist
Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.
 Parameters
a (array_like) – Array containing numbers whose mean is desired. If a is not an array, a conversion is attempted.
axis (None or int or tuple of ints, optional) –
Axis or axes along which the means are computed. The default is to compute the mean of the flattened array.
New in version 1.7.0.
If this is a tuple of ints, a mean is performed over multiple axes, instead of a single axis or all the axes as before.
dtype (datatype, optional) – Type to use in computing the mean. For integer inputs, the default is float64; for floating point inputs, it is the same as the input dtype.
out (ndarray, optional) – Alternate output array in which to place the result. The default is
None
; if provided, it must have the same shape as the expected output, but the type will be cast if necessary. See ufuncsoutputtype for more details.keepdims (bool, optional) –
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 mean method of subclasses of ndarray, however any nondefault value will be. If the subclass’ method does not implement keepdims any exceptions will be raised.
where (array_like of bool, optional) –
Elements to include in the mean. See ~numpy.ufunc.reduce for details.
New in version 1.20.0.
 Returns
m – If out=None, returns a new array containing the mean values, otherwise a reference to the output array is returned.
 Return type
ndarray, see dtype parameter above
Notes
The arithmetic mean is the sum of the elements along the axis divided by the number of elements.
Note that for floatingpoint input, the mean is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for float32 (see example below). Specifying a higherprecision accumulator using the dtype keyword can alleviate this issue.
By default, float16 results are computed using float32 intermediates for extra precision.

meshgrid
(*xi: Union[Array, MaskedArray, Scalar], indexing: Str = 'xy', sparse: Bool = False) → List[Array]¶ Return coordinate matrices from coordinate vectors.
This docstring was copied from
numpy.meshgrid
Some inconsistencies with the Workflows version may exist
Make ND coordinate arrays for vectorized evaluations of ND scalar/vector fields over ND grids, given onedimensional coordinate arrays x1, x2,…, xn.
Changed in version 1.9: 1D and 0D cases are allowed.
 Parameters
x2,.., xn (x1,) – 1D arrays representing the coordinates of a grid.
indexing ({'xy', 'ij'}, optional) –
Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. See Notes for more details.
New in version 1.7.0.
sparse (bool, optional) –
If True a sparse grid is returned in order to conserve memory. Default is False.
New in version 1.7.0.
copy (bool, optional) –
If False, a view into the original arrays are returned in order to conserve memory. Default is True. Please note that
sparse=False, copy=False
will likely return noncontiguous arrays. Furthermore, more than one element of a broadcast array may refer to a single memory location. If you need to write to the arrays, make copies first.New in version 1.7.0.
 Returns
X1, X2,…, XN – For vectors x1, x2,…, ‘xn’ with lengths
Ni=len(xi)
, return(N1, N2, N3,...Nn)
shaped arrays if indexing=’ij’ or(N2, N1, N3,...Nn)
shaped arrays if indexing=’xy’ with the elements of xi repeated to fill the matrix along the first dimension for x1, the second for x2 and so on. Return type
ndarray
Notes
This function supports both indexing conventions through the indexing keyword argument. Giving the string ‘ij’ returns a meshgrid with matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. In the 2D case with inputs of length M and N, the outputs are of shape (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3D case with inputs of length M, N and P, outputs are of shape (N, M, P) for ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is illustrated by the following code snippet:
xv, yv = np.meshgrid(x, y, sparse=False, indexing='ij') for i in range(nx): for j in range(ny): # treat xv[i,j], yv[i,j] xv, yv = np.meshgrid(x, y, sparse=False, indexing='xy') for i in range(nx): for j in range(ny): # treat xv[j,i], yv[j,i]
In the 1D and 0D case, the indexing and sparse keywords have no effect.

min
(a: Union[Array, MaskedArray, Scalar], axis: Union[NoneType, Int, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Return the minimum of an array or minimum along an axis.
This docstring was copied from
numpy.amin
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input data.
axis (None or int or tuple of ints, optional) –
Axis or axes along which to operate. By default, flattened input is used.
New in version 1.7.0.
If this is a tuple of ints, the minimum is selected over multiple axes, instead of a single axis or all the axes as before.
out (ndarray, optional) – Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output. See ufuncsoutputtype for more details.
keepdims (bool, optional) –
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 amin method of subclasses of ndarray, however any nondefault value will be. If the subclass’ method does not implement keepdims any exceptions will be raised.
initial (scalar, optional) –
The maximum value of an output element. Must be present to allow computation on empty slice. See ~numpy.ufunc.reduce for details.
New in version 1.15.0.
where (array_like of bool, optional) –
Elements to compare for the minimum. See ~numpy.ufunc.reduce for details.
New in version 1.17.0.
 Returns
amin (ndarray or scalar) – Minimum of a. If axis is None, the result is a scalar value. If axis is given, the result is an array of dimension
a.ndim  1
.nanmax, maximum, fmax
Notes
NaN values are propagated, that is if at least one item is NaN, the corresponding min value will be NaN as well. To ignore NaN values (MATLAB behavior), please use nanmin.
Don’t use amin for elementwise comparison of 2 arrays; when
a.shape[0]
is 2,minimum(a[0], a[1])
is faster thanamin(a, axis=0)
.

minimum
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Elementwise minimum of array elements.
This docstring was copied from
numpy.minimum
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – The arrays holding the elements to be compared.
 Returns
y – The minimum of x1 and x2, elementwise. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or scalar

mod
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Return elementwise remainder of division.
This docstring was copied from
numpy.remainder
Some inconsistencies with the Workflows version may exist
 Parameters
x1 (array_like) – Dividend array.
x2 (array_like) – Divisor array.
 Returns
y – The elementwise remainder of the quotient
floor_divide(x1, x2)
. This is a scalar if both x1 and x2 are scalars. Return type
ndarray

moveaxis
(a: Union[Array, MaskedArray], source: Union[Int, List[Int]], destination: Union[Int, List[Int]]) → Union[Array, MaskedArray]¶ Move axes of an array to new positions.
This docstring was copied from
numpy.moveaxis
Some inconsistencies with the Workflows version may exist
Other axes remain in their original order.
New in version 1.11.0.
 Parameters
a (np.ndarray) – The array whose axes should be reordered.
source (int or sequence of int) – Original positions of the axes to move. These must be unique.
destination (int or sequence of int) – Destination positions for each of the original axes. These must also be unique.
 Returns
result – Array with moved axes. This array is a view of the input array.
 Return type
np.ndarray

multiply
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Multiply arguments elementwise.
This docstring was copied from
numpy.multiply
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Input arrays to be multiplied.
 Returns
y – The product of x1 and x2, elementwise. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray

nan_to_num
(x: Union[Array, MaskedArray, Scalar]) → Union[Array, MaskedArray, Scalar]¶ Replace NaN with zero and infinity with large finite numbers (default behaviour) or with the numbers defined by the user using the nan, posinf and/or neginf keywords.
This docstring was copied from
numpy.nan_to_num
Some inconsistencies with the Workflows version may exist
If x is inexact, NaN is replaced by zero or by the user defined value in nan keyword, infinity is replaced by the largest finite floating point values representable by
x.dtype
or by the user defined value in posinf keyword and infinity is replaced by the most negative finite floating point values representable byx.dtype
or by the user defined value in neginf keyword.For complex dtypes, the above is applied to each of the real and imaginary components of x separately.
If x is not inexact, then no replacements are made.
 Parameters
x (scalar or array_like) – Input data.
copy (bool, optional) –
Whether to create a copy of x (True) or to replace values inplace (False). The inplace operation only occurs if casting to an array does not require a copy. Default is True.
New in version 1.13.
nan (int, float, optional) –
Value to be used to fill NaN values. If no value is passed then NaN values will be replaced with 0.0.
New in version 1.17.
posinf (int, float, optional) –
Value to be used to fill positive infinity values. If no value is passed then positive infinity values will be replaced with a very large number.
New in version 1.17.
neginf (int, float, optional) –
Value to be used to fill negative infinity values. If no value is passed then negative infinity values will be replaced with a very small (or negative) number.
New in version 1.17.
 Returns
out – x, with the nonfinite values replaced. If copy is False, this may be x itself.
 Return type
ndarray
Notes
NumPy uses the IEEE Standard for Binary FloatingPoint for Arithmetic (IEEE 754). This means that Not a Number is not equivalent to infinity.

nanargmax
(a: Union[Array, MaskedArray], axis: Optional[Int] = None) → Union[Array, Scalar]¶ Return the indices of the maximum values in the specified axis ignoring NaNs. For allNaN slices
ValueError
is raised. Warning: the results cannot be trusted if a slice contains only NaNs and Infs.This docstring was copied from
numpy.nanargmax
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input data.
axis (int, optional) – Axis along which to operate. By default flattened input is used.
 Returns
index_array – An array of indices or a single index value.
 Return type
ndarray

nanargmin
(a: Union[Array, MaskedArray], axis: Optional[Int] = None) → Union[Array, Scalar]¶ Return the indices of the minimum values in the specified axis ignoring NaNs. For allNaN slices
ValueError
is raised. Warning: the results cannot be trusted if a slice contains only NaNs and Infs.This docstring was copied from
numpy.nanargmin
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input data.
axis (int, optional) – Axis along which to operate. By default flattened input is used.
 Returns
index_array – An array of indices or a single index value.
 Return type
ndarray

nancumprod
(a: Union[Array, MaskedArray, Scalar], axis: Optional[Int] = None, dtype: Optional[DType] = None) → Union[Array, MaskedArray]¶ Return the cumulative product of array elements over a given axis treating Not a Numbers (NaNs) as one. The cumulative product does not change when NaNs are encountered and leading NaNs are replaced by ones.
This docstring was copied from
numpy.nancumprod
Some inconsistencies with the Workflows version may exist
Ones are returned for slices that are allNaN or empty.
New in version 1.12.0.
 Parameters
a (array_like) – Input array.
axis (int, optional) – Axis along which the cumulative product is computed. By default the input is flattened.
dtype (dtype, optional) – Type of the returned array, as well as of the accumulator in which the elements are multiplied. If dtype is not specified, it defaults to the dtype of a, unless a has an integer dtype with a precision less than that of the default platform integer. In that case, the default platform integer is used instead.
out (ndarray, optional) – Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type of the resulting values will be cast if necessary.
 Returns
nancumprod – A new array holding the result is returned unless out is specified, in which case it is returned.
 Return type
ndarray

nancumsum
(a: Union[Array, MaskedArray, Scalar], axis: Optional[Int] = None, dtype: Optional[DType] = None) → Union[Array, MaskedArray]¶ Return the cumulative sum of array elements over a given axis treating Not a Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are encountered and leading NaNs are replaced by zeros.
This docstring was copied from
numpy.nancumsum
Some inconsistencies with the Workflows version may exist
Zeros are returned for slices that are allNaN or empty.
New in version 1.12.0.
 Parameters
a (array_like) – Input array.
axis (int, optional) – Axis along which the cumulative sum is computed. The default (None) is to compute the cumsum over the flattened array.
dtype (dtype, optional) – Type of the returned array and of the accumulator in which the elements are summed. If dtype is not specified, it defaults to the dtype of a, unless a has an integer dtype with a precision less than that of the default platform integer. In that case, the default platform integer is used.
out (ndarray, optional) – Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type will be cast if necessary. See ufuncsoutputtype for more details.
 Returns
nancumsum – A new array holding the result is returned unless out is specified, in which it is returned. The result has the same size as a, and the same shape as a if axis is not None or a is a 1d array.
 Return type
ndarray.

nanmax
(a: Union[Array, MaskedArray, Scalar], axis: Union[NoneType, Int, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Return the maximum of an array or maximum along an axis, ignoring any NaNs. When allNaN slices are encountered a
RuntimeWarning
is raised and NaN is returned for that slice.This docstring was copied from
numpy.nanmax
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Array containing numbers whose maximum is desired. If a is not an array, a conversion is attempted.
axis ({int, tuple of int, None}, optional) – Axis or axes along which the maximum is computed. The default is to compute the maximum of the flattened array.
out (ndarray, optional) –
Alternate output array in which to place the result. The default is
None
; if provided, it must have the same shape as the expected output, but the type will be cast if necessary. See ufuncsoutputtype for more details.New in version 1.8.0.
keepdims (bool, optional) –
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 original a.
If the value is anything but the default, then keepdims will be passed through to the max method of subclasses of ndarray. If the subclasses methods does not implement keepdims any exceptions will be raised.
New in version 1.8.0.
 Returns
nanmax (ndarray) – An array with the same shape as a, with the specified axis removed. If a is a 0d array, or if axis is None, an ndarray scalar is returned. The same dtype as a is returned.
amin, fmin, minimum
Notes
NumPy uses the IEEE Standard for Binary FloatingPoint for Arithmetic (IEEE 754). This means that Not a Number is not equivalent to infinity. Positive infinity is treated as a very large number and negative infinity is treated as a very small (i.e. negative) number.
If the input has a integer type the function is equivalent to np.max.

nanmean
(a: Union[Array, MaskedArray, Scalar], axis: Union[NoneType, Int, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Compute the arithmetic mean along the specified axis, ignoring NaNs.
This docstring was copied from
numpy.nanmean
Some inconsistencies with the Workflows version may exist
Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.
For allNaN slices, NaN is returned and a RuntimeWarning is raised.
New in version 1.8.0.
 Parameters
a (array_like) – Array containing numbers whose mean is desired. If a is not an array, a conversion is attempted.
axis ({int, tuple of int, None}, optional) – Axis or axes along which the means are computed. The default is to compute the mean of the flattened array.
dtype (datatype, optional) – Type to use in computing the mean. For integer inputs, the default is float64; for inexact inputs, it is the same as the input dtype.
out (ndarray, optional) – Alternate output array in which to place the result. The default is
None
; if provided, it must have the same shape as the expected output, but the type will be cast if necessary. See ufuncsoutputtype for more details.keepdims (bool, optional) –
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 original a.
If the value is anything but the default, then keepdims will be passed through to the mean or sum methods of subclasses of ndarray. If the subclasses methods does not implement keepdims any exceptions will be raised.
 Returns
m – If out=None, returns a new array containing the mean values, otherwise a reference to the output array is returned. Nan is returned for slices that contain only NaNs.
 Return type
ndarray, see dtype parameter above
Notes
The arithmetic mean is the sum of the nonNaN elements along the axis divided by the number of nonNaN elements.
Note that for floatingpoint input, the mean is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for float32. Specifying a higherprecision accumulator using the dtype keyword can alleviate this issue.

nanmin
(a: Union[Array, MaskedArray, Scalar], axis: Union[NoneType, Int, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Return minimum of an array or minimum along an axis, ignoring any NaNs. When allNaN slices are encountered a
RuntimeWarning
is raised and Nan is returned for that slice.This docstring was copied from
numpy.nanmin
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Array containing numbers whose minimum is desired. If a is not an array, a conversion is attempted.
axis ({int, tuple of int, None}, optional) – Axis or axes along which the minimum is computed. The default is to compute the minimum of the flattened array.
out (ndarray, optional) –
Alternate output array in which to place the result. The default is
None
; if provided, it must have the same shape as the expected output, but the type will be cast if necessary. See ufuncsoutputtype for more details.New in version 1.8.0.
keepdims (bool, optional) –
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 original a.
If the value is anything but the default, then keepdims will be passed through to the min method of subclasses of ndarray. If the subclasses methods does not implement keepdims any exceptions will be raised.
New in version 1.8.0.
 Returns
nanmin (ndarray) – An array with the same shape as a, with the specified axis removed. If a is a 0d array, or if axis is None, an ndarray scalar is returned. The same dtype as a is returned.
amax, fmax, maximum
Notes
NumPy uses the IEEE Standard for Binary FloatingPoint for Arithmetic (IEEE 754). This means that Not a Number is not equivalent to infinity. Positive infinity is treated as a very large number and negative infinity is treated as a very small (i.e. negative) number.
If the input has a integer type the function is equivalent to np.min.

nanprod
(a: Union[Array, MaskedArray, Scalar], axis: Union[Int, NoneType, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Return the product of array elements over a given axis treating Not a Numbers (NaNs) as ones.
This docstring was copied from
numpy.nanprod
Some inconsistencies with the Workflows version may exist
One is returned for slices that are allNaN or empty.
New in version 1.10.0.
 Parameters
a (array_like) – Array containing numbers whose product is desired. If a is not an array, a conversion is attempted.
axis ({int, tuple of int, None}, optional) – Axis or axes along which the product is computed. The default is to compute the product of the flattened array.
dtype (datatype, optional) – The type of the returned array and of the accumulator in which the elements are summed. By default, the dtype of a is used. An exception is when a has an integer type with less precision than the platform (u)intp. In that case, the default will be either (u)int32 or (u)int64 depending on whether the platform is 32 or 64 bits. For inexact inputs, dtype must be inexact.
out (ndarray, optional) – Alternate output array in which to place the result. The default is
None
. If provided, it must have the same shape as the expected output, but the type will be cast if necessary. See ufuncsoutputtype for more details. The casting of NaN to integer can yield unexpected results.keepdims (bool, optional) – If 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 original arr.
 Returns
nanprod – A new array holding the result is returned unless out is specified, in which case it is returned.
 Return type
ndarray

nanstd
(a: Union[Array, MaskedArray, Scalar], axis: Union[NoneType, Int, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Compute the standard deviation along the specified axis, while ignoring NaNs.
This docstring was copied from
numpy.nanstd
Some inconsistencies with the Workflows version may exist
Returns the standard deviation, a measure of the spread of a distribution, of the nonNaN array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis.
For allNaN slices or slices with zero degrees of freedom, NaN is returned and a RuntimeWarning is raised.
New in version 1.8.0.
 Parameters
a (array_like) – Calculate the standard deviation of the nonNaN values.
axis ({int, tuple of int, None}, optional) – Axis or axes along which the standard deviation is computed. The default is to compute the standard deviation of the flattened array.
dtype (dtype, optional) – Type to use in computing the standard deviation. For arrays of integer type the default is float64, for arrays of float types it is the same as the array type.
out (ndarray, optional) – Alternative output array in which to place the result. It must have the same shape as the expected output but the type (of the calculated values) will be cast if necessary.
ddof (int, optional) – Means Delta Degrees of Freedom. The divisor used in calculations is
N  ddof
, whereN
represents the number of nonNaN elements. By default ddof is zero.keepdims (bool, optional) –
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 original a.
If this value is anything but the default it is passed through asis to the relevant functions of the subclasses. If these functions do not have a keepdims kwarg, a RuntimeError will be raised.
 Returns
standard_deviation – If out is None, return a new array containing the standard deviation, otherwise return a reference to the output array. If ddof is >= the number of nonNaN elements in a slice or the slice contains only NaNs, then the result for that slice is NaN.
 Return type
ndarray, see dtype parameter above.
Notes
The standard deviation is the square root of the average of the squared deviations from the mean:
std = sqrt(mean(abs(x  x.mean())**2))
.The average squared deviation is normally calculated as
x.sum() / N
, whereN = len(x)
. If, however, ddof is specified, the divisorN  ddof
is used instead. In standard statistical practice,ddof=1
provides an unbiased estimator of the variance of the infinite population.ddof=0
provides a maximum likelihood estimate of the variance for normally distributed variables. The standard deviation computed in this function is the square root of the estimated variance, so even withddof=1
, it will not be an unbiased estimate of the standard deviation per se.Note that, for complex numbers, std takes the absolute value before squaring, so that the result is always real and nonnegative.
For floatingpoint input, the std is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for float32 (see example below). Specifying a higheraccuracy accumulator using the dtype keyword can alleviate this issue.

nansum
(a: Union[Array, MaskedArray, Scalar], axis: Union[NoneType, Int, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Return the sum of array elements over a given axis treating Not a Numbers (NaNs) as zero.
This docstring was copied from
numpy.nansum
Some inconsistencies with the Workflows version may exist
In NumPy versions <= 1.9.0 Nan is returned for slices that are allNaN or empty. In later versions zero is returned.
 Parameters
a (array_like) – Array containing numbers whose sum is desired. If a is not an array, a conversion is attempted.
axis ({int, tuple of int, None}, optional) – Axis or axes along which the sum is computed. The default is to compute the sum of the flattened array.
dtype (datatype, optional) –
The type of the returned array and of the accumulator in which the elements are summed. By default, the dtype of a is used. An exception is when a has an integer type with less precision than the platform (u)intp. In that case, the default will be either (u)int32 or (u)int64 depending on whether the platform is 32 or 64 bits. For inexact inputs, dtype must be inexact.
New in version 1.8.0.
out (ndarray, optional) –
Alternate output array in which to place the result. The default is
None
. If provided, it must have the same shape as the expected output, but the type will be cast if necessary. See ufuncsoutputtype for more details. The casting of NaN to integer can yield unexpected results.New in version 1.8.0.
keepdims – 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 original a.
 Returns
nansum – A new array holding the result is returned unless out is specified, in which it is returned. The result has the same size as a, and the same shape as a if axis is not None or a is a 1d array.
 Return type
ndarray.
Notes
If both positive and negative infinity are present, the sum will be Not A Number (NaN).

nanvar
(a: Union[Array, MaskedArray], axis: Union[NoneType, Int, List[Int]] = None, ddof: Int = 0) → Union[Array, Scalar]¶ Compute the variance along the specified axis, while ignoring NaNs.
This docstring was copied from
numpy.nanvar
Some inconsistencies with the Workflows version may exist
Returns the variance of the array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis.
For allNaN slices or slices with zero degrees of freedom, NaN is returned and a RuntimeWarning is raised.
New in version 1.8.0.
 Parameters
a (array_like) – Array containing numbers whose variance is desired. If a is not an array, a conversion is attempted.
axis ({int, tuple of int, None}, optional) – Axis or axes along which the variance is computed. The default is to compute the variance of the flattened array.
dtype (datatype, optional) – Type to use in computing the variance. For arrays of integer type the default is float64; for arrays of float types it is the same as the array type.
out (ndarray, optional) – Alternate output array in which to place the result. It must have the same shape as the expected output, but the type is cast if necessary.
ddof (int, optional) – “Delta Degrees of Freedom”: the divisor used in the calculation is
N  ddof
, whereN
represents the number of nonNaN elements. By default ddof is zero.keepdims (bool, optional) – 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 original a.
 Returns
variance – If out is None, return a new array containing the variance, otherwise return a reference to the output array. If ddof is >= the number of nonNaN elements in a slice or the slice contains only NaNs, then the result for that slice is NaN.
 Return type
ndarray, see dtype parameter above
Notes
The variance is the average of the squared deviations from the mean, i.e.,
var = mean(abs(x  x.mean())**2)
.The mean is normally calculated as
x.sum() / N
, whereN = len(x)
. If, however, ddof is specified, the divisorN  ddof
is used instead. In standard statistical practice,ddof=1
provides an unbiased estimator of the variance of a hypothetical infinite population.ddof=0
provides a maximum likelihood estimate of the variance for normally distributed variables.Note that for complex numbers, the absolute value is taken before squaring, so that the result is always real and nonnegative.
For floatingpoint input, the variance is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for float32 (see example below). Specifying a higheraccuracy accumulator using the
dtype
keyword can alleviate this issue.For this function to work on subclasses of ndarray, they must define sum with the kwarg keepdims

negative
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Numerical negative, elementwise.
This docstring was copied from
numpy.negative
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like or scalar) – Input array.
 Returns
y – Returned array or scalar: y = x. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

nextafter
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Return the next floatingpoint value after x1 towards x2, elementwise.
This docstring was copied from
numpy.nextafter
Some inconsistencies with the Workflows version may exist
 Parameters
x1 (array_like) – Values to find the next representable value of.
x2 (array_like) – The direction where to look for the next representable value of x1.
 Returns
out – The next representable values of x1 in the direction of x2. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or scalar

nonzero
(a: Union[Array, MaskedArray, Scalar]) → List[Array]¶ Return the indices of the elements that are nonzero.
This docstring was copied from
numpy.nonzero
Some inconsistencies with the Workflows version may exist
Returns a tuple of arrays, one for each dimension of a, containing the indices of the nonzero elements in that dimension. The values in a are always tested and returned in rowmajor, Cstyle order.
To group the indices by element, rather than dimension, use argwhere, which returns a row for each nonzero element.
Note
When called on a zerod array or scalar,
nonzero(a)
is treated asnonzero(atleast_1d(a))
.Deprecated since version 1.17.0: Use atleast_1d explicitly if this behavior is deliberate.
 Parameters
a (array_like) – Input array.
 Returns
tuple_of_arrays – Indices of elements that are nonzero.
 Return type
tuple
Notes
While the nonzero values can be obtained with
a[nonzero(a)]
, it is recommended to usex[x.astype(bool)]
orx[x != 0]
instead, which will correctly handle 0d arrays.

not_equal
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Return (x1 != x2) elementwise.
This docstring was copied from
numpy.not_equal
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – Input arrays.
 Returns
out – Output array, elementwise comparison of x1 and x2. Typically of type bool, unless
dtype=object
is passed. This is a scalar if both x1 and x2 are scalars. Return type
ndarray or scalar

ones
(shape: Union[Int, List[Int]], dtype: DType = <descarteslabs.workflows.types.array.dtype.DType object>) → Array¶ Return a new array of given shape and type, filled with ones.
This docstring was copied from
numpy.ones
Some inconsistencies with the Workflows version may exist
 Parameters
shape (int or sequence of ints) – Shape of the new array, e.g.,
(2, 3)
or2
.dtype (datatype, optional) – The desired datatype for the array, e.g., numpy.int8. Default is numpy.float64.
order ({'C', 'F'}, optional, default: C) – Whether to store multidimensional data in rowmajor (Cstyle) or columnmajor (Fortranstyle) order in memory.
like (array_like) –
Reference object to allow the creation of arrays which are not NumPy arrays. If an arraylike passed in as
like
supports the__array_function__
protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.New in version 1.20.0.
 Returns
out – Array of ones with the given shape, dtype, and order.
 Return type
ndarray

ones_like
(a: Union[Array, MaskedArray, Scalar], dtype: Optional[DType] = None) → Array¶ Return an array of ones with the same shape and type as a given array.
This docstring was copied from
numpy.ones_like
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – The shape and datatype of a define these same attributes of the returned array.
dtype (datatype, optional) –
Overrides the data type of the result.
New in version 1.6.0.
order ({'C', 'F', 'A', or 'K'}, optional) –
Overrides the memory layout of the result. ‘C’ means Corder, ‘F’ means Forder, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible.
New in version 1.6.0.
subok (bool, optional.) – If True, then the newly created array will use the subclass type of a, otherwise it will be a baseclass array. Defaults to True.
shape (int or sequence of ints, optional.) –
Overrides the shape of the result. If order=’K’ and the number of dimensions is unchanged, will try to keep order, otherwise, order=’C’ is implied.
New in version 1.17.0.
 Returns
out – Array of ones with the same shape and type as a.
 Return type
ndarray

outer
(a: Union[Array, MaskedArray, Scalar], b: Union[Array, MaskedArray, Scalar]) → Array¶ Compute the outer product of two vectors.
This docstring was copied from
numpy.outer
Some inconsistencies with the Workflows version may exist
Given two vectors,
a = [a0, a1, ..., aM]
andb = [b0, b1, ..., bN]
, the outer product is:[[a0*b0 a0*b1 ... a0*bN ] [a1*b0 . [ ... . [aM*b0 aM*bN ]]
 Parameters
a ((M,) array_like) – First input vector. Input is flattened if not already 1dimensional.
b ((N,) array_like) – Second input vector. Input is flattened if not already 1dimensional.
out ((M, N) ndarray, optional) –
A location where the result is stored
New in version 1.9.0.
 Returns
out –
out[i, j] = a[i] * b[j]
 Return type
(M, N) ndarray
See also
inner()
einsum()
einsum('i,j>ij', a.ravel(), b.ravel())
is the equivalent.ufunc.outer()
A generalization to dimensions other than 1D and other operations.
np.multiply.outer(a.ravel(), b.ravel())
is the equivalent.tensordot()
np.tensordot(a.ravel(), b.ravel(), axes=((), ()))
is the equivalent.

pad
(array: Union[Array, MaskedArray, Scalar], pad_width: Union[Int, List[Int]], mode: Str = 'constant') → Union[Array, MaskedArray]¶ Pad an array.
This docstring was copied from
numpy.pad
Some inconsistencies with the Workflows version may exist
 Parameters
array (array_like of rank N) – The array to pad.
pad_width ({sequence, array_like, int}) – Number of values padded to the edges of each axis. ((before_1, after_1), … (before_N, after_N)) unique pad widths for each axis. ((before, after),) yields same before and after pad for each axis. (pad,) or int is a shortcut for before = after = pad width for all axes.
mode (str or function, optional) –
One of the following string values or a user supplied function.
 ’constant’ (default)
Pads with a constant value.
 ’edge’
Pads with the edge values of array.
 ’linear_ramp’
Pads with the linear ramp between end_value and the array edge value.
 ’maximum’
Pads with the maximum value of all or part of the vector along each axis.
 ’mean’
Pads with the mean value of all or part of the vector along each axis.
 ’median’
Pads with the median value of all or part of the vector along each axis.
 ’minimum’
Pads with the minimum value of all or part of the vector along each axis.
 ’reflect’
Pads with the reflection of the vector mirrored on the first and last values of the vector along each axis.
 ’symmetric’
Pads with the reflection of the vector mirrored along the edge of the array.
 ’wrap’
Pads with the wrap of the vector along the axis. The first values are used to pad the end and the end values are used to pad the beginning.
 ’empty’
Pads with undefined values.
New in version 1.17.
 <function>
Padding function, see Notes.
stat_length (sequence or int, optional) –
Used in ‘maximum’, ‘mean’, ‘median’, and ‘minimum’. Number of values at edge of each axis used to calculate the statistic value.
((before_1, after_1), … (before_N, after_N)) unique statistic lengths for each axis.
((before, after),) yields same before and after statistic lengths for each axis.
(stat_length,) or int is a shortcut for before = after = statistic length for all axes.
Default is
None
, to use the entire axis.constant_values (sequence or scalar, optional) –
Used in ‘constant’. The values to set the padded values for each axis.
((before_1, after_1), ... (before_N, after_N))
unique pad constants for each axis.((before, after),)
yields same before and after constants for each axis.(constant,)
orconstant
is a shortcut forbefore = after = constant
for all axes.Default is 0.
end_values (sequence or scalar, optional) –
Used in ‘linear_ramp’. The values used for the ending value of the linear_ramp and that will form the edge of the padded array.
((before_1, after_1), ... (before_N, after_N))
unique end values for each axis.((before, after),)
yields same before and after end values for each axis.(constant,)
orconstant
is a shortcut forbefore = after = constant
for all axes.Default is 0.
reflect_type ({'even', 'odd'}, optional) – Used in ‘reflect’, and ‘symmetric’. The ‘even’ style is the default with an unaltered reflection around the edge value. For the ‘odd’ style, the extended part of the array is created by subtracting the reflected values from two times the edge value.
 Returns
pad – Padded array of rank equal to array with shape increased according to pad_width.
 Return type
ndarray
Notes
New in version 1.7.0.
For an array with rank greater than 1, some of the padding of later axes is calculated from padding of previous axes. This is easiest to think about with a rank 2 array where the corners of the padded array are calculated by using padded values from the first axis.
The padding function, if used, should modify a rank 1 array inplace. It has the following signature:
padding_func(vector, iaxis_pad_width, iaxis, kwargs)
where
 vectorndarray
A rank 1 array already padded with zeros. Padded values are vector[:iaxis_pad_width[0]] and vector[iaxis_pad_width[1]:].
 iaxis_pad_widthtuple
A 2tuple of ints, iaxis_pad_width[0] represents the number of values padded at the beginning of vector where iaxis_pad_width[1] represents the number of values padded at the end of vector.
 iaxisint
The axis currently being calculated.
 kwargsdict
Any keyword arguments the function requires.

percentile
(a: Union[Array, MaskedArray], q: Union[Array, MaskedArray], interpolation: Str = 'linear') → Array¶ Compute the qth percentile of the data along the specified axis.
This docstring was copied from
numpy.percentile
Some inconsistencies with the Workflows version may exist
Returns the qth percentile(s) of the array elements.
 Parameters
a (array_like) – Input array or object that can be converted to an array.
q (array_like of float) – Percentile or sequence of percentiles to compute, which must be between 0 and 100 inclusive.
axis ({int, tuple of int, None}, optional) –
Axis or axes along which the percentiles are computed. The default is to compute the percentile(s) along a flattened version of the array.
Changed in version 1.9.0: A tuple of axes is supported
out (ndarray, optional) – Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output, but the type (of the output) will be cast if necessary.
overwrite_input (bool, optional) – If True, then allow the input array a to be modified by intermediate calculations, to save memory. In this case, the contents of the input a after this function completes is undefined.
interpolation ({'linear', 'lower', 'higher', 'midpoint', 'nearest'}) –
This optional parameter specifies the interpolation method to use when the desired percentile lies between two data points
i < j
:’linear’:
i + (j  i) * fraction
, wherefraction
is the fractional part of the index surrounded byi
andj
.’lower’:
i
.’higher’:
j
.’nearest’:
i
orj
, whichever is nearest.’midpoint’:
(i + j) / 2
.
New in version 1.9.0.
keepdims (bool, optional) –
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 original array a.
New in version 1.9.0.
 Returns
percentile – If q is a single percentile and axis=None, then the result is a scalar. If multiple percentiles are given, first axis of the result corresponds to the percentiles. The other axes are the axes that remain after the reduction of a. If the input contains integers or floats smaller than
float64
, the output datatype isfloat64
. Otherwise, the output datatype is the same as that of the input. If out is specified, that array is returned instead. Return type
scalar or ndarray
Notes
Given a vector
V
of lengthN
, the qth percentile ofV
is the valueq/100
of the way from the minimum to the maximum in a sorted copy ofV
. The values and distances of the two nearest neighbors as well as the interpolation parameter will determine the percentile if the normalized ranking does not match the location ofq
exactly. This function is the same as the median ifq=50
, the same as the minimum ifq=0
and the same as the maximum ifq=100
.

power
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ First array elements raised to powers from second array, elementwise.
This docstring was copied from
numpy.power
Some inconsistencies with the Workflows version may exist
 Parameters
x1 (array_like) – The bases.
x2 (array_like) – The exponents.
 Returns
y – The bases in x1 raised to the exponents in x2. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray

prod
(a: Union[Array, MaskedArray, Scalar], axis: Union[Int, NoneType, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Return the product of array elements over a given axis.
This docstring was copied from
numpy.prod
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input data.
axis (None or int or tuple of ints, optional) –
Axis or axes along which a product is performed. The default, axis=None, will calculate the product of all the elements in the input array. If axis is negative it counts from the last to the first axis.
New in version 1.7.0.
If axis is a tuple of ints, a product is performed on all of the axes specified in the tuple instead of a single axis or all the axes as before.
dtype (dtype, optional) – The type of the returned array, as well as of the accumulator in which the elements are multiplied. The dtype of a is used by default unless a has an integer dtype of less precision than the default platform integer. In that case, if a is signed then the platform integer is used while if a is unsigned then an unsigned integer of the same precision as the platform integer is used.
out (ndarray, optional) – Alternative output array in which to place the result. It must have the same shape as the expected output, but the type of the output values will be cast if necessary.
keepdims (bool, optional) –
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 prod method of subclasses of ndarray, however any nondefault value will be. If the subclass’ method does not implement keepdims any exceptions will be raised.
initial (scalar, optional) –
The starting value for this product. See ~numpy.ufunc.reduce for details.
New in version 1.15.0.
where (array_like of bool, optional) –
Elements to include in the product. See ~numpy.ufunc.reduce for details.
New in version 1.17.0.
 Returns
product_along_axis – An array shaped as a but with the specified axis removed. Returns a reference to out if specified.
 Return type
ndarray, see dtype parameter above.
Notes
Arithmetic is modular when using integer types, and no error is raised on overflow. That means that, on a 32bit platform:
>>> x = np.array([536870910, 536870910, 536870910, 536870910]) >>> np.prod(x) 16 # may vary
The product of an empty array is the neutral element 1:
>>> np.prod([]) 1.0

ptp
(a: Union[Array, MaskedArray, Scalar], axis: Union[NoneType, Int, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Range of values (maximum  minimum) along an axis.
This docstring was copied from
numpy.ptp
Some inconsistencies with the Workflows version may exist
The name of the function comes from the acronym for ‘peak to peak’.
Warning
ptp preserves the data type of the array. This means the return value for an input of signed integers with n bits (e.g. np.int8, np.int16, etc) is also a signed integer with n bits. In that case, peaktopeak values greater than
2**(n1)1
will be returned as negative values. An example with a workaround is shown below. Parameters
a (array_like) – Input values.
axis (None or int or tuple of ints, optional) –
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.
New in version 1.15.0.
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.
out (array_like) – Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output, but the type of the output values will be cast if necessary.
keepdims (bool, optional) –
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 subclasses of ndarray, however any nondefault value will be. If the subclass’ method does not implement keepdims any exceptions will be raised.
 Returns
ptp – A new array holding the result, unless out was specified, in which case a reference to out is returned.
 Return type
ndarray

rad2deg
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Convert angles from radians to degrees.
This docstring was copied from
numpy.rad2deg
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Angle in radians.
 Returns
y – The corresponding angle in degrees. This is a scalar if x is a scalar.
 Return type
ndarray

radians
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Convert angles from degrees to radians.
This docstring was copied from
numpy.radians
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array in degrees.
 Returns
y – The corresponding radian values. This is a scalar if x is a scalar.
 Return type
ndarray

ravel
(a: Union[Array, MaskedArray, Scalar]) → Union[Array, MaskedArray, Scalar]¶ Return a contiguous flattened array.
This docstring was copied from
numpy.ravel
Some inconsistencies with the Workflows version may exist
A 1D array, containing the elements of the input, is returned. A copy is made only if needed.
As of NumPy 1.10, the returned array will have the same type as the input array. (for example, a masked array will be returned for a masked array input)
 Parameters
a (array_like) – Input array. The elements in a are read in the order specified by order, and packed as a 1D array.
order ({'C','F', 'A', 'K'}, optional) – The elements of a are read using this index order. ‘C’ means to index the elements in rowmajor, Cstyle order, with the last axis index changing fastest, back to the first axis index changing slowest. ‘F’ means to index the elements in columnmajor, Fortranstyle order, with the first index changing fastest, and the last index changing slowest. Note that the ‘C’ and ‘F’ options take no account of the memory layout of the underlying array, and only refer to the order of axis indexing. ‘A’ means to read the elements in Fortranlike index order if a is Fortran contiguous in memory, Clike order otherwise. ‘K’ means to read the elements in the order they occur in memory, except for reversing the data when strides are negative. By default, ‘C’ index order is used.
 Returns
y – y is an array of the same subtype as a, with shape
(a.size,)
. Note that matrices are special cased for backward compatibility, if a is a matrix, then y is a 1D ndarray. Return type
array_like
Notes
In rowmajor, Cstyle order, in two dimensions, the row index varies the slowest, and the column index the quickest. This can be generalized to multiple dimensions, where rowmajor order implies that the index along the first axis varies slowest, and the index along the last quickest. The opposite holds for columnmajor, Fortranstyle index ordering.
When a view is desired in as many cases as possible,
arr.reshape(1)
may be preferable.

real
(val: Union[Array, MaskedArray, Scalar]) → Union[Array, MaskedArray, Scalar]¶ Return the real part of the complex argument.
This docstring was copied from
numpy.real
Some inconsistencies with the Workflows version may exist
 Parameters
val (array_like) – Input array.
 Returns
out – The real component of the complex argument. If val is real, the type of val is used for the output. If val has complex elements, the returned type is float.
 Return type
ndarray or scalar

reciprocal
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Return the reciprocal of the argument, elementwise.
This docstring was copied from
numpy.reciprocal
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array.
 Returns
y – Return array. This is a scalar if x is a scalar.
 Return type
ndarray

remainder
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Return elementwise remainder of division.
This docstring was copied from
numpy.remainder
Some inconsistencies with the Workflows version may exist
 Parameters
x1 (array_like) – Dividend array.
x2 (array_like) – Divisor array.
 Returns
y – The elementwise remainder of the quotient
floor_divide(x1, x2)
. This is a scalar if both x1 and x2 are scalars. Return type
ndarray

repeat
(a: Union[Array, MaskedArray], repeats: Int, axis: Int = None) → Union[Array, MaskedArray]¶ Repeat elements of an array.
This docstring was copied from
numpy.repeat
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input array.
repeats (int or array of ints) – The number of repetitions for each element. repeats is broadcasted to fit the shape of the given axis.
axis (int, optional) – The axis along which to repeat values. By default, use the flattened input array, and return a flat output array.
 Returns
repeated_array – Output array which has the same shape as a, except along the given axis.
 Return type
ndarray

reshape
(a: Union[Array, MaskedArray], newshape: List[Int]) → Union[Array, MaskedArray]¶ Gives a new shape to an array without changing its data.
This docstring was copied from
numpy.reshape
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Array to be reshaped.
newshape (int or tuple of ints) – The new shape should be compatible with the original shape. If an integer, then the result will be a 1D array of that length. One shape dimension can be 1. In this case, the value is inferred from the length of the array and remaining dimensions.
order ({'C', 'F', 'A'}, optional) – Read the elements of a using this index order, and place the elements into the reshaped array using this index order. ‘C’ means to read / write the elements using Clike index order, with the last axis index changing fastest, back to the first axis index changing slowest. ‘F’ means to read / write the elements using Fortranlike index order, with the first index changing fastest, and the last index changing slowest. Note that the ‘C’ and ‘F’ options take no account of the memory layout of the underlying array, and only refer to the order of indexing. ‘A’ means to read / write the elements in Fortranlike index order if a is Fortran contiguous in memory, Clike order otherwise.
 Returns
reshaped_array – This will be a new view object if possible; otherwise, it will be a copy. Note there is no guarantee of the memory layout (C or Fortran contiguous) of the returned array.
 Return type
ndarray
Notes
It is not always possible to change the shape of an array without copying the data. If you want an error to be raised when the data is copied, you should assign the new shape to the shape attribute of the array:
>>> a = np.zeros((10, 2)) # A transpose makes the array noncontiguous >>> b = a.T # Taking a view makes it possible to modify the shape without modifying # the initial object. >>> c = b.view() >>> c.shape = (20) Traceback (most recent call last): ... AttributeError: Incompatible shape for inplace modification. Use `.reshape()` to make a copy with the desired shape.
The order keyword gives the index ordering both for fetching the values from a, and then placing the values into the output array. For example, let’s say you have an array:
>>> a = np.arange(6).reshape((3, 2)) >>> a array([[0, 1], [2, 3], [4, 5]])
You can think of reshaping as first raveling the array (using the given index order), then inserting the elements from the raveled array into the new array using the same kind of index ordering as was used for the raveling.
>>> np.reshape(a, (2, 3)) # Clike index ordering array([[0, 1, 2], [3, 4, 5]]) >>> np.reshape(np.ravel(a), (2, 3)) # equivalent to C ravel then C reshape array([[0, 1, 2], [3, 4, 5]]) >>> np.reshape(a, (2, 3), order='F') # Fortranlike index ordering array([[0, 4, 3], [2, 1, 5]]) >>> np.reshape(np.ravel(a, order='F'), (2, 3), order='F') array([[0, 4, 3], [2, 1, 5]])

rint
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Round elements of the array to the nearest integer.
This docstring was copied from
numpy.rint
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array.
 Returns
out – Output array is same shape and type as x. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

roll
(a: Union[Array, MaskedArray, Scalar], shift: Union[Int, List[Int]], axis: Union[Int, NoneType, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Roll array elements along a given axis.
This docstring was copied from
numpy.roll
Some inconsistencies with the Workflows version may exist
Elements that roll beyond the last position are reintroduced at the first.
 Parameters
a (array_like) – Input array.
shift (int or tuple of ints) – The number of places by which elements are shifted. If a tuple, then axis must be a tuple of the same size, and each of the given axes is shifted by the corresponding number. If an int while axis is a tuple of ints, then the same value is used for all given axes.
axis (int or tuple of ints, optional) – Axis or axes along which elements are shifted. By default, the array is flattened before shifting, after which the original shape is restored.
 Returns
res – Output array, with the same shape as a.
 Return type
ndarray
Notes
New in version 1.12.0.
Supports rolling over multiple dimensions simultaneously.

rollaxis
(a: Union[Array, MaskedArray], axis: Int, start: Int = 0) → Union[Array, MaskedArray]¶ Roll the specified axis backwards, until it lies in a given position.
This docstring was copied from
numpy.rollaxis
Some inconsistencies with the Workflows version may exist
This function continues to be supported for backward compatibility, but you should prefer moveaxis. The moveaxis function was added in NumPy 1.11.
 Parameters
a (ndarray) – Input array.
axis (int) – The axis to be rolled. The positions of the other axes do not change relative to one another.
start (int, optional) –
When
start <= axis
, the axis is rolled back until it lies in this position. Whenstart > axis
, the axis is rolled until it lies before this position. The default, 0, results in a “complete” roll. The following table describes how negative values ofstart
are interpreted:start
Normalized
start
(arr.ndim+1)
raise
AxisError
arr.ndim
0
⋮
⋮
1
arr.ndim1
0
0
⋮
⋮
arr.ndim
arr.ndim
arr.ndim + 1
raise
AxisError
 Returns
res – For NumPy >= 1.10.0 a view of a is always returned. For earlier NumPy versions a view of a is returned only if the order of the axes is changed, otherwise the input array is returned.
 Return type
ndarray

round
(a: Union[Array, MaskedArray, Scalar], decimals: Int = 0) → Union[Array, MaskedArray, Scalar]¶ Round an array to the given number of decimals.
This docstring was copied from
numpy.round_
Some inconsistencies with the Workflows version may exist

sign
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Returns an elementwise indication of the sign of a number.
This docstring was copied from
numpy.sign
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input values.
 Returns
y – The sign of x. This is a scalar if x is a scalar.
 Return type
ndarray

signbit
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Bool¶ Returns elementwise True where signbit is set (less than zero).
This docstring was copied from
numpy.signbit
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – The input value(s).
 Returns
result – Output array, or reference to out if that was supplied. This is a scalar if x is a scalar.
 Return type
ndarray of bool

sin
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Trigonometric sine, elementwise.
This docstring was copied from
numpy.sin
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Angle, in radians (\(2 \pi\) rad equals 360 degrees).
 Returns
y – The sine of each element of x. This is a scalar if x is a scalar.
 Return type
array_like

sinh
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Hyperbolic sine, elementwise.
This docstring was copied from
numpy.sinh
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array.
 Returns
y – The corresponding hyperbolic sine values. This is a scalar if x is a scalar.
 Return type
ndarray

spacing
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Return the distance between x and the nearest adjacent number.
This docstring was copied from
numpy.spacing
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Values to find the spacing of.
 Returns
out – The spacing of values of x. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

sqrt
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Return the nonnegative squareroot of an array, elementwise.
This docstring was copied from
numpy.sqrt
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – The values whose squareroots are required.
 Returns
y – An array of the same shape as x, containing the positive squareroot of each element in x. If any element in x is complex, a complex array is returned (and the squareroots of negative reals are calculated). If all of the elements in x are real, so is y, with negative elements returning
nan
. If out was provided, y is a reference to it. This is a scalar if x is a scalar. Return type
ndarray

square
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Return the elementwise square of the input.
This docstring was copied from
numpy.square
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input data.
 Returns
out – Elementwise x*x, of the same shape and dtype as x. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

squeeze
(a: Union[Array, MaskedArray, Scalar], axis: Union[Int, NoneType, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Remove axes of length one from a.
This docstring was copied from
numpy.squeeze
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Input data.
axis (None or int or tuple of ints, optional) –
New in version 1.7.0.
Selects a subset of the entries of length one in the shape. If an axis is selected with shape entry greater than one, an error is raised.
 Returns
squeezed – The input array, but with all or a subset of the dimensions of length 1 removed. This is always a itself or a view into a. Note that if all axes are squeezed, the result is a 0d array and not a scalar.
 Return type
ndarray

stack
(arrays: Union[List[MaskedArray], List[Array]], axis: Int = 0) → Union[Array, MaskedArray]¶ Join a sequence of arrays along a new axis.
This docstring was copied from
numpy.stack
Some inconsistencies with the Workflows version may exist
The
axis
parameter specifies the index of the new axis in the dimensions of the result. For example, ifaxis=0
it will be the first dimension and ifaxis=1
it will be the last dimension.New in version 1.10.0.
 Parameters
arrays (sequence of array_like) – Each array must have the same shape.
axis (int, optional) – The axis in the result array along which the input arrays are stacked.
out (ndarray, optional) – If provided, the destination to place the result. The shape must be correct, matching that of what stack would have returned if no out argument were specified.
 Returns
stacked – The stacked array has one more dimension than the input arrays.
 Return type
ndarray

std
(a: Union[Array, MaskedArray, Scalar], axis: Union[NoneType, Int, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Compute the standard deviation along the specified axis.
This docstring was copied from
numpy.std
Some inconsistencies with the Workflows version may exist
Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis.
 Parameters
a (array_like) – Calculate the standard deviation of these values.
axis (None or int or tuple of ints, optional) –
Axis or axes along which the standard deviation is computed. The default is to compute the standard deviation of the flattened array.
New in version 1.7.0.
If this is a tuple of ints, a standard deviation is performed over multiple axes, instead of a single axis or all the axes as before.
dtype (dtype, optional) – Type to use in computing the standard deviation. For arrays of integer type the default is float64, for arrays of float types it is the same as the array type.
out (ndarray, optional) – Alternative output array in which to place the result. It must have the same shape as the expected output but the type (of the calculated values) will be cast if necessary.
ddof (int, optional) – Means Delta Degrees of Freedom. The divisor used in calculations is
N  ddof
, whereN
represents the number of elements. By default ddof is zero.keepdims (bool, optional) –
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 std method of subclasses of ndarray, however any nondefault value will be. If the subclass’ method does not implement keepdims any exceptions will be raised.
where (array_like of bool, optional) –
Elements to include in the standard deviation. See ~numpy.ufunc.reduce for details.
New in version 1.20.0.
 Returns
standard_deviation – If out is None, return a new array containing the standard deviation, otherwise return a reference to the output array.
 Return type
ndarray, see dtype parameter above.
Notes
The standard deviation is the square root of the average of the squared deviations from the mean, i.e.,
std = sqrt(mean(x))
, wherex = abs(a  a.mean())**2
.The average squared deviation is typically calculated as
x.sum() / N
, whereN = len(x)
. If, however, ddof is specified, the divisorN  ddof
is used instead. In standard statistical practice,ddof=1
provides an unbiased estimator of the variance of the infinite population.ddof=0
provides a maximum likelihood estimate of the variance for normally distributed variables. The standard deviation computed in this function is the square root of the estimated variance, so even withddof=1
, it will not be an unbiased estimate of the standard deviation per se.Note that, for complex numbers, std takes the absolute value before squaring, so that the result is always real and nonnegative.
For floatingpoint input, the std is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for float32 (see example below). Specifying a higheraccuracy accumulator using the dtype keyword can alleviate this issue.

subtract
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Subtract arguments, elementwise.
This docstring was copied from
numpy.subtract
Some inconsistencies with the Workflows version may exist
 Parameters
x2 (x1,) – The arrays to be subtracted from each other.
 Returns
y – The difference of x1 and x2, elementwise. This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray

sum
(a: Union[Array, MaskedArray, Scalar], axis: Union[NoneType, Int, List[Int]] = None) → Union[Array, MaskedArray, Scalar]¶ Sum of array elements over a given axis.
This docstring was copied from
numpy.sum
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Elements to sum.
axis (None or int or tuple of ints, optional) –
Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.
New in version 1.7.0.
If axis is a tuple of ints, a sum is performed on all of the axes specified in the tuple instead of a single axis or all the axes as before.
dtype (dtype, optional) – The type of the returned array and of the accumulator in which the elements are summed. The dtype of a is used by default unless a has an integer dtype of less precision than the default platform integer. In that case, if a is signed then the platform integer is used while if a is unsigned then an unsigned integer of the same precision as the platform integer is used.
out (ndarray, optional) – Alternative output array in which to place the result. It must have the same shape as the expected output, but the type of the output values will be cast if necessary.
keepdims (bool, optional) –
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 sum method of subclasses of ndarray, however any nondefault value will be. If the subclass’ method does not implement keepdims any exceptions will be raised.
initial (scalar, optional) –
Starting value for the sum. See ~numpy.ufunc.reduce for details.
New in version 1.15.0.
where (array_like of bool, optional) –
Elements to include in the sum. See ~numpy.ufunc.reduce for details.
New in version 1.17.0.
 Returns
sum_along_axis (ndarray) – An array with the same shape as a, with the specified axis removed. If a is a 0d array, or if axis is None, a scalar is returned. If an output array is specified, a reference to out is returned.
add.reduce (Equivalent functionality of add.)
cumsum (Cumulative sum of array elements.)
trapz (Integration of array values using the composite trapezoidal rule.)
mean, average
Notes
Arithmetic is modular when using integer types, and no error is raised on overflow.
The sum of an empty array is the neutral element 0:
>>> np.sum([]) 0.0
For floating point numbers the numerical precision of sum (and
np.add.reduce
) is in general limited by directly adding each number individually to the result causing rounding errors in every step. However, often numpy will use a numerically better approach (partial pairwise summation) leading to improved precision in many usecases. This improved precision is always provided when noaxis
is given. Whenaxis
is given, it will depend on which axis is summed. Technically, to provide the best speed possible, the improved precision is only used when the summation is along the fast axis in memory. Note that the exact precision may vary depending on other parameters. In contrast to NumPy, Python’smath.fsum
function uses a slower but more precise approach to summation. Especially when summing a large number of lower precision floating point numbers, such asfloat32
, numerical errors can become significant. In such cases it can be advisable to use dtype=”float64” to use a higher precision for the output.

take
(a: Union[Array, MaskedArray], indices: Union[Array, Int, List[Int]], axis: Int = None) → Union[Array, MaskedArray]¶ Take elements from an array along an axis.
This docstring was copied from
numpy.take
Some inconsistencies with the Workflows version may exist
When axis is not None, this function does the same thing as “fancy” indexing (indexing arrays using arrays); however, it can be easier to use if you need elements along a given axis. A call such as
np.take(arr, indices, axis=3)
is equivalent toarr[:,:,:,indices,...]
.Explained without fancy indexing, this is equivalent to the following use of ndindex, which sets each of
ii
,jj
, andkk
to a tuple of indices:Ni, Nk = a.shape[:axis], a.shape[axis+1:] Nj = indices.shape for ii in ndindex(Ni): for jj in ndindex(Nj): for kk in ndindex(Nk): out[ii + jj + kk] = a[ii + (indices[jj],) + kk]
 Parameters
a (array_like (Ni..., M, Nk...)) – The source array.
indices (array_like (Nj...)) –
The indices of the values to extract.
New in version 1.8.0.
Also allow scalars for indices.
axis (int, optional) – The axis over which to select values. By default, the flattened input array is used.
out (ndarray, optional (Ni..., Nj..., Nk...)) – If provided, the result will be placed in this array. It should be of the appropriate shape and dtype. Note that out is always buffered if mode=’raise’; use other modes for better performance.
mode ({'raise', 'wrap', 'clip'}, optional) –
Specifies how outofbounds indices will behave.
’raise’ – raise an error (default)
’wrap’ – wrap around
’clip’ – clip to the range
’clip’ mode means that all indices that are too large are replaced by the index that addresses the last element along that axis. Note that this disables indexing with negative numbers.
 Returns
out – The returned array has the same type as a.
 Return type
ndarray (Ni…, Nj…, Nk…)
Notes
By eliminating the inner loop in the description above, and using s_ to build simple slice objects, take can be expressed in terms of applying fancy indexing to each 1d slice:
Ni, Nk = a.shape[:axis], a.shape[axis+1:] for ii in ndindex(Ni): for kk in ndindex(Nj): out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices]
For this reason, it is equivalent to (but faster than) the following use of apply_along_axis:
out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a)

tan
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Compute tangent elementwise.
This docstring was copied from
numpy.tan
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array.
 Returns
y – The corresponding tangent values. This is a scalar if x is a scalar.
 Return type
ndarray

tanh
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Compute hyperbolic tangent elementwise.
This docstring was copied from
numpy.tanh
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input array.
 Returns
y – The corresponding hyperbolic tangent values. This is a scalar if x is a scalar.
 Return type
ndarray

tensordot
(a: Union[Array, MaskedArray], b: Union[Array, MaskedArray], axes: Int = 2) → Union[Array, MaskedArray]¶ Compute tensor dot product along specified axes.
This docstring was copied from
numpy.tensordot
Some inconsistencies with the Workflows version may exist
Given two tensors, a and b, and an array_like object containing two array_like objects,
(a_axes, b_axes)
, sum the products of a’s and b’s elements (components) over the axes specified bya_axes
andb_axes
. The third argument can be a single nonnegative integer_like scalar,N
; if it is such, then the lastN
dimensions of a and the firstN
dimensions of b are summed over. Parameters
b (a,) – Tensors to “dot”.
axes (int or (2,) array_like) –
integer_like If an int N, sum over the last N axes of a and the first N axes of b in order. The sizes of the corresponding axes must match.
(2,) array_like Or, a list of axes to be summed over, first sequence applying to a, second to b. Both elements array_like must be of the same length.
 Returns
output – The tensor dot product of the input.
 Return type
ndarray
Notes
 Three common use cases are:
axes = 0
: tensor product \(a\otimes b\)axes = 1
: tensor dot product \(a\cdot b\)axes = 2
: (default) tensor double contraction \(a:b\)
When axes is integer_like, the sequence for evaluation will be: first the Nth axis in a and 0th axis in b, and the 1th axis in a and Nth axis in b last.
When there is more than one axis to sum over  and they are not the last (first) axes of a (b)  the argument axes should consist of two sequences of the same length, with the first axis to sum over given first in both sequences, the second axis second, and so forth.
The shape of the result consists of the noncontracted axes of the first tensor, followed by the noncontracted axes of the second.

tile
(A: Union[Array, MaskedArray], reps: Union[Array, Int, MaskedArray, List[Int]]) → Union[Array, MaskedArray]¶ Construct an array by repeating A the number of times given by reps.
This docstring was copied from
numpy.tile
Some inconsistencies with the Workflows version may exist
If reps has length
d
, the result will have dimension ofmax(d, A.ndim)
.If
A.ndim < d
, A is promoted to be ddimensional by prepending new axes. So a shape (3,) array is promoted to (1, 3) for 2D replication, or shape (1, 1, 3) for 3D replication. If this is not the desired behavior, promote A to ddimensions manually before calling this function.If
A.ndim > d
, reps is promoted to A.ndim by prepending 1’s to it. Thus for an A of shape (2, 3, 4, 5), a reps of (2, 2) is treated as (1, 1, 2, 2).Note : Although tile may be used for broadcasting, it is strongly recommended to use numpy’s broadcasting operations and functions.
 Parameters
A (array_like) – The input array.
reps (array_like) – The number of repetitions of A along each axis.
 Returns
c – The tiled output array.
 Return type
ndarray

trace
(a: Union[Array, MaskedArray], offset: Int = 0, axis1: Int = 0, axis2: Int = 1) → Union[Array, MaskedArray]¶ Return the sum along diagonals of the array.
This docstring was copied from
numpy.trace
Some inconsistencies with the Workflows version may exist
If a is 2D, the sum along its diagonal with the given offset is returned, i.e., the sum of elements
a[i,i+offset]
for all i.If a has more than two dimensions, then the axes specified by axis1 and axis2 are used to determine the 2D subarrays whose traces are returned. The shape of the resulting array is the same as that of a with axis1 and axis2 removed.
 Parameters
a (array_like) – Input array, from which the diagonals are taken.
offset (int, optional) – Offset of the diagonal from the main diagonal. Can be both positive and negative. Defaults to 0.
axis2 (axis1,) – Axes to be used as the first and second axis of the 2D subarrays from which the diagonals should be taken. Defaults are the first two axes of a.
dtype (dtype, optional) – Determines the datatype of the returned array and of the accumulator where the elements are summed. If dtype has the value None and a is of integer type of precision less than the default integer precision, then the default integer precision is used. Otherwise, the precision is the same as that of a.
out (ndarray, optional) – Array into which the output is placed. Its type is preserved and it must be of the right shape to hold the output.
 Returns
sum_along_diagonals – If a is 2D, the sum along the diagonal is returned. If a has larger dimensions, then an array of sums along diagonals is returned.
 Return type
ndarray

transpose
(a: Union[Array, MaskedArray], axes: Optional[List[Int]] = None) → Union[Array, MaskedArray]¶ Reverse or permute the axes of an array; returns the modified array.
This docstring was copied from
numpy.transpose
Some inconsistencies with the Workflows version may exist
For an array a with two axes, transpose(a) gives the matrix transpose.
Refer to numpy.ndarray.transpose for full documentation.
 Parameters
a (array_like) – Input array.
axes (tuple or list of ints, optional) – If specified, it must be a tuple or list which contains a permutation of [0,1,..,N1] where N is the number of axes of a. The i’th axis of the returned array will correspond to the axis numbered
axes[i]
of the input. If not specified, defaults torange(a.ndim)[::1]
, which reverses the order of the axes.
 Returns
p – a with its axes permuted. A view is returned whenever possible.
 Return type
ndarray
Notes
Use transpose(a, argsort(axes)) to invert the transposition of tensors when using the axes keyword argument.
Transposing a 1D array returns an unchanged view of the original array.

tril
(m: Union[Array, MaskedArray], k: Int = 0) → Union[Array, MaskedArray]¶ Lower triangle of an array.
This docstring was copied from
numpy.tril
Some inconsistencies with the Workflows version may exist
Return a copy of an array with elements above the kth diagonal zeroed.
 Parameters
m (array_like, shape (M, N)) – Input array.
k (int, optional) – Diagonal above which to zero elements. k = 0 (the default) is the main diagonal, k < 0 is below it and k > 0 is above.
 Returns
tril – Lower triangle of m, of same shape and datatype as m.
 Return type
ndarray, shape (M, N)

triu
(m: Union[Array, MaskedArray], k: Int = 0) → Union[Array, MaskedArray]¶ Upper triangle of an array.
This docstring was copied from
numpy.triu
Some inconsistencies with the Workflows version may exist
Return a copy of an array with the elements below the kth diagonal zeroed.
Please refer to the documentation for tril for further details.

true_divide
(x1: Union[Int, Bool, MaskedArray, Array, Scalar, Float], x2: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Float¶ Returns a true division of the inputs, elementwise.
This docstring was copied from
numpy.true_divide
Some inconsistencies with the Workflows version may exist
 Parameters
x1 (array_like) – Dividend array.
x2 (array_like) – Divisor array.
 Returns
out – This is a scalar if both x1 and x2 are scalars.
 Return type
ndarray or scalar

trunc
(x: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → Union[Int, Bool, MaskedArray, Array, Scalar, Float]¶ Return the truncated value of the input, elementwise.
This docstring was copied from
numpy.trunc
Some inconsistencies with the Workflows version may exist
 Parameters
x (array_like) – Input data.
 Returns
y – The truncated value of each element in x. This is a scalar if x is a scalar.
 Return type
ndarray or scalar

unique
(ar: Union[Array, MaskedArray]) → Array¶ Find the unique elements of an array.
This docstring was copied from
numpy.unique
Some inconsistencies with the Workflows version may exist
Returns the sorted unique elements of an array. There are three optional outputs in addition to the unique elements:
the indices of the input array that give the unique values
the indices of the unique array that reconstruct the input array
the number of times each unique value comes up in the input array
 Parameters
ar (array_like) – Input array. Unless axis is specified, this will be flattened if it is not already 1D.
return_index (bool, optional) – If True, also return the indices of ar (along the specified axis, if provided, or in the flattened array) that result in the unique array.
return_inverse (bool, optional) – If True, also return the indices of the unique array (for the specified axis, if provided) that can be used to reconstruct ar.
return_counts (bool, optional) –
If True, also return the number of times each unique item appears in ar.
New in version 1.9.0.
axis (int or None, optional) –
The axis to operate on. If None, ar will be flattened. If an integer, the subarrays indexed by the given axis will be flattened and treated as the elements of a 1D array with the dimension of the given axis, see the notes for more details. Object arrays or structured arrays that contain objects are not supported if the axis kwarg is used. The default is None.
New in version 1.13.0.
 Returns
unique (ndarray) – The sorted unique values.
unique_indices (ndarray, optional) – The indices of the first occurrences of the unique values in the original array. Only provided if return_index is True.
unique_inverse (ndarray, optional) – The indices to reconstruct the original array from the unique array. Only provided if return_inverse is True.
unique_counts (ndarray, optional) – The number of times each of the unique values comes up in the original array. Only provided if return_counts is True.
New in version 1.9.0.
Notes
When an axis is specified the subarrays indexed by the axis are sorted. This is done by making the specified axis the first dimension of the array (move the axis to the first dimension to keep the order of the other axes) and then flattening the subarrays in C order. The flattened subarrays are then viewed as a structured type with each element given a label, with the effect that we end up with a 1D array of structured types that can be treated in the same way as any other 1D array. The result is that the flattened subarrays are sorted in lexicographic order starting with the first element.

unravel_index
(indices: Union[Array, MaskedArray, Scalar], shape: List[Int]) → Union[List[Scalar], List[Array]]¶ Converts a flat index or array of flat indices into a tuple of coordinate arrays.
This docstring was copied from
numpy.unravel_index
Some inconsistencies with the Workflows version may exist
 Parameters
indices (array_like) – An integer array whose elements are indices into the flattened version of an array of dimensions
shape
. Before version 1.6.0, this function accepted just one index value.shape (tuple of ints) –
The shape of the array to use for unraveling
indices
.Changed in version 1.16.0: Renamed from
dims
toshape
.order ({'C', 'F'}, optional) –
Determines whether the indices should be viewed as indexing in rowmajor (Cstyle) or columnmajor (Fortranstyle) order.
New in version 1.6.0.
 Returns
unraveled_coords – Each array in the tuple has the same shape as the
indices
array. Return type
tuple of ndarray

var
(a: Union[Array, MaskedArray], axis: Union[NoneType, Int, List[Int]] = None, ddof: Int = 0) → Union[Array, Scalar]¶ Compute the variance along the specified axis.
This docstring was copied from
numpy.var
Some inconsistencies with the Workflows version may exist
Returns the variance of the array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis.
 Parameters
a (array_like) – Array containing numbers whose variance is desired. If a is not an array, a conversion is attempted.
axis (None or int or tuple of ints, optional) –
Axis or axes along which the variance is computed. The default is to compute the variance of the flattened array.
New in version 1.7.0.
If this is a tuple of ints, a variance is performed over multiple axes, instead of a single axis or all the axes as before.
dtype (datatype, optional) – Type to use in computing the variance. For arrays of integer type the default is float64; for arrays of float types it is the same as the array type.
out (ndarray, optional) – Alternate output array in which to place the result. It must have the same shape as the expected output, but the type is cast if necessary.
ddof (int, optional) – “Delta Degrees of Freedom”: the divisor used in the calculation is
N  ddof
, whereN
represents the number of elements. By default ddof is zero.keepdims (bool, optional) –
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 var method of subclasses of ndarray, however any nondefault value will be. If the subclass’ method does not implement keepdims any exceptions will be raised.
where (array_like of bool, optional) –
Elements to include in the variance. See ~numpy.ufunc.reduce for details.
New in version 1.20.0.
 Returns
variance – If
out=None
, returns a new array containing the variance; otherwise, a reference to the output array is returned. Return type
ndarray, see dtype parameter above
Notes
The variance is the average of the squared deviations from the mean, i.e.,
var = mean(x)
, wherex = abs(a  a.mean())**2
.The mean is typically calculated as
x.sum() / N
, whereN = len(x)
. If, however, ddof is specified, the divisorN  ddof
is used instead. In standard statistical practice,ddof=1
provides an unbiased estimator of the variance of a hypothetical infinite population.ddof=0
provides a maximum likelihood estimate of the variance for normally distributed variables.Note that for complex numbers, the absolute value is taken before squaring, so that the result is always real and nonnegative.
For floatingpoint input, the variance is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for float32 (see example below). Specifying a higheraccuracy accumulator using the
dtype
keyword can alleviate this issue.

vdot
(a: Union[Array, MaskedArray, Scalar], b: Union[Array, MaskedArray, Scalar]) → Array¶ Return the dot product of two vectors.
This docstring was copied from
numpy.vdot
Some inconsistencies with the Workflows version may exist
The vdot(a, b) function handles complex numbers differently than dot(a, b). If the first argument is complex the complex conjugate of the first argument is used for the calculation of the dot product.
Note that vdot handles multidimensional arrays differently than dot: it does not perform a matrix product, but flattens input arguments to 1D vectors first. Consequently, it should only be used for vectors.
 Parameters
a (array_like) – If a is complex the complex conjugate is taken before calculation of the dot product.
b (array_like) – Second argument to the dot product.
 Returns
output – Dot product of a and b. Can be an int, float, or complex depending on the types of a and b.
 Return type
ndarray

vstack
(arrays: Union[List[MaskedArray], List[Array]]) → Union[Array, MaskedArray]¶ Stack arrays in sequence vertically (row wise).
This docstring was copied from
numpy.vstack
Some inconsistencies with the Workflows version may exist
This is equivalent to concatenation along the first axis after 1D arrays of shape (N,) have been reshaped to (1,N). Rebuilds arrays divided by vsplit.
This function makes most sense for arrays with up to 3 dimensions. For instance, for pixeldata with a height (first axis), width (second axis), and r/g/b channels (third axis). The functions concatenate, stack and block provide more general stacking and concatenation operations.
 Parameters
tup (sequence of ndarrays) – The arrays must have the same shape along all but the first axis. 1D arrays must have the same length.
 Returns
stacked – The array formed by stacking the given arrays, will be at least 2D.
 Return type
ndarray

where
(condition: Array, x: Union[Array, MaskedArray, Scalar], y: Union[Array, MaskedArray, Scalar]) → Array¶ Return elements chosen from x or y depending on condition.
This docstring was copied from
numpy.where
Some inconsistencies with the Workflows version may exist
Note
When only condition is provided, this function is a shorthand for
np.asarray(condition).nonzero()
. Using nonzero directly should be preferred, as it behaves correctly for subclasses. The rest of this documentation covers only the case where all three arguments are provided. Parameters
condition (array_like, bool) – Where True, yield x, otherwise yield y.
y (x,) – Values from which to choose. x, y and condition need to be broadcastable to some shape.
 Returns
out – An array with elements from x where condition is True, and elements from y elsewhere.
 Return type
ndarray
Notes
If all the arrays are 1D, where is equivalent to:
[xv if c else yv for c, xv, yv in zip(condition, x, y)]

zeros
(shape: Union[Int, List[Int]], dtype: DType = <descarteslabs.workflows.types.array.dtype.DType object>) → Array¶ Return a new array of given shape and type, filled with zeros.
This docstring was copied from
numpy.zeros
Some inconsistencies with the Workflows version may exist
 Parameters
shape (int or tuple of ints) – Shape of the new array, e.g.,
(2, 3)
or2
.dtype (datatype, optional) – The desired datatype for the array, e.g., numpy.int8. Default is numpy.float64.
order ({'C', 'F'}, optional, default: 'C') – Whether to store multidimensional data in rowmajor (Cstyle) or columnmajor (Fortranstyle) order in memory.
like (array_like) –
Reference object to allow the creation of arrays which are not NumPy arrays. If an arraylike passed in as
like
supports the__array_function__
protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.New in version 1.20.0.
 Returns
out – Array of zeros with the given shape, dtype, and order.
 Return type
ndarray

zeros_like
(a: Union[Array, MaskedArray, Scalar]) → Union[Array, Scalar]¶ Return an array of zeros with the same shape and type as a given array.
This docstring was copied from
numpy.zeros_like
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – The shape and datatype of a define these same attributes of the returned array.
dtype (datatype, optional) –
Overrides the data type of the result.
New in version 1.6.0.
order ({'C', 'F', 'A', or 'K'}, optional) –
Overrides the memory layout of the result. ‘C’ means Corder, ‘F’ means Forder, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible.
New in version 1.6.0.
subok (bool, optional.) – If True, then the newly created array will use the subclass type of a, otherwise it will be a baseclass array. Defaults to True.
shape (int or sequence of ints, optional.) –
Overrides the shape of the result. If order=’K’ and the number of dimensions is unchanged, will try to keep order, otherwise, order=’C’ is implied.
New in version 1.17.0.
 Returns
out – Array of zeros with the same shape and type as a.
 Return type
ndarray

cholesky
(a: Array) → Array¶ Cholesky decomposition.
This docstring was copied from
numpy.cholesky
Some inconsistencies with the Workflows version may exist
Return the Cholesky decomposition, L * L.H, of the square matrix a, where L is lowertriangular and .H is the conjugate transpose operator (which is the ordinary transpose if a is realvalued). a must be Hermitian (symmetric if realvalued) and positivedefinite. No checking is performed to verify whether a is Hermitian or not. In addition, only the lowertriangular and diagonal elements of a are used. Only L is actually returned.
 Parameters
a ((.., M, M) array_like) – Hermitian (symmetric if all elements are real), positivedefinite input matrix.
 Returns
L – Upper or lowertriangular Cholesky factor of a. Returns a matrix object if a is a matrix object.
 Return type
(.., M, M) array_like
Notes
New in version 1.8.0.
Broadcasting rules apply, see the numpy.linalg documentation for details.
The Cholesky decomposition is often used as a fast way of solving
\[A \mathbf{x} = \mathbf{b}\](when A is both Hermitian/symmetric and positivedefinite).
First, we solve for \(\mathbf{y}\) in
\[L \mathbf{y} = \mathbf{b},\]and then for \(\mathbf{x}\) in
\[L.H \mathbf{x} = \mathbf{y}.\]

inv
(a: Array) → Array¶ Compute the (multiplicative) inverse of a matrix.
This docstring was copied from
numpy.inv
Some inconsistencies with the Workflows version may exist
Given a square matrix a, return the matrix ainv satisfying
dot(a, ainv) = dot(ainv, a) = eye(a.shape[0])
. Parameters
a ((.., M, M) array_like) – Matrix to be inverted.
 Returns
ainv – (Multiplicative) inverse of the matrix a.
 Return type
(.., M, M) ndarray or matrix
Notes
New in version 1.8.0.
Broadcasting rules apply, see the numpy.linalg documentation for details.

lstsq
(a: Array, b: Array) → Tuple[Array, Array, Array, Array]¶ Return the leastsquares solution to a linear matrix equation.
This docstring was copied from
numpy.lstsq
Some inconsistencies with the Workflows version may exist
Computes the vector x that approximatively solves the equation
a @ x = b
. The equation may be under, well, or overdetermined (i.e., the number of linearly independent rows of a can be less than, equal to, or greater than its number of linearly independent columns). If a is square and of full rank, then x (but for roundoff error) is the “exact” solution of the equation. Else, x minimizes the Euclidean 2norm \(b  ax\). If there are multiple minimizing solutions, the one with the smallest 2norm \(x\) is returned. Parameters
a ((M, N) array_like) – “Coefficient” matrix.
b ({(M,), (M, K)} array_like) – Ordinate or “dependent variable” values. If b is twodimensional, the leastsquares solution is calculated for each of the K columns of b.
rcond (float, optional) –
Cutoff ratio for small singular values of a. For the purposes of rank determination, singular values are treated as zero if they are smaller than rcond times the largest singular value of a.
Changed in version 1.14.0: If not set, a FutureWarning is given. The previous default of
1
will use the machine precision as rcond parameter, the new default will use the machine precision times max(M, N). To silence the warning and use the new default, usercond=None
, to keep using the old behavior, usercond=1
.
 Returns
x ({(N,), (N, K)} ndarray) – Leastsquares solution. If b is twodimensional, the solutions are in the K columns of x.
residuals ({(1,), (K,), (0,)} ndarray) – Sums of squared residuals: Squared Euclidean 2norm for each column in
b  a @ x
. If the rank of a is < N or M <= N, this is an empty array. If b is 1dimensional, this is a (1,) shape array. Otherwise the shape is (K,).rank (int) – Rank of matrix a.
s ((min(M, N),) ndarray) – Singular values of a.
Notes
If b is a matrix, then all array results are returned as matrices.

norm
(x: Array, ord: Optional[Int] = None, axis: Optional[Int] = None) → Union[Array, Scalar]¶ Matrix or vector norm.
This docstring was copied from
numpy.norm
Some inconsistencies with the Workflows version may exist
This function is able to return one of eight different matrix norms, or one of an infinite number of vector norms (described below), depending on the value of the
ord
parameter. Parameters
x (array_like) – Input array. If axis is None, x must be 1D or 2D, unless ord is None. If both axis and ord are None, the 2norm of
x.ravel
will be returned.ord ({nonzero int, inf, inf, 'fro', 'nuc'}, optional) – Order of the norm (see table under
Notes
). inf means numpy’s inf object. The default is None.axis ({None, int, 2tuple of ints}, optional.) –
If axis is an integer, it specifies the axis of x along which to compute the vector norms. If axis is a 2tuple, it specifies the axes that hold 2D matrices, and the matrix norms of these matrices are computed. If axis is None then either a vector norm (when x is 1D) or a matrix norm (when x is 2D) is returned. The default is None.
New in version 1.8.0.
keepdims (bool, optional) –
If this is set to True, the axes which are normed over are left in the result as dimensions with size one. With this option the result will broadcast correctly against the original x.
New in version 1.10.0.
 Returns
n – Norm of the matrix or vector(s).
 Return type
float or ndarray
Notes
For values of
ord < 1
, the result is, strictly speaking, not a mathematical ‘norm’, but it may still be useful for various numerical purposes.The following norms can be calculated:
ord
norm for matrices
norm for vectors
None
Frobenius norm
2norm
‘fro’
Frobenius norm
–
‘nuc’
nuclear norm
–
inf
max(sum(abs(x), axis=1))
max(abs(x))
inf
min(sum(abs(x), axis=1))
min(abs(x))
0
–
sum(x != 0)
1
max(sum(abs(x), axis=0))
as below
1
min(sum(abs(x), axis=0))
as below
2
2norm (largest sing. value)
as below
2
smallest singular value
as below
other
–
sum(abs(x)**ord)**(1./ord)
The Frobenius norm is given by :
\(A_F = [\sum_{i,j} abs(a_{i,j})^2]^{1/2}\)
The nuclear norm is the sum of the singular values.
Both the Frobenius and nuclear norm orders are only defined for matrices and raise a ValueError when
x.ndim != 2
.

qr
(a: Array, mode: Str = 'reduced') → Tuple[Array, Array]¶ Compute the qr factorization of a matrix.
This docstring was copied from
numpy.qr
Some inconsistencies with the Workflows version may exist
Factor the matrix a as qr, where q is orthonormal and r is uppertriangular.
 Parameters
a (array_like, shape (M, N)) – Matrix to be factored.
mode ({'reduced', 'complete', 'r', 'raw'}, optional) –
If K = min(M, N), then
’reduced’ : returns q, r with dimensions (M, K), (K, N) (default)
’complete’ : returns q, r with dimensions (M, M), (M, N)
’r’ : returns r only with dimensions (K, N)
’raw’ : returns h, tau with dimensions (N, M), (K,)
The options ‘reduced’, ‘complete, and ‘raw’ are new in numpy 1.8, see the notes for more information. The default is ‘reduced’, and to maintain backward compatibility with earlier versions of numpy both it and the old default ‘full’ can be omitted. Note that array h returned in ‘raw’ mode is transposed for calling Fortran. The ‘economic’ mode is deprecated. The modes ‘full’ and ‘economic’ may be passed using only the first letter for backwards compatibility, but all others must be spelled out. See the Notes for more explanation.
 Returns
q (ndarray of float or complex, optional) – A matrix with orthonormal columns. When mode = ‘complete’ the result is an orthogonal/unitary matrix depending on whether or not a is real/complex. The determinant may be either +/ 1 in that case.
r (ndarray of float or complex, optional) – The uppertriangular matrix.
(h, tau) (ndarrays of np.double or np.cdouble, optional) – The array h contains the Householder reflectors that generate q along with r. The tau array contains scaling factors for the reflectors. In the deprecated ‘economic’ mode only h is returned.
Notes
This is an interface to the LAPACK routines
dgeqrf
,zgeqrf
,dorgqr
, andzungqr
.For more information on the qr factorization, see for example: https://en.wikipedia.org/wiki/QR_factorization
Subclasses of ndarray are preserved except for the ‘raw’ mode. So if a is of type matrix, all the return values will be matrices too.
New ‘reduced’, ‘complete’, and ‘raw’ options for mode were added in NumPy 1.8.0 and the old option ‘full’ was made an alias of ‘reduced’. In addition the options ‘full’ and ‘economic’ were deprecated. Because ‘full’ was the previous default and ‘reduced’ is the new default, backward compatibility can be maintained by letting mode default. The ‘raw’ option was added so that LAPACK routines that can multiply arrays by q using the Householder reflectors can be used. Note that in this case the returned arrays are of type np.double or np.cdouble and the h array is transposed to be FORTRAN compatible. No routines using the ‘raw’ return are currently exposed by numpy, but some are available in lapack_lite and just await the necessary work.

solve
(a: Array, b: Array) → Array¶ Solve a linear matrix equation, or system of linear scalar equations.
This docstring was copied from
numpy.solve
Some inconsistencies with the Workflows version may exist
Computes the “exact” solution, x, of the welldetermined, i.e., full rank, linear matrix equation ax = b.
 Parameters
a ((.., M, M) array_like) – Coefficient matrix.
b ({(.., M,), (.., M, K)}, array_like) – Ordinate or “dependent variable” values.
 Returns
x – Solution to the system a x = b. Returned shape is identical to b.
 Return type
{(.., M,), (.., M, K)} ndarray
Notes
New in version 1.8.0.
Broadcasting rules apply, see the numpy.linalg documentation for details.
The solutions are computed using LAPACK routine
_gesv
.a must be square and of fullrank, i.e., all rows (or, equivalently, columns) must be linearly independent; if either is not true, use lstsq for the leastsquares best “solution” of the system/equation.

svd
(a: Array) → Tuple[Array, Array, Array]¶ Singular Value Decomposition.
This docstring was copied from
numpy.svd
Some inconsistencies with the Workflows version may exist
When a is a 2D array, it is factorized as
u @ np.diag(s) @ vh = (u * s) @ vh
, where u and vh are 2D unitary arrays and s is a 1D array of a’s singular values. When a is higherdimensional, SVD is applied in stacked mode as explained below. Parameters
a ((.., M, N) array_like) – A real or complex array with
a.ndim >= 2
.full_matrices (bool, optional) – If True (default), u and vh have the shapes
(..., M, M)
and(..., N, N)
, respectively. Otherwise, the shapes are(..., M, K)
and(..., K, N)
, respectively, whereK = min(M, N)
.compute_uv (bool, optional) – Whether or not to compute u and vh in addition to s. True by default.
hermitian (bool, optional) –
If True, a is assumed to be Hermitian (symmetric if realvalued), enabling a more efficient method for finding singular values. Defaults to False.
New in version 1.17.0.
 Returns
u ({ (…, M, M), (…, M, K) } array) – Unitary array(s). The first
a.ndim  2
dimensions have the same size as those of the input a. The size of the last two dimensions depends on the value of full_matrices. Only returned when compute_uv is True.s ((…, K) array) – Vector(s) with the singular values, within each vector sorted in descending order. The first
a.ndim  2
dimensions have the same size as those of the input a.vh ({ (…, N, N), (…, K, N) } array) – Unitary array(s). The first
a.ndim  2
dimensions have the same size as those of the input a. The size of the last two dimensions depends on the value of full_matrices. Only returned when compute_uv is True.
Notes
Changed in version 1.8.0: Broadcasting rules apply, see the numpy.linalg documentation for details.
The decomposition is performed using LAPACK routine
_gesdd
.SVD is usually described for the factorization of a 2D matrix \(A\). The higherdimensional case will be discussed below. In the 2D case, SVD is written as \(A = U S V^H\), where \(A = a\), \(U= u\), \(S= \mathtt{np.diag}(s)\) and \(V^H = vh\). The 1D array s contains the singular values of a and u and vh are unitary. The rows of vh are the eigenvectors of \(A^H A\) and the columns of u are the eigenvectors of \(A A^H\). In both cases the corresponding (possibly nonzero) eigenvalues are given by
s**2
.If a has more than two dimensions, then broadcasting rules apply, as explained in Linear algebra on several matrices at once.. This means that SVD is working in “stacked” mode: it iterates over all indices of the first
a.ndim  2
dimensions and for each combination SVD is applied to the last two indices. The matrix a can be reconstructed from the decomposition with either(u * s[..., None, :]) @ vh
oru @ (s[..., None] * vh)
. (The@
operator can be replaced by the functionnp.matmul
for python versions below 3.5.)If a is a
matrix
object (as opposed to anndarray
), then so are all the return values.

average
(a: MaskedArray, axis: Union[NoneType, Int, List[Int]] = None, weights: Union[Array, MaskedArray, Scalar] = None) → Union[MaskedArray, Scalar]¶ Return the weighted average of array over the given axis.
This docstring was copied from
numpy.average
Some inconsistencies with the Workflows version may exist
 Parameters
a (array_like) – Data to be averaged. Masked entries are not taken into account in the computation.
axis (int, optional) – Axis along which to average a. If None, averaging is done over the flattened array.
weights (array_like, optional) –
The importance that each element has in the computation of the average. The weights array can either be 1D (in which case its length must be the size of a along the given axis) or of the same shape as a. If
weights=None
, then all data in a are assumed to have a weight equal to one. The 1D calculation is:avg = sum(a * weights) / sum(weights)
The only constraint on weights is that sum(weights) must not be 0.
returned (bool, optional) – Flag indicating whether a tuple
(result, sum of weights)
should be returned as output (True), or just the result (False). Default is False.
 Returns
average, [sum_of_weights] – The average along the specified axis. When returned is True, return a tuple with the average as the first element and the sum of the weights as the second element. The return type is np.float64 if a is of integer type and floats smaller than float64, or the input datatype, otherwise. If returned, sum_of_weights is always float64.
 Return type
(tuple of) scalar or MaskedArray

filled
(a: MaskedArray, fill_value: Union[Int, Bool, MaskedArray, Array, Scalar, NoneType, Float] = None) → Array¶ Return input as an array with masked data replaced by a fill value.
This docstring was copied from
numpy.filled
Some inconsistencies with the Workflows version may exist
If a is not a MaskedArray, a itself is returned. If a is a MaskedArray and fill_value is None, fill_value is set to
a.fill_value
. Parameters
a (MaskedArray or array_like) – An input object.
fill_value (array_like, optional.) – Can be scalar or nonscalar. If nonscalar, the resulting filled array should be broadcastable over input array. Default is None.
 Returns
a – The filled array.
 Return type
ndarray

fix_invalid
(a: Union[Array, MaskedArray], fill_value: Union[Int, Bool, MaskedArray, Array, Scalar, Float]) → MaskedArray¶ Return input with invalid data masked and replaced by a fill value.
This docstring was copied from
numpy.fix_invalid
Some inconsistencies with the Workflows version may exist
Invalid data means values of nan, inf, etc.
 Parameters
a (array_like) – Input array, a (subclass of) ndarray.
mask (sequence, optional) – Mask. Must be convertible to an array of booleans with the same shape as data. True indicates a masked (i.e. invalid) data.
copy (bool, optional) – Whether to use a copy of a (True) or to fix a in place (False). Default is True.
fill_value (scalar, optional) – Value used for fixing invalid data. Default is None, in which case the
a.fill_value
is used.
 Returns
b – The input array with invalid entries fixed.
 Return type
Notes
A copy is performed by default.

masked_array
(data, mask=False, fill_value=None)¶ Proxy MaskedArray representing a multidimensional, homogenous array of fixedsize items that may have missing or invalid entries. MaskedArray follows the same syntax as NumPy masked arrays. It supports vectorized operations, broadcasting, and multidimensional indexing. There are some limitations including slicing with lists/arrays in multiple axes (
x[[1, 2, 3], [3, 2, 1]]
) and slicing with a multidimensional list/array of integers.Note
MaskedArray is an experimental API. It may be changed in the future, will not necessarily be backwards compatible, and may have unexpected bugs. Please contact us with any feedback!
Examples
>>> import descarteslabs.workflows as wf >>> arr = wf.MaskedArray(data=[1, 2, 3, 4], mask=[True, False, False, True], fill_value=0) >>> arr <descarteslabs.workflows.types.array.masked_array.MaskedArray object at 0x...> >>> arr.compute(geoctx) masked_array(data=[, 2, 3, ], mask=[ True, False, False, True], fill_value=0)

masked_equal
(x: Union[Array, MaskedArray], value: Union[Bool, Int, Float, Scalar]) → MaskedArray¶ Mask an array where equal to a given value.
This docstring was copied from
numpy.masked_equal
Some inconsistencies with the Workflows version may exist
This function is a shortcut to
masked_where
, with condition = (x == value). For floating point arrays, consider usingmasked_values(x, value)
.

masked_greater
(x: Union[Array, MaskedArray], value: Union[Bool, Int, Float, Scalar]) → MaskedArray¶ Mask an array where greater than a given value.
This docstring was copied from
numpy.masked_greater
Some inconsistencies with the Workflows version may exist
This function is a shortcut to
masked_where
, with condition = (x > value).

masked_greater_equal
(x: Union[Array, MaskedArray], value: Union[Bool, Int, Float, Scalar]) → MaskedArray¶ Mask an array where greater than or equal to a given value.
This docstring was copied from
numpy.masked_greater_equal
Some inconsistencies with the Workflows version may exist
This function is a shortcut to
masked_where
, with condition = (x >= value).

masked_inside
(x: Union[Array, MaskedArray], v1: Union[Bool, Int, Float, Scalar], v2: Union[Bool, Int, Float, Scalar]) → MaskedArray¶ Mask an array inside a given interval.
This docstring was copied from
numpy.masked_inside
Some inconsistencies with the Workflows version may exist
Shortcut to
masked_where
, where condition is True for x inside the interval [v1,v2] (v1 <= x <= v2). The boundaries v1 and v2 can be given in either order.Notes
The array x is prefilled with its filling value.

masked_invalid
(a: Union[Array, MaskedArray]) → MaskedArray¶ Mask an array where invalid values occur (NaNs or infs).
This docstring was copied from
numpy.masked_invalid
Some inconsistencies with the Workflows version may exist
This function is a shortcut to
masked_where
, with condition = ~(np.isfinite(a)). Any preexisting mask is conserved. Only applies to arrays with a dtype where NaNs or infs make sense (i.e. floating point types), but accepts any array_like object.

masked_less
(x: Union[Array, MaskedArray], value: Union[Bool, Int, Float, Scalar]) → MaskedArray¶ Mask an array where less than a given value.
This docstring was copied from
numpy.masked_less
Some inconsistencies with the Workflows version may exist
This function is a shortcut to
masked_where
, with condition = (x < value).

masked_less_equal
(x: Union[Array, MaskedArray], value: Union[Bool, Int, Float, Scalar]) → MaskedArray¶ Mask an array where less than or equal to a given value.
This docstring was copied from
numpy.masked_less_equal
Some inconsistencies with the Workflows version may exist
This function is a shortcut to
masked_where
, with condition = (x <= value).

masked_not_equal
(x: Union[Array, MaskedArray], value: Union[Bool, Int, Float, Scalar]) → MaskedArray¶ Mask an array where not equal to a given value.
This docstring was copied from
numpy.masked_not_equal
Some inconsistencies with the Workflows version may exist
This function is a shortcut to
masked_where
, with condition = (x != value).

masked_outside
(x: Union[Array, MaskedArray], v1: Union[Bool, Int, Float, Scalar], v2: Union[Bool, Int, Float, Scalar]) → MaskedArray¶ Mask an array outside a given interval.
This docstring was copied from
numpy.masked_outside
Some inconsistencies with the Workflows version may exist
Shortcut to
masked_where
, where condition is True for x outside the interval [v1,v2] (x < v1)(x > v2). The boundaries v1 and v2 can be given in either order.Notes
The array x is prefilled with its filling value.

masked_values
(x: Union[Array, MaskedArray], value: Union[Bool, Int, Float, Scalar], rtol: Union[Int, Float] = 1e05, atol: Union[Int, Float] = 1e08, shrink: Bool = True) → MaskedArray¶ Mask using floating point equality.
This docstring was copied from
numpy.masked_values
Some inconsistencies with the Workflows version may exist
Return a MaskedArray, masked where the data in array x are approximately equal to value, determined using isclose. The default tolerances for masked_values are the same as those for isclose.
For integer types, exact equality is used, in the same way as masked_equal.
The fill_value is set to value and the mask is set to
nomask
if possible. Parameters
x (array_like) – Array to mask.
value (float) – Masking value.
atol (rtol,) – Tolerance parameters passed on to isclose
copy (bool, optional) – Whether to return a copy of x.
shrink (bool, optional) – Whether to collapse a mask full of False to
nomask
.
 Returns
result – The result of masking x where approximately equal to value.
 Return type

masked_where
(condition: Union[Int, Bool, MaskedArray, Array, Scalar, Float], a: Union[Array, MaskedArray]) → MaskedArray¶ Mask an array where a condition is met.
This docstring was copied from
numpy.masked_where
Some inconsistencies with the Workflows version may exist
Return a as an array masked where condition is True. Any masked values of a or condition are also masked in the output.
 Parameters
condition (array_like) – Masking condition. When condition tests floating point values for equality, consider using
masked_values
instead.a (array_like) – Array to mask.
copy (bool) – If True (default) make a copy of a in the result. If False modify a in place and return a view.
 Returns
result – The result of masking a where condition is True.
 Return type