Grid
Grid(
origin: Any ,
step_num: Any ,
step_den: int ,
count: int ,
k0: int = 0,
phase: int = 0,
parent_count: int | None[int, None] = None,
stride: int = 1,
)-> 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 slice keeps the original parent_count, origin and step, and maps samples through the integer offset k0 and stride. Evaluating the original expression keeps every label bit-for-bit, including numpy’s endpoint rounding.
An exact run folds k0 into its origin and phase. A newly constructed float run also folds an explicit offset into its origin; only slices with parent_count retain their original grid.
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. |
| resized | Restate a grid’s extent, as an explicit resize or gap fill requests. |
| 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. |