vtkmodules.numpy_interface.numpy_algorithms#
This internal module provides a number of algorithms designed to be compatible with and used by numpy. In particular, some algorithms required to be adapted to handle VTKCompositeDataArray. Note that the decorated functions (by _override_numpy) are not meant to be called directly from here but directly through the Numpy API.
Module Contents#
Functions#
Apply a function to each member of a VTKCompositeDataArray. Returns a list of arrays. |
|
Apply a function to each member of a VTKCompositeDataArray. VTKArray and numpy arrays are also supported. |
|
Given a ufunc, creates a closure that applies it to each member of a VTKCompositeDataArray. |
|
Apply a two argument function to each member of a VTKCompositeDataArray and another argument The second argument can be a VTKCompositeDataArray, in which case a one-to-one match between arrays is assumed. Otherwise, the function is applied to the composite array with the second argument repeated. VTKArray and numpy arrays are also supported. |
|
Given a function that requires two arguments, creates a closure that applies it to each member of a VTKCompositeDataArray. |
|
Given a function that requires two arguments (one array, one dataset), creates a closure that applies it to each member of a VTKCompositeDataArray. Note that this function is mainly for internal use by this module. |
|
Given a function that requires a dataset, creates a closure that applies it to each member of a VTKCompositeDataArray. |
|
Implements element by element or (bitwise, | in C/C++) operation. If one of the arrays is a NoneArray, this will return the array that is not NoneArray, treating NoneArray as 0 in the or operation. |
|
Returns the sum of all values along a particular axis (dimension). Given an array of m tuples and n components: |
|
Returns the max of all values along a particular axis (dimension). Given an array of m tuples and n components: |
|
Returns the min of all values along a particular axis (dimension). Given an array of m tuples and n components: |
|
Returns True if all values of an array evaluate to True, returns False otherwise. This is useful to check if all values of an array match a certain condition such as: |
|
Returns the mean of all values along a particular axis (dimension). Given an array of m tuples and n components: |
|
Returns the variance of all values along a particular axis (dimension). Given an array of m tuples and n components: |
|
Returns the standard deviation of all values along a particular axis (dimension). Given an array of m tuples and n components: |
|
Returns the shape (dimensions) of an array. |
|
Return indices that are non-zero in the flattened version of the input array. |
|
Helper to construct like-structured VTKCompositeDataArray. |
|
Create a new VTKCompositeDataArray filled with 0 of the same shape as array. |
|
Create a new VTKCompositeDataArray filled with 1 of the same shape as array. |
|
Create a new uninitialized VTKCompositeDataArray of the same shape as array. |
Data#
API#
- vtkmodules.numpy_interface.numpy_algorithms._apply_func2(func, array, args)#
Apply a function to each member of a VTKCompositeDataArray. Returns a list of arrays.
Note that this function is mainly for internal use by this module.
- vtkmodules.numpy_interface.numpy_algorithms.apply_ufunc(func, array, args=())#
Apply a function to each member of a VTKCompositeDataArray. VTKArray and numpy arrays are also supported.
- vtkmodules.numpy_interface.numpy_algorithms._make_ufunc(ufunc)#
Given a ufunc, creates a closure that applies it to each member of a VTKCompositeDataArray.
Note that this function is mainly for internal use by this module.
- vtkmodules.numpy_interface.numpy_algorithms.apply_dfunc(dfunc, array1, val2)#
Apply a two argument function to each member of a VTKCompositeDataArray and another argument The second argument can be a VTKCompositeDataArray, in which case a one-to-one match between arrays is assumed. Otherwise, the function is applied to the composite array with the second argument repeated. VTKArray and numpy arrays are also supported.
- vtkmodules.numpy_interface.numpy_algorithms._make_dfunc(dfunc)#
Given a function that requires two arguments, creates a closure that applies it to each member of a VTKCompositeDataArray.
Note that this function is mainly for internal use by this module.
- vtkmodules.numpy_interface.numpy_algorithms._make_dsfunc(dsfunc)#
Given a function that requires two arguments (one array, one dataset), creates a closure that applies it to each member of a VTKCompositeDataArray. Note that this function is mainly for internal use by this module.
- vtkmodules.numpy_interface.numpy_algorithms._make_dsfunc2(dsfunc)#
Given a function that requires a dataset, creates a closure that applies it to each member of a VTKCompositeDataArray.
Note that this function is mainly for internal use by this module.
- vtkmodules.numpy_interface.numpy_algorithms.bitwise_or(array1, array2)#
Implements element by element or (bitwise, | in C/C++) operation. If one of the arrays is a NoneArray, this will return the array that is not NoneArray, treating NoneArray as 0 in the or operation.
- vtkmodules.numpy_interface.numpy_algorithms.sum(array, axis=None, controller=None)#
Returns the sum of all values along a particular axis (dimension). Given an array of m tuples and n components:
Default is to return the sum of all values in an array.
axis=0: Sum values of all components and return a one tuple, n-component array.
axis=1: Sum values of all components of each tuple and return an m-tuple, 1-component array.
When called in parallel, this function will sum across processes when a controller argument is passed or the global controller is defined. To disable parallel summing when running in parallel, pass a dummy controller as follows:
sum(array, controller=vtkmodules.vtkParallelCore.vtkDummyController()).
- vtkmodules.numpy_interface.numpy_algorithms.max(array, axis=None, controller=None)#
Returns the max of all values along a particular axis (dimension). Given an array of m tuples and n components:
Default is to return the max of all values in an array.
axis=0: Return the max values of all tuples and return a one tuple, n-component array.
axis=1: Return the max values of all components of each tuple and return an m-tuple, 1-component array.
When called in parallel, this function will compute the max across processes when a controller argument is passed or the global controller is defined. To disable parallel summing when running in parallel, pass a dummy controller as follows:
max(array, controller=vtkmodules.vtkParallelCore.vtkDummyController()).
- vtkmodules.numpy_interface.numpy_algorithms.min(array, axis=None, controller=None)#
Returns the min of all values along a particular axis (dimension). Given an array of m tuples and n components:
Default is to return the min of all values in an array.
axis=0: Return the min values of all tuples and return a one tuple, n-component array.
axis=1: Return the min values of all components of each tuple and return an m-tuple, 1-component array.
When called in parallel, this function will compute the min across processes when a controller argument is passed or the global controller is defined. To disable parallel summing when running in parallel, pass a dummy controller as follows:
min(array, controller=vtkmodules.vtkParallelCore.vtkDummyController()).
- vtkmodules.numpy_interface.numpy_algorithms.all(array, axis=None, controller=None)#
Returns True if all values of an array evaluate to True, returns False otherwise. This is useful to check if all values of an array match a certain condition such as:
algorithms.all(array > 5)
- vtkmodules.numpy_interface.numpy_algorithms.mean(array, axis=None, controller=None, size=None)#
Returns the mean of all values along a particular axis (dimension). Given an array of m tuples and n components:
Default is to return the mean of all values in an array.
axis=0: Return the mean values of all components and return a one tuple, n-component array.
axis=1: Return the mean values of all components of each tuple and return an m-tuple, 1-component array.
When called in parallel, this function will compute the mean across processes when a controller argument is passed or the global controller is defined. To disable parallel summing when running in parallel, pass a dummy controller as follows:
mean(array, controller=vtkmodules.vtkParallelCore.vtkDummyController()).
- vtkmodules.numpy_interface.numpy_algorithms.var(array, axis=None, controller=None)#
Returns the variance of all values along a particular axis (dimension). Given an array of m tuples and n components:
Default is to return the variance of all values in an array.
axis=0: Return the variance values of all components and return a one tuple, n-component array.
axis=1: Return the variance values of all components of each tuple and return an m-tuple, 1-component array.
When called in parallel, this function will compute the variance across processes when a controller argument is passed or the global controller is defined. To disable parallel summing when running in parallel, pass a dummy controller as follows:
var(array, controller=vtkmodules.vtkParallelCore.vtkDummyController()).
- vtkmodules.numpy_interface.numpy_algorithms.std(array, axis=None, controller=None)#
Returns the standard deviation of all values along a particular axis (dimension). Given an array of m tuples and n components:
Default is to return the standard deviation of all values in an array.
axis=0: Return the standard deviation values of all components and return a one tuple, n-component array.
axis=1: Return the standard deviation values of all components of each tuple and return an m-tuple, 1-component array.
When called in parallel, this function will compute the standard deviation across processes when a controller argument is passed or the global controller is defined. To disable parallel summing when running in parallel, pass a dummy controller as follows:
std(array, controller=vtkmodules.vtkParallelCore.vtkDummyController()).
- vtkmodules.numpy_interface.numpy_algorithms.shape(array)#
Returns the shape (dimensions) of an array.
- vtkmodules.numpy_interface.numpy_algorithms.flatnonzero(array)#
Return indices that are non-zero in the flattened version of the input array.
- vtkmodules.numpy_interface.numpy_algorithms._like_VTKCompositeDataArray(array: vtkmodules.numpy_interface.dataset_adapter.VTKCompositeDataArray, kind: str, dtype: Optional[numpy.dtype] = None, value: Optional[int] = None)#
Helper to construct like-structured VTKCompositeDataArray.
- vtkmodules.numpy_interface.numpy_algorithms.zeros_like(array: vtkmodules.numpy_interface.dataset_adapter.VTKCompositeDataArray, dtype: Optional[numpy.dtype] = None) vtkmodules.numpy_interface.dataset_adapter.VTKCompositeDataArray#
Create a new VTKCompositeDataArray filled with 0 of the same shape as array.
- vtkmodules.numpy_interface.numpy_algorithms.ones_like(array: vtkmodules.numpy_interface.dataset_adapter.VTKCompositeDataArray, dtype: Optional[numpy.dtype] = None) vtkmodules.numpy_interface.dataset_adapter.VTKCompositeDataArray#
Create a new VTKCompositeDataArray filled with 1 of the same shape as array.
- vtkmodules.numpy_interface.numpy_algorithms.empty_like(array: vtkmodules.numpy_interface.dataset_adapter.VTKCompositeDataArray, dtype: Optional[numpy.dtype] = None) vtkmodules.numpy_interface.dataset_adapter.VTKCompositeDataArray#
Create a new uninitialized VTKCompositeDataArray of the same shape as array.
- vtkmodules.numpy_interface.numpy_algorithms.nonzero#
‘(…)’
- vtkmodules.numpy_interface.numpy_algorithms.where#
‘(…)’
- vtkmodules.numpy_interface.numpy_algorithms.isin#
‘(…)’
- vtkmodules.numpy_interface.numpy_algorithms.expand_dims#
‘(…)’