Repository navigation
Fix saving a recording when only some segments have a t_start - #4922
Merged
Merged
Conversation
get_segment_t_starts returns a mixed list such as [None, 100.0] when only some segments have a start time, and three constructors called float() on every entry. Keep None in these constructors. Also set shms and main_shm_owner first in SharedMemoryRecording, so that __del__ is safe after a failed constructor, and return a float instead of a 0-d array from ZarrRecordingExtractor. 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
requested changes
Nov 10, 2026
Requested in review: the test is unrelated to the t_starts fix.
alejoe91
reviewed
Nov 10, 2026
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.
Fixes #4914.
When only some segments have a
t_start, for example afterappend_recordingsorshift_times(..., segment_index=1),get_segment_t_startsreturns a list such as[None, 100.0].NumpyRecording,SharedMemoryRecordingandBinaryRecordingExtractorcalledfloat()on every entry, sosaveraised aTypeErrorfor the binary and memory formats.This PR keeps the
Noneentries in these three constructors, rather than replacing them with0.0, so that "no start time" stays distinct from "starts at 0", as zarr already does withNaN. It also covers the two smaller points of the issue:SharedMemoryRecordingno longer raisesAttributeErrorin__del__after a failed constructor. Withmain_shm_owner=True, it now releases the buffers it had attached.ZarrRecordingExtractorreturnst_startas afloatinstead of a 0-d array.Not addressed: the binary save with a time vector on only some segments (#4923), and
savesilently ignoring unknown keywords such asshared_memory.Claude helped me with this PR.