pingwyn.mean

pingwyn.mean(obj, axis=None)

Compute the mean value of the given object.

The result of this function highly depends on the input data type and the axes provided. For each allowed data type, the function will return the following: - pingwyn.Curve:

If axis=None, will return a float of the mean y-axis data. Otherwise, returns a numpy.ndarray over the requested axes.

  • pingwyn.Grid:

    If axis=None, will return a pingwyn.Curve of spatially averaged data. If axis=2, will return a pingwyn.Image of the average curve value at each spatial point. Otherwise, returns a numpy.ndarray over the requested axes.

  • pingwyn.Image:

    If axis=None, will return a float with the average image value. If axis is an integer, will return a pingwyn.Curve of the mean data along the width/height of the image. Otherwise, returns a numpy.ndarray over the requested axes.

  • pingwyn.Profile:

    If axis=None, will return a pingwyn.Curve with the average of all curves that make up the profile. Otherwise, returns a numpy.ndarray over the requested axes.

Parameters:
  • obj (pingwyn.Curve or pingwyn.Grid or pingwyn.Image or pingwyn.Profile or list or tuple) – The data or list of data to take the average over. If a list or tuple is provided, will first run the data through pingwyn.combine before taking the mean.

  • axis (int or list/tuple of ints, optional) – The axes over which to take the average over, by default None.

Returns:

The averaged data over the specified axis in the type as described above.

Return type:

pingwyn.Curve or pingwyn.Image or numpy.ndarray or float

See also

pingwyn.combine