treadmill#

Treadmill loader.

Data is reconstructed entirely from the central *_dataqueue.csv log, which carries the full sample already published on the master clock via queue_elapsed. Two on-disk layouts are supported:

  • Modern (preferred): the sample is fanned out into dedicated distance/speed/device_us columns, read directly with no regex.

  • Legacy: the sample lives in a single EncoderData(timestamp=..., distance=..., speed=...) payload string, parsed by regex.

The per-session *_treadmill.csv is only consulted as a fallback when no dataqueue is available for that session (e.g. legacy fixtures used by the treadmill_csv_fallback test).

class mesofield.datakit.sources.behavior.treadmill.TreadmillSource[source]#

Bases: TimeseriesSource

Load treadmill samples aligned to the experiment window.

requires: ClassVar[Tuple[str, ...]] = ('dataqueue',)#

Tag names of upstream sources whose loaded streams should be made available via LoadContext.dependencies. Soft contract: a missing or failed dependency yields None in dependencies[tag]; sources are responsible for either degrading gracefully or raising.

build_timeseries(path, *, context=None)[source]#

Return (timeline, value, meta).

Parameters:
Return type:

tuple[ndarray, DataFrame, dict]