Repository navigation
Fix binary save when only some segments have a time vector - #4923
Merged
Merged
Conversation
write_recording listed a timestamps path for every segment, write_binary only wrote those with a time vector, and BinaryRecordingSegment opened all of them, so save raised FileNotFoundError after writing the traces. List None for the segments without a time vector, and keep None in the constructor, its kwargs and recursive_path_modifier. Also keep None in t_starts, with the same lines as SpikeInterface#4922. Otherwise a time vector on one segment and a t_start on another still raises a TypeError. Claude helped me with this change.
Member
|
Thanks @AxelNoun Could you shorten the PR message? You can drop "Changes" and just keep an overview of what changed. We also don't need all the Tests details. Always keep in mind that humans will need to read it, and we all have a limited amount of time! Thanks in advance! |
Contributor
Author
|
Thanks @alejoe91, I shortened the description. |
alejoe91
approved these changes
Nov 10, 2026
alejoe91
reviewed
Nov 10, 2026
alejoe91
reviewed
Nov 10, 2026
Co-authored-by: Alessio Buccino <alejoe9187@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while fixing #4914, listed under "Not addressed" in #4922.
recording.save(format="binary", ...)raisedFileNotFoundErrorwhen only some segments have a time vector, for example afterrecording.set_times(times, segment_index=0).write_recordinglisted a timestamps file for every segment, but only those with a time vector are written. The error came after all the traces were written.This PR lists
Nonefor the segments without a time vector, and makesBinaryRecordingExtractorandrecursive_path_modifieraccept these entries. It also includes thet_startslines of #4922, so that a time vector on one segment and at_starton another works without depending on it. The two PRs merge without conflict in either order, and these lines drop out of this diff if #4922 goes in first.binary.jsoncan now containnullinfile_timestamps_paths. Older versions cannot load these folders, but could not create them either, and the output is unchanged when no segment or every segment has a time vector. I also considered ignoring a missing timestamps file when loading, but a lost file would then silently reset the times to 0.Claude helped me with this PR.