encoder#
Wheel encoder over USB-serial.
Subclass of mesofield.devices.base.BaseSerialDevice that reads
integer click counts (one per line) from an Arduino-style firmware.
Emitted payload is the raw click count (int); speed and distance
are derived in analysis from the wheel diameter and CPR carried in the
device config.
The producer (SerialWorker) writes a CSV; the matching ingest-side parser (WheelEncoder) lives at the bottom of this module so producer and parser sit in the same file. SerialWorker.Parser resolves to WheelEncoder for manifest-driven dispatch.
Constructor preserves the legacy keyword API
(serial_port, baud_rate, sample_interval,
wheel_diameter, cpr, development_mode) for compatibility
with mesofield.hardware.
- class mesofield.devices.encoder.SerialWorker[source]#
Bases:
BaseSerialDeviceArduino wheel-encoder device.
- __init__(cfg=None, serial_port=None, baud_rate=None, sample_interval=None, wheel_diameter=None, cpr=None, development_mode=None, **kwargs)[source]#
- Parser#
alias of
WheelEncoder
- class mesofield.devices.encoder.WheelEncoder[source]#
Bases:
TimeseriesSourceLoad wheel encoder streams recorded alongside nidaq pulses.
The raw CSV emitted by the behavioral rig contains incremental click counts, elapsed time in seconds, and instantaneous speed estimates. The loader converts this information into a strictly increasing timeline anchored to acquisition start, computes cumulative distance, and exposes rich metadata for downstream alignment against the nidaq-driven master clock.