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

Function mean

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

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: Re

(array, axis=None, controller=None, size=None)

Source from the content-addressed store, hash-verified

303
304@dsa._override_numpy(numpy.mean)
305def mean(array, axis=None, controller=None, size=None):
306 """Returns the mean of all values along a particular axis (dimension).
307 Given an array of m tuples and n components:
308 * Default is to return the mean of all values in an array.
309 * axis=0: Return the mean values of all components and return a one
310 tuple, n-component array.
311 * axis=1: Return the mean values of all components of each tuple and
312 return an m-tuple, 1-component array.
313
314 When called in parallel, this function will compute the mean across
315 processes when a controller argument is passed or the global controller
316 is defined. To disable parallel summing when running in parallel, pass a
317 dummy controller as follows:
318
319 mean(array, controller=vtkmodules.vtkParallelCore.vtkDummyController()).
320 """
321 from .algorithms import array_count
322 if axis is None or axis == 0:
323 if size is None:
324 size = array_count(array, axis, controller)
325 return sum(array, axis, controller) / size
326 else:
327 if type(array) == dsa.VTKCompositeDataArray:
328 return apply_ufunc(algs.mean, array, (axis,))
329 else:
330 return algs.mean(array, axis)
331
332@dsa._override_numpy(numpy.var)
333def var(array, axis=None, controller=None):

Callers 1

varFunction · 0.70

Calls 5

array_countFunction · 0.85
apply_ufuncFunction · 0.85
sumFunction · 0.70
typeEnum · 0.50
meanMethod · 0.45

Tested by

no test coverage detected