scipp.zeros#
- scipp.zeros(*, dims=None, shape=None, sizes=None, unit=<automatically deduced unit>, dtype=DType('float64'), with_variances=False)#
Constructs a
Variable
with default initialized values with given dimension labels and shape.The dims and shape can also be specified using a sizes dict. Optionally can add default initialized variances. Only keyword arguments accepted.
- Parameters:
dims (
Optional
[Sequence
[str
]], default:None
) – Optional (if sizes is specified), dimension labels.shape (
Optional
[Sequence
[int
]], default:None
) – Optional (if sizes is specified), dimension sizes.sizes (
Optional
[dict
[str
,int
]], default:None
) – Optional, dimension label to size map.unit (
Unit
|str
|DefaultUnit
|None
, default:<automatically deduced unit>
) – Unit of contents.dtype (
scipp.typing.DTypeLike
) – Type of underlying data.with_variances (
bool
, default:False
) – If True includes variances initialized to 0.
- Returns:
Variable
– A variable filled with 0’s.
See also
scipp.array
,scipp.empty
,scipp.ones
,scipp.scalar
,scipp.zeros_like
Examples
>>> sc.zeros(dims=['x'], shape=[4]) <scipp.Variable> (x: 4) float64 [dimensionless] [0, 0, 0, 0]
>>> sc.zeros(sizes={'x': 4}) <scipp.Variable> (x: 4) float64 [dimensionless] [0, 0, 0, 0]
>>> sc.zeros(sizes={'y': 3}, with_variances=True) <scipp.Variable> (y: 3) float64 [dimensionless] [0, 0, 0] [0, 0, 0]
>>> sc.zeros(sizes={'z': 3}, unit='kg', dtype=int) <scipp.Variable> (z: 3) int64 [kg] [0, 0, 0]