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

empty(shape, dtype=None, **kwargs)[source]

Return a new NDDataset of given shape and type, without initializing entries.

Parameters
  • shape (int or tuple of int) – Shape of the empty array.

  • dtype (data-type, optional) – Desired output data-type.

  • **kwargs – Optional keyword parameters (see Other Parameters).

Returns

empty – Array of uninitialized (arbitrary) data of the given shape, dtype, and order. Object arrays will be initialized to None.

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.

zeros

Return a new array setting values to zero.

ones

Return a new array setting values to 1.

full

Fill a new array.

Notes

empty , unlike zeros , does not set the array values to zero, and may therefore be marginally faster. On the other hand, it requires the user to manually set all the values in the array, and should be used with caution.

Examples

>>> scp.empty([2, 2], dtype=int, units='s')
NDDataset: [int64] s (shape: (y:2, x:2))