Skip to content

Add get_start_time, get_end_time, and get_last_spike_frame to BaseSorting#4525

Open
h-mayorquin wants to merge 1 commit intoSpikeInterface:mainfrom
h-mayorquin:fix_registering_time
Open

Add get_start_time, get_end_time, and get_last_spike_frame to BaseSorting#4525
h-mayorquin wants to merge 1 commit intoSpikeInterface:mainfrom
h-mayorquin:fix_registering_time

Conversation

@h-mayorquin
Copy link
Copy Markdown
Collaborator

BaseSorting has no public way to query the start or end time of a segment. BaseRecording has both (#3623). This PR adds get_start_time and get_end_time to BaseSorting, plus a get_last_spike_frame helper. With a registered recording, get_end_time returns the recording's end time. Without one, it returns the time of the last spike in the segment (the best the sorting can do on its own). get_start_time reads _t_start directly in both cases.

Adding these accessors however creates an ambiguity: some sorting extractors set _t_start on their segments at init. For example, neo sorting extractors set _t_start from the signal stream (e.g. Neuralynx infers it here). If that sorting registers a recording that also starts at 100.0s, get_start_time would need to decide which value to return.

The decision here is that registering a recording is a statement that "these are the right timestamps" (see #4519). In consequence, register_recording now copies the recording's start times into the sorting segments' _t_start. This replaces whatever the extractor had set at init, so get_start_time returns consistent values.

@alejoe91 alejoe91 added the core Changes to core module label Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Changes to core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants