spectrochempy.zeros
- zeros(shape, dtype=None, **kwargs)[source]
Return a new
NDDataset
of given shape and type, filled with zeros.- Parameters:
shape (int or sequence of ints) – Shape of the new array, e.g.,
(2, 3)
or2
.dtype (data-type, optional) – The desired data-type for the array, e.g.,
numpy.int8
. Default isnumpy.float64
.**kwargs – Optional keyword parameters (see Other Parameters).
- Returns:
zeros – Array of zeros.
- Other Parameters:
units (str or ur instance) – Units of the returned object. If not provided, try to copy from the input object.
coordset (list or Coordset object) – Coordinates for the returned object. If not provided, try to copy from the input object.
See also
zeros_like
Return an array of zeros with shape and type of input.
ones_like
Return an array of ones with shape and type of input.
empty_like
Return an empty array with shape and type of input.
full_like
Fill an array with shape and type of input.
ones
Return a new array setting values to 1.
empty
Return a new uninitialized array.
full
Fill a new array.
Examples
>>> nd = scp.NDDataset.zeros(6) >>> nd NDDataset: [float64] unitless (size: 6) >>> nd = scp.zeros((5, )) >>> nd NDDataset: [float64] unitless (size: 5) >>> nd.values array([ 0, 0, 0, 0, 0]) >>> nd = scp.zeros((5, 10), dtype=np.int, units='absorbance') >>> nd NDDataset: [int64] a.u. (shape: (y:5, x:10))