spectrochempy.empty_like
- empty_like(dataset, dtype=None, **kwargs)[source]
Return a new uninitialized
NDDataset
.The returned
NDDataset
have the same shape and type as a given array. Units, coordset, … can be added in kwargs.- Parameters:
dataset (
NDDataset
or array-like) – Object from which to copy the array structure.dtype (data-type, optional) – Overrides the data type of the result.
**kwargs – Optional keyword parameters (see Other Parameters).
- Returns:
emptylike – Array of
fill_value
with the same shape and type asdataset
.- 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.
Notes
This function does not initialize the returned array; to do that use for instance
zeros_like
,ones_like
orfull_like
instead. It may be marginally faster than the functions that do set the array values.