I have been thinking about timing #1819.
The rawio base class exposes _get_signal_t_start(block_index, seg_index, stream_index) as a per-stream refinement of _segment_t_start, but there is no per-stream counterpart for t_stop. The only stop-time API is _segment_t_stop(block_index, seg_index), which returns a single value per segment. For formats where streams within a segment can have genuinely different stop times (SpikeGLX imec vs nidq vs OneBox on independent hardware clocks, Blackrock PTP across mixed devices, any multi-device setup), this forces the rawio implementation to collapse across streams somewhere, which loses information that callers could otherwise use for accurate per-stream alignment. Concretely in SpikeGLXRawIO._parse_header, the current code computes t_stop per (stream, segment) as sample_length / sampling_rate and then takes max across streams to produce a single per-segment value, silently discarding the per-stream differences:
|
self._t_stops[seg_index] = max(self._t_stops[seg_index], info["t_stop"]) |
I think the right fix is additive: add _get_signal_t_stop(block_index, seg_index, stream_index) -> float to the base class, mirroring _get_signal_t_start exactly. Formats where streams share a clock can implement it trivially or delegate to _segment_t_stop.
I have been thinking about timing #1819.
The rawio base class exposes
_get_signal_t_start(block_index, seg_index, stream_index)as a per-stream refinement of_segment_t_start, but there is no per-stream counterpart fort_stop. The only stop-time API is_segment_t_stop(block_index, seg_index), which returns a single value per segment. For formats where streams within a segment can have genuinely different stop times (SpikeGLX imec vs nidq vs OneBox on independent hardware clocks, Blackrock PTP across mixed devices, any multi-device setup), this forces the rawio implementation to collapse across streams somewhere, which loses information that callers could otherwise use for accurate per-stream alignment. Concretely inSpikeGLXRawIO._parse_header, the current code computest_stopper (stream, segment) assample_length / sampling_rateand then takesmaxacross streams to produce a single per-segment value, silently discarding the per-stream differences:python-neo/neo/rawio/spikeglxrawio.py
Line 284 in 71df66e
I think the right fix is additive: add
_get_signal_t_stop(block_index, seg_index, stream_index) -> floatto the base class, mirroring_get_signal_t_startexactly. Formats where streams share a clock can implement it trivially or delegate to_segment_t_stop.