Make `num_channels` available on `BaseRecordingSegment`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start with BaseRecordingSegment.init and BaseRecording.add_recording_segment, then review the listed segment implementations in binaryrecordingextractor.py, generate.py, zero_channel_pad.py, and drift_tools.py. Done means segments receive the parent Recording's channel count automatically and the existing channel-count workarounds can be addressed without changing the public behavior.
Written by the indexing model from the issue text.
Description
Currently BaseRecordingSegment has no concept of channel count. It knows its time dimension (sampling frequency, time vector, num_samples) but not its channel dimension. This forces segment subclasses to work around the limitation in various ways:
Passing num_channels from parent to segment at construction:
BinaryRecordingSegmentNoiseGeneratorRecordingSegmentZeroChannelPaddedRecordingSegmentTracePaddedRecordingSegment
Inferring channel count from data shape:
InjectTemplatesRecordingSegmentinfers from template array shapeDriftingTemplatesRecordingSegmentinfers from template object
Fetching a sample just to get the shape:
ResampleRecordingSegment._get_traces_gappedfetches 1 sample from the parent to determine output channel count (introduced in #4499)
The parent Recording always knows num_channels at the time it calls add_recording_segment. The proposal is to have BaseRecording.add_recording_segment() set num_channels on the segment automatically. This would:
- Give all segments a
num_channelsattribute for free, with the Recording as the single source of truth - Eliminate the need for subclasses to store it independently
- Remove workarounds like 1-sample fetches to get channel count
- Make pre-allocation of output arrays straightforward without fetching data first
The change is small (a few lines in BaseRecordingSegment.__init__ and BaseRecording.add_recording_segment) and fully backwards compatible since existing subclasses that set num_channels themselves would continue to work.
- Dominant language
- Python
- Stars
- 847
- Forks
- 280
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 29
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SpikeInterface/spikeinterface
-
testing
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
SpikeInterface/spikeinterface#4756 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
SpikeInterface/spikeinterface#4745 ·
-
performance
Difficulty 4/5 3-5 days Newbie friendliness 55/100
SpikeInterface/spikeinterface#4787 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
SpikeInterface/spikeinterface#4781 · 1 comment ·
-
performance sorters
Difficulty 4/5 3-5 days Newbie friendliness 30/100
SpikeInterface/spikeinterface#4777 ·
All issues in SpikeInterface/spikeinterface
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
use-agent-os/agent-os#3314 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
BasedHardware/omi#15662 · 1 comment ·
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
AiursoftWeb/AnduinOS-2#19 ·