scipp.arange
scipp.arange#
- scipp.arange(dim, start, stop=None, step=None, *, unit=<automatically deduced unit>, dtype=None)#
Constructs a
Variable
with evenly spaced values within a given interval. Values are generated within the half-open interval [start, stop) (in other words, the interval including start but excluding stop).Warning
The length of the output might not be numerically stable. See
numpy.arange()
.- Parameters
dim (
str
) – Dimension label.start (
Union
[TypeVar
(NumberOrVar
,Union
[int
,float
],Variable
),datetime64
]) – Optional, the starting value of the sequence. Default=0.stop (
Union
[TypeVar
(NumberOrVar
,Union
[int
,float
],Variable
),datetime64
,None
], default:None
) – End of interval. The interval does not include this value, except in some (rare) cases where step is not an integer and floating-point round-off can come into play.step (
Optional
[TypeVar
(NumberOrVar
,Union
[int
,float
],Variable
)], default:None
) – Spacing between values.unit (
Union
[Unit
,str
,None
], default:<automatically deduced unit>
) – Unit of contents.dtype (
scipp.typing.DTypeLike
) – Type of underlying data. By default, inferred from value argument.
See also
Examples
>>> sc.arange('x', 1, 5) <scipp.Variable> (x: 4) int64 [dimensionless] [1, 2, 3, 4] >>> sc.arange('x', 1, 5, 0.5) <scipp.Variable> (x: 8) float64 [dimensionless] [1, 1.5, ..., 4, 4.5]
>>> sc.arange('x', 1, 5, unit='m') <scipp.Variable> (x: 4) int64 [m] [1, 2, 3, 4]
- Return type