spectrochempy.empty_likeο
- empty_like(dataset, dtype=None, **kwargs)[source]ο
Return a new uninitialized
NDDataset.The returned
NDDatasethave the same shape and type as a given array. Units, coordset, β¦ can be added in kwargs.- Parameters:
dataset (
NDDatasetor 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_valuewith 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_likeorfull_likeinstead. It may be marginally faster than the functions that do set the array values.