MCPcopy Create free account
hub / github.com/Kitware/VTK / apply_ufunc

Function apply_ufunc

Wrapping/Python/vtkmodules/numpy_interface/numpy_algorithms.py:29–37  ·  view source on GitHub ↗

Apply a function to each member of a VTKCompositeDataArray. VTKArray and numpy arrays are also supported.

(func, array, args=())

Source from the content-addressed store, hash-verified

27 return res
28
29def apply_ufunc(func, array, args=()):
30 """Apply a function to each member of a VTKCompositeDataArray.
31 VTKArray and numpy arrays are also supported."""
32 if array is dsa.NoneArray:
33 return dsa.NoneArray
34 elif type(array) == dsa.VTKCompositeDataArray:
35 return dsa.VTKCompositeDataArray(_apply_func2(func, array, args), dataset = array.DataSet)
36 else:
37 return func(array, *args)
38
39def _make_ufunc(ufunc):
40 """ Given a ufunc, creates a closure that applies it to each member

Callers 3

new_ufuncFunction · 0.85
meanFunction · 0.85
varFunction · 0.85

Calls 2

_apply_func2Function · 0.85
typeEnum · 0.50

Tested by

no test coverage detected