arange#
- class saiunit.math.arange(start=None, stop=None, step=None, dtype=None)#
Return evenly spaced values within a given interval.
Values are generated within the half-open interval
[start, stop)(in other words, the interval includingstartbut excludingstop). All ofstart,stop, andstepmust share the same unit when any of them is aQuantity.- Parameters:
start (
Union[saiunit.Quantity,Array,ndarray,number,bool,None]) – Start of the interval (inclusive). The default start value is 0.stop (
Union[saiunit.Quantity,Array,ndarray,number,bool,None]) – End of the interval (exclusive).step (
Union[saiunit.Quantity,Array,ndarray,number,bool,None]) – Spacing between values. The default step size is 1.dtype (
Union[str,type[Any],dtype,SupportsDType,None]) – The type of the output array. If not given, the dtype is inferred from the other input arguments.
- Returns:
out – Array of evenly spaced values.
- Return type:
Union[saiunit.Quantity,Array]- Raises:
UnitMismatchError – If
start,stop, andstepdo not share the same unit.
Examples
>>> import saiunit as u >>> u.math.arange(5) Array([0, 1, 2, 3, 4], dtype=int32) >>> u.math.arange(0 * u.meter, 3 * u.meter, 1 * u.meter) Quantity([0 1 2], "m")