spectrochempy.zeros
- zeros(shape, dtype=None, **kwargs)[source]
Return a new
NDDatasetof 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_likeReturn an array of zeros with shape and type of input.
ones_likeReturn an array of ones with shape and type of input.
empty_likeReturn an empty array with shape and type of input.
full_likeFill an array with shape and type of input.
onesReturn a new array setting values to 1.
emptyReturn a new uninitialized array.
fullFill 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))