Add num_channels to BaseRecordingSegment#4526
Draft
h-mayorquin wants to merge 2 commits intoSpikeInterface:mainfrom
Draft
Add num_channels to BaseRecordingSegment#4526h-mayorquin wants to merge 2 commits intoSpikeInterface:mainfrom
num_channels to BaseRecordingSegment#4526h-mayorquin wants to merge 2 commits intoSpikeInterface:mainfrom
Conversation
alejoe91
requested changes
May 7, 2026
Member
alejoe91
left a comment
There was a problem hiding this comment.
Thanks @h-mayorquin
Given that segments will always be added to a BaseRecording object, see my proposed changes! Curious to hear your thoughts!
Comment on lines
+922
to
+929
| if self._num_channels is not None: | ||
| return self._num_channels | ||
| if self._parent_extractor is None: | ||
| return None | ||
| container_recording = self._parent_extractor() | ||
| if container_recording is None: | ||
| return None | ||
| return container_recording.get_num_channels() |
Member
There was a problem hiding this comment.
Since the segments are supposed to be added with the BaseExtractor.add_segment(), which always registers the self._parent_extractor weakref available as self.parent_extractor property, I wonder whether we need any of this?
Suggested change
| if self._num_channels is not None: | |
| return self._num_channels | |
| if self._parent_extractor is None: | |
| return None | |
| container_recording = self._parent_extractor() | |
| if container_recording is None: | |
| return None | |
| return container_recording.get_num_channels() | |
| return self.parent_extractor.get_num_channels() |
@h-mayorquin any place in mind where this won't work?
| def __init__(self, file_path, sampling_frequency, t_start, num_channels, dtype, time_axis, file_offset): | ||
| BaseRecordingSegment.__init__(self, sampling_frequency=sampling_frequency, t_start=t_start) | ||
| self.num_channels = num_channels | ||
| self._num_channels = num_channels |
Member
There was a problem hiding this comment.
For the same reason, we can drop this IMO. Segments will always be added to a parent extractor and can inherit the num_channels from it
|
|
||
| self.num_samples = num_samples | ||
| self.num_channels = num_channels | ||
| self._num_channels = num_channels |
| BasePreprocessorSegment.__init__(self, parent_recording_segment) | ||
| self.parent_recording_segment = parent_recording_segment | ||
| self.num_channels = num_channels | ||
| self._num_channels = num_channels |
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.
draft