spectrochempy.full_like
- full_like(dataset, fill_value=0.0, dtype=None, **kwargs)[source]
Return a
NDDatasetof fill_value.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.fill_value (scalar) – Fill value.
dtype (data-type, optional) – Overrides the data type of the result.
**kwargs – Optional keyword parameters (see Other Parameters).
- Returns:
fulllike – 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.
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.
zerosReturn a new array setting values to zero.
onesReturn a new array setting values to one.
emptyReturn a new uninitialized array.
fullFill a new array.
Examples
3 possible ways to call this method
from the API
>>> x = np.arange(6, dtype=int) >>> scp.full_like(x, 1) NDDataset: [float64] unitless (size: 6)
as a classmethod
>>> x = np.arange(6, dtype=int) >>> scp.NDDataset.full_like(x, 1) NDDataset: [float64] unitless (size: 6)
as an instance method
>>> scp.NDDataset(x).full_like(1, units='km') NDDataset: [float64] km (size: 6)