SpikeInterface / SpikeInterface/spikeinterface
silence_periods() might have an issue at the very end of a recording
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 847
- Forks
- 280
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 29
Description
Hello everyone!
I have run into an error with silence_periods (in the process of running peak_detection) which only occurs for at least one concatenation of recordings, but appears consistently. the troublesome line is:
" traces[onset:offset, :] = noise[onset:offset]"
Within the "get_traces" function of silence_periods.py
The size of the noise ends up being too small to fit in traces... This happens only for the very last chunk of recording, and in this specific case, it seems to be off by exactly one sample, as shown below.
My recording object, importantly with sample count:
The "end_frame"
I plan to experiment with "just clipping off the errant sample since it is one sample at the end of the recording anyway"; whether this is sufficient will depend on whether the error crops up again.
In any case, thought I might report it! Let me know what can be done to clarify, though the hack solution of:
try:
traces[onset:offset, :] = noise[onset:offset]
except Exception as e:
noiseSize = np.shape(noise)[0]
tracesSize = np.shape(traces)[0]
offset = min(noiseSize,tracesSize)
traces[onset:offset, :] = noise[onset:offset]
is doing okay for now.
Thanks,
Jeff Boucher
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.
Research direction
Start in silence_periods.py, at get_traces and the assignment to traces[onset:offset, :], then follow how peak_detection supplies the final recording chunk. Reproduce the reported concatenated-recording case and compare the noise and traces lengths at the last chunk; the issue is done when that end-of-recording case no longer raises a shape mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100