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

Function mean_per_block

Wrapping/Python/vtkmodules/numpy_interface/algorithms.py:398–419  ·  view source on GitHub ↗

Returns the mean of all values along a particular axis (dimension) for each block of a VTKCompositeDataArray. 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

(array, axis=None, controller=None)

Source from the content-addressed store, hash-verified

396 return _global_per_block(CountPerBlockImpl(), array, axis, controller)
397
398def mean_per_block(array, axis=None, controller=None):
399 """Returns the mean of all values along a particular axis (dimension)
400 for each block of a VTKCompositeDataArray.
401
402 Given an array of m tuples and n components:
403 * Default is to return the mean of all values in an array.
404 * axis=0: Return the mean values of all components and return a one
405 tuple, n-component array.
406 * axis=1: Return the mean values of all components of each tuple and
407 return an m-tuple, 1-component array.
408
409 When called in parallel, this function will compute the mean across
410 processes when a controller argument is passed or the global controller
411 is defined. To disable parallel summing when running in parallel, pass a
412 dummy controller as follows:
413
414 mean(array, controller=vtkmodules.vtkParallelCore.vtkDummyController()).
415 """
416 if axis is None or axis == 0:
417 return sum_per_block(array, axis, controller) / count_per_block(array, axis, controller)
418 else:
419 return sum(array, axis, controller)
420
421def max_per_block(array, axis=None, controller=None):
422 """Returns the max of all values along a particular axis (dimension)

Callers

nothing calls this directly

Calls 3

sum_per_blockFunction · 0.85
count_per_blockFunction · 0.85
sumFunction · 0.70

Tested by

no test coverage detected