numpy.ma.masked_array

numpy.ma.masked_array [source] alias of MaskedArray

numpy.ma.masked_all()

numpy.ma.masked_all(shape, dtype=) [source] Empty masked array with all elements masked. Return an empty masked array of the given shape and dtype, where all the data are masked. Parameters: shape : tuple Shape of the required MaskedArray. dtype : dtype, optional Data type of the output. Returns: a : MaskedArray A masked array with all data masked. See also masked_all_like Empty masked array modelled on an existing array. Examples >>> import numpy.ma as ma >>&g

numpy.ma.masked

In addition to the MaskedArray class, the numpy.ma module defines several constants. numpy.ma.masked The masked constant is a special case of MaskedArray, with a float datatype and a null shape. It is used to test whether a specific entry of a masked array is masked, or to mask one or several entries of a masked array: >>> x = ma.array([1, 2, 3], mask=[0, 1, 0]) >>> x[1] is ma.masked True >>> x[-1] = ma.masked >>> x masked_array(data = [1 -- --],

numpy.ma.make_mask_none()

numpy.ma.make_mask_none(newshape, dtype=None) [source] Return a boolean mask of the given shape, filled with False. This function returns a boolean ndarray with all entries False, that can be used in common mask manipulations. If a complex dtype is specified, the type of each field is converted to a boolean type. Parameters: newshape : tuple A tuple indicating the shape of the mask. dtype : {None, dtype}, optional If None, use a MaskType instance. Otherwise, use a new datatype with the

numpy.ma.make_mask_descr()

numpy.ma.make_mask_descr(ndtype) [source] Construct a dtype description list from a given dtype. Returns a new dtype object, with the type of all fields in ndtype to a boolean type. Field names are not altered. Parameters: ndtype : dtype The dtype to convert. Returns: result : dtype A dtype that looks like ndtype, the type of all fields is boolean. Examples >>> import numpy.ma as ma >>> dtype = np.dtype({'names':['foo', 'bar'], 'formats':[np.f

numpy.ma.make_mask()

numpy.ma.make_mask(m, copy=False, shrink=True, dtype=) [source] Create a boolean mask from an array. Return m as a boolean mask, creating a copy if necessary or requested. The function can accept any sequence that is convertible to integers, or nomask. Does not require that contents must be 0s and 1s, values of 0 are interepreted as False, everything else as True. Parameters: m : array_like Potential mask. copy : bool, optional Whether to return a copy of m (True) or m itself (False).

numpy.ma.load()

numpy.ma.load(F) [source] Wrapper around cPickle.load which accepts either a file-like object or a filename. Parameters: F : str or file The file or file name to load. See also dump Pickle an array Notes This is different from numpy.load, which does not use cPickle but loads the NumPy binary .npy format.

numpy.ma.loads()

numpy.ma.loads(strg) [source] Load a pickle from the current string. The result of cPickle.loads(strg) is returned. Parameters: strg : str The string to load. See also dumps Return a string corresponding to the pickling of a masked array.

numpy.ma.is_masked()

numpy.ma.is_masked(x) [source] Determine whether input has masked values. Accepts any object as input, but always returns False unless the input is a MaskedArray containing masked values. Parameters: x : array_like Array to check for masked values. Returns: result : bool True if x is a MaskedArray with masked values, False otherwise. Examples >>> import numpy.ma as ma >>> x = ma.masked_equal([0, 1, 0, 2, 3], 0) >>> x masked_array(data = [-- 1 -- 2 3],

numpy.ma.is_mask()

numpy.ma.is_mask(m) [source] Return True if m is a valid, standard mask. This function does not check the contents of the input, only that the type is MaskType. In particular, this function returns False if the mask has a flexible dtype. Parameters: m : array_like Array to test. Returns: result : bool True if m.dtype.type is MaskType, False otherwise. See also isMaskedArray Test whether input is an instance of MaskedArray. Examples >>> import numpy.ma as ma >>>