neclib.core.math.frange_impl#
- frange(stop: Union[int, float, ndarray[Any, dtype[number]], Array[Union[int, float]], ndarray[Any, dtype[Any]], Quantity], /, *, inclusive: bool = False, pad_method: Union[str, Callable[[...], Any]] = 'edge', **pad_kwargs: Any) ndarray[Any, dtype[Any]] [source]#
- frange(start: T, stop: T, step: Optional[T] = None, /, *, inclusive: bool = False, pad_method: Union[str, Callable[[...], Any]] = 'edge', **pad_kwargs: Any) ndarray[Any, dtype[Any]]
A range function with support for quantities, float values, and arrays.
- Parameters:
start – First value to be generated.
stop – Last value to be generated is equal to or less than this value.
step – Spacing between values.
inclusive – If
True
,stop
is included in the range, no matter whatstep
is.pad_method – Method to use for padding the last value to match the length of the other values. See numpy.pad for more details.
pad_kwargs –
Keyword arguments for numpy.pad.
- Return type:
Array of values.
- Raises:
TypeError – If arguments are mixture of quantities or non-quantities.
UnitConversionError – If any of the arguments have non-equivalent physical dimension.
UnitConversionError – If any of the arguments are given as sequence of quantities.
Examples
>>> frange(1, 10, 2) array([1, 3, 5, 7, 9, 10]) >>> frange(1 * u.m, 10 * u.m, 2 * u.m) <Quantity [ 1., 3., 5., 7., 9., 10.] m> >>> frange([1, 2], [2, 2.1], [3, 1]) array([[1. , 2. ], [2. , 2.1]])