ZarrScene

ZarrScene is the Zarr-backed counterpart of Scene. It reads a trajectories/ group with pos/vel/time/trajid (and optional accel) arrays — the same layout written by openptv2’s run store (openptv2.storage.seal.seal()) and by flowtracks.io.save_zarr_trajectories() — so either works with no conversion step.

It implements the same public surface as Scene (duck-typed, not a subclass): collect(["pos", "vel", ...]), times, len, __iter__ and collect_frames. Where the HDF5 Scene builds PyTables read_where() query strings, ZarrScene reimplements collect’s where filtering in plain numpy.

A Zarr-backed counterpart to flowtracks.scene.Scene.

Scene reads a PyTables HDF5 /particles table via read_where() query strings. ZarrScene reads the same particle-observation table shape from a Zarr store’s trajectories/ group instead – either one written by flowtracks.io.save_zarr_trajectories() (a standalone flowtracks Zarr export) or one written by openptv2.storage.seal.seal() (the run store that openptv2’s tracking pipeline produces directly, see openptv2’s docs/plans/2026-08-14-storage-formats-as-built.md and its follow-on Phase A-D plan). Both write the same five arrays (pos, vel, time, trajid, optionally accel), so one reader handles both without a conversion step.

Implements the same public surface as Scene (duck-typed, not a subclass, since the two hold fundamentally different backing stores) so existing callers – eulerian.py’s scene.collect(...) fast path chief among them – work unmodified against either.

collect()’s where filtering is reimplemented directly in numpy instead of composing a PyTables read_where() query string (the gen_query_string mini-language in scene.py); there is no query engine to target, so this is strictly simpler, not a re-implementation of the string DSL itself.

class flowtracks.zarr_scene.ZarrScene(store_path: str | Path, frame_range=None)[source]

Programmer’s interface to a Zarr-stored particle trajectory table, mirroring flowtracks.scene.Scene’s public methods.

trajectory_tags() → ndarray[source]
set_frame_range(frame_range) → None[source]
frame_range()[source]
keys() → list[source]
shapes() → list[source]
trajectory_ids() → ndarray[source]
trajectory_by_id(trid) → Trajectory[source]
iter_trajectories() → Iterator[Trajectory][source]
iter_frames() → Iterator[ParticleSnapshot][source]
frame_by_time(t) → ParticleSnapshot[source]
iter_segments()[source]
collect(keys: Sequence[str], where: dict | None = None) → list[source]
bounding_box()[source]