Skip to content

Add _get_signal_t_stop(block, seg, stream) to the rawio base API #1837

@h-mayorquin

Description

@h-mayorquin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions