Warning

You are reading the documentation related to the development version. Go here if you are looking for the documentation of the stable release.

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 as dataset .

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

full_like

Return an array with a given fill value with shape and type of the

input.

ones_like

Return an array of ones with shape and type of input.

zeros_like

Return an array of zeros with shape and type of input.

empty

Return a new uninitialized array.

ones

Return a new array setting values to one.

zeros

Return a new array setting values to zero.

full

Fill a new array.

Notes

This function does not initialize the returned array; to do that use for instance zeros_like , ones_like or full_like instead. It may be marginally faster than the functions that do set the array values.