pypret.mesh_data module

This module implements an object for dealing with two-dimensional data.

class pypret.mesh_data.MeshData(data, *axes, uncertainty=None, labels=None, units=None)[source]

Bases: pypret.io.io.IO

__init__(data, *axes, uncertainty=None, labels=None, units=None)[source]

Creates a MeshData instance.

Parameters:
  • data (ndarray) – A at least two-dimensional array containing the data.
  • *axes (ndarray) – Arrays specifying the coordinates of the data axes. Must be given in indexing order.
  • uncertainty (ndarray) – An ndarray of the same size as data that contains some measure of the uncertainty of the meshdata. E.g., it could be the standard deviation of the data.
  • labels (list of str, optional) – A list of strings labeling the axes. The last element labels the data itself, e.g. labels must have one more element than the number of axes.
  • units (list of str, optional) – A list of unit strings.
autolimit(*axes, threshold=0.01, padding=0.25)[source]

Limits the data based on the marginals.

copy()[source]

Creates a copy of the MeshData instance.

flip(*axes)[source]

Flips the data on the specified axes.

interpolate(axis1=None, axis2=None, degree=2, sorted=False)[source]

Interpolates the data on a new two-dimensional, equidistantly spaced grid.

limit(*limits, axes=None)[source]

Limits the data range of this instance.

Parameters:
  • *limits (tuples) – The data limits in the axes as tuples. Has to match the dimension of the data or the number of axes specified in the axes parameter.
  • axes (tuple or None) – The axes in which the limit is applied. Default is None in which case all axes are selected.
marginals(normalize=False, axes=None)[source]

Calculates the marginals of the data.

axes specifies the axes of the marginals, e.g., the axes on which the sum is projected.

ndim

Returns the dimension of the data as integer.

normalize()[source]

Normalizes the maximum of the data to 1.

scale(scale)[source]
shape

Returns the shape of the data as a tuple.