numpy.ma.fromfunction()

numpy.ma.fromfunction(function, shape, **kwargs) = Construct an array by executing a function over each coordinate. The resulting array therefore has a value fn(x, y, z) at coordinate (x, y, z). Parameters: function : callable The function is called with N parameters, where N is the rank of shape. Each parameter represents the coordinates of the array varying along a specific axis. For example, if shape were (2, 2), then the parameters in turn be (0, 0), (0, 1), (1, 0), (1, 1). shape :

numpy.ma.frombuffer()

numpy.ma.frombuffer(buffer, dtype=float, count=-1, offset=0) = Interpret a buffer as a 1-dimensional array. Parameters: buffer : buffer_like An object that exposes the buffer interface. dtype : data-type, optional Data-type of the returned array; default: float. count : int, optional Number of items to read. -1 means all data in the buffer. offset : int, optional Start reading the buffer from this offset; default: 0. Notes If the buffer has data that is not in machine byte-order,

numpy.ma.flatnotmasked_edges()

numpy.ma.flatnotmasked_edges(a) [source] Find the indices of the first and last unmasked values. Expects a 1-D MaskedArray, returns None if all values are masked. Parameters: a : array_like Input 1-D MaskedArray Returns: edges : ndarray or None The indices of first and last non-masked value in the array. Returns None if all values are masked. See also flatnotmasked_contiguous, notmasked_contiguous, notmasked_edges, clump_masked, clump_unmasked Notes Only accepts 1-D arrays. Exampl

numpy.ma.flatnotmasked_contiguous()

numpy.ma.flatnotmasked_contiguous(a) [source] Find contiguous unmasked data in a masked array along the given axis. Parameters: a : narray The input array. Returns: slice_list : list A sorted sequence of slices (start index, end index). See also flatnotmasked_edges, notmasked_contiguous, notmasked_edges, clump_masked, clump_unmasked Notes Only accepts 2-D arrays at most. Examples >>> a = np.ma.arange(10) >>> np.ma.flatnotmasked_contiguous(a) slice(0, 10, None) &

numpy.ma.fix_invalid()

numpy.ma.fix_invalid(a, mask=False, copy=True, fill_value=None) [source] Return input with invalid data masked and replaced by a fill value. Invalid data means values of nan, inf, etc. Parameters: a : array_like Input array, a (subclass of) ndarray. mask : sequence, optional Mask. Must be convertible to an array of booleans with the same shape as data. True indicates a masked (i.e. invalid) data. copy : bool, optional Whether to use a copy of a (True) or to fix a in place (False). Def

numpy.ma.expand_dims()

numpy.ma.expand_dims(x, axis) [source] Expand the shape of an array. Expands the shape of the array by including a new axis before the one specified by the axis parameter. This function behaves the same as numpy.expand_dims but preserves masked elements. See also numpy.expand_dims Equivalent function in top-level NumPy module. Examples >>> import numpy.ma as ma >>> x = ma.array([1, 2, 4]) >>> x[1] = ma.masked >>> x masked_array(data = [1 -- 4],

numpy.ma.filled()

numpy.ma.filled(a, fill_value=None) [source] Return input as an array with masked data replaced by a fill value. If a is not a MaskedArray, a itself is returned. If a is a MaskedArray and fill_value is None, fill_value is set to a.fill_value. Parameters: a : MaskedArray or array_like An input object. fill_value : scalar, optional Filling value. Default is None. Returns: a : ndarray The filled array. See also compressed Examples >>> x = np.ma.array(np.arange(9).reshape(3

numpy.ma.empty()

numpy.ma.empty(shape, dtype=float, order='C') = Return a new array of given shape and type, without initializing entries. Parameters: shape : int or tuple of int Shape of the empty array dtype : data-type, optional Desired output data-type. order : {?C?, ?F?}, optional Whether to store multi-dimensional data in row-major (C-style) or column-major (Fortran-style) order in memory. Returns: out : ndarray Array of uninitialized (arbitrary) data of the given shape, dtype, and order. O

numpy.ma.empty_like()

numpy.ma.empty_like(a, dtype=None, order='K', subok=True) = Return a new array with the same shape and type as a given array. Parameters: a : array_like The shape and data-type of a define these same attributes of the returned array. dtype : data-type, optional Overrides the data type of the result. New in version 1.6.0. order : {?C?, ?F?, ?A?, or ?K?}, optional Overrides the memory layout of the result. ?C? means C-order, ?F? means F-order, ?A? means ?F? if a is Fortran contiguous

numpy.ma.dumps()

numpy.ma.dumps(a) [source] Return a string corresponding to the pickling of a masked array. This is a wrapper around cPickle.dumps. Parameters: a : MaskedArray The array for which the string representation of the pickle is returned.