Grid
Grid(
origin: Any ,
step_num: Any ,
step_den: int ,
count: int ,
k0: int = 0,
phase: int = 0,
)-> None
One evenly sampled run of labels.
An exact run (step_den above zero) works in ticks – nanoseconds for time, the integers themselves otherwise – and labels sample k as origin + (phase + (k0 + k) * step_num) // step_den. The ideal grid therefore has a spacing of step_num / step_den ticks and an origin phase / step_den ticks after origin, and each label is the floor of its ideal position, so a 1024 Hz grid never drifts.
A float run (step_den of zero) keeps step_num as a scalar step and spaces its labels linearly, as numpy does.
A run states an index offset k0 so a slice can be taken by arithmetic alone; it is folded into the origin on construction, which is exact and leaves grids holding the same labels holding the same fields, so they compare and identify alike however they were reached.
Methods
| Name | Description |
|---|---|
| canonical | The terms which name the run’s labels: origin, step, and phase. |
| index_of | The sample index each label tick maps to. |
| labels | The labels at these indices, which may lie outside the run. |
| sliced | The run of the samples first, first + stride, … (count of them). |
| step | The whole-tick (or float) spacing between neighbouring labels. |
| step_exact | The exact spacing in coordinate units, seconds for time. |