-
Notifications
You must be signed in to change notification settings - Fork 260
Add num_channels to BaseRecordingSegment
#4526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,7 +173,7 @@ def __del__(self): | |
| class BinaryRecordingSegment(BaseRecordingSegment): | ||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the same reason, we can drop this IMO. Segments will always be added to a parent extractor and can inherit the |
||
| self.dtype = np.dtype(dtype) | ||
| self.file_offset = file_offset | ||
| self.time_axis = time_axis | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1359,7 +1359,7 @@ def __init__( | |
| BaseRecordingSegment.__init__(self, sampling_frequency=sampling_frequency) | ||
|
|
||
| self.num_samples = num_samples | ||
| self.num_channels = num_channels | ||
| self._num_channels = num_channels | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
| self.noise_block_size = noise_block_size | ||
| self.noise_levels = noise_levels | ||
| self.cov_matrix = cov_matrix | ||
|
|
@@ -2075,9 +2075,9 @@ def get_traces( | |
| channel_indices: list | None = None, | ||
| ) -> np.ndarray: | ||
| if channel_indices is None: | ||
| n_channels = self.templates.shape[2] | ||
| n_channels = self.num_channels | ||
| elif isinstance(channel_indices, slice): | ||
| stop = channel_indices.stop if channel_indices.stop is not None else self.templates.shape[2] | ||
| stop = channel_indices.stop if channel_indices.stop is not None else self.num_channels | ||
| start = channel_indices.start if channel_indices.start is not None else 0 | ||
| step = channel_indices.step if channel_indices.step is not None else 1 | ||
| n_channels = math.ceil((stop - start) / step) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,7 +103,7 @@ def __init__( | |
| ): | ||
| BasePreprocessorSegment.__init__(self, parent_recording_segment) | ||
| self.parent_recording_segment = parent_recording_segment | ||
| self.num_channels = num_channels | ||
| self._num_channels = num_channels | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
| self.same_along_dim_chans = same_along_dim_chans | ||
| self.n_chans_each_pos = n_chans_each_pos | ||
| self._dtype = dtype | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the segments are supposed to be added with the
BaseExtractor.add_segment(), which always registers theself._parent_extractorweakref available asself.parent_extractorproperty, I wonder whether we need any of this?@h-mayorquin any place in mind where this won't work?