CoordRange
CoordRange(
units: pint.registry.Quantity | str | None[Quantity, str, None] = None,
step: Any = None,
shape: tuple[int, …] = (),
dtype: Any = None,
start: Any = None,
stop: Any = None,
step_numerator: int | None[int, None] = None,
step_denominator: int | None[int, None] = None,
origin_offset: int | None[int, None] = None,
)-> None
A coordinate representing a range of evenly sampled data.
Nanosecond time and integer ranges hold their sampling exactly: labels are integer ticks (nanoseconds, or the integers themselves), the ideal grid has a spacing of step_numerator / step_denominator ticks and an origin origin_offset / step_denominator ticks after start, and each label is the floor of its ideal position. Slices, strides, reversals, and selections therefore reproduce the labels of the original exactly, and a 1024 Hz grid never drifts the way a step rounded to 976562 ns would. step reports the nearest whole-tick spacing; step_exact the fraction, in seconds for time.
Float ranges, and time ranges in units other than nanoseconds, keep a scalar step and linearly spaced labels; their grid fields are None.
Parameters
| Parameter | Description |
|---|---|
| start | The starting value. |
| stop | The ending value, exclusive. |
| step |
The step between values; for exact grids also a Fraction or a(numerator, denominator) tuple in coordinate units.
|
| shape | The sample count. |
| step_numerator, step_denominator, origin_offset |
The exact grid in ticks, normally supplied only when rebuilding a dumped coordinate. |
Methods
| Name | Description |
|---|---|
| align_to | Align the coordinate to another coordinate. |
| approx_equal | Return True if the coordinates are approximately equal. |
| change_length | Adjust the length of the coordinate by changing the end value. |
| convert_units | Convert from one unit to another. Set units if None are set. |
| coord_range | The span of the coordinate; extended, to its exclusive end. |
| empty | Empty out the coordinate. |
| fingerprint | Return a stable fingerprint whose matches imply coord equality. |
| get_discontinuities | Return a dataframe describing discontinuities in the coordinate. |
| get_next_index | Get the index a value would have in a coordinate. |
| get_sample_count | Return the number of samples represented by a value. |
| get_slice_tuple | Get a tuple with (start, stop) and perform basic checks. |
| check_time_units | Ensure time units are s if dtype is time-like. |
| index |
Index the coordinate; a slice keeps the grid, as coord[slice] does.
|
| max | Return max value. |
| min | Return min value. |
| new | Update coordinate; an exact grid is kept unless the step changes. |
| order | Order coordinate according to array values or samples. |
| reduce_coord | Get a reduced coordinate. |
| select | Apply select, return selected coords and index to apply to array. |
| set_units | Set new units on coordinates. |
| simplify | Return the simplest coordinate representing the same values. |
| simplify_units | Simplify the coordinate units. |
| snap | Snap the coordinates to evenly sampled grid points. |
| sort | Sort the contents of the coord. Return new coord and slice for sorting. |
| to_summary | Get the summary info about the coord, exact grid included. |
| update | Update parts of the coordinate. |
| update_data | Update the data of the coordinate. |
| update_limits | Update the limits or sampling of the coordinates. |