SpikeInterface / SpikeInterface/spikeinterface
Brodcasting error when saving recording after deep interpolation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 847
- Forks
- 280
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 29
Description
Hi,
I'm having issues with storing the recording object after applying deepinterpolation.
When saving an interpolated recording, I get error messages like:
ValueError: could not broadcast input array from shape (29886,768) into shape (30000,768)
I assume that is because the convolutional network removes samples at the edges of the signal.
What is the recommended way of dealing with this? Should I pad the traces before applying deepinterpolation? If so, is there a function for this? Or would it be better to create a new object for storing the interpolated recording?
Below is a code example. I'm using spikeinterface version 0.100.6 because deepinterpolation requires python <= 3.8
from pathlib import Path
import numpy as np
import spikeinterface.extractors as se
from spikeinterface.preprocessing import common_reference, deepinterpolate, zero_channel_pad
root = Path(__file__).parent.parent.absolute()
model_path = list((root/"model").glob("*"))[0]
recording = se.read_spikeglx( folder_path=root/"data"/"neuropixels")
# pad so dimensions are compatible with model
recording = zero_channel_pad(recording, num_channels=384*2)
# create preprocessing pipeline
recording_cmr = common_reference(recording=recording, operator="median")
recording_deepint = deepinterpolate(recording=recording_cmr, model_path=str(model_path), use_gpu=False)
# process and save
recording_deepint.save()
Thanks in advance!
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 with the deepinterpolate(...) preprocessing entry point and the recording_deepint.save() call in the supplied example. Reproduce the shape mismatch with the shown padding and inspect how the interpolated recording handles sample counts; done means the save path either handles the shortened traces or clearly documents the required recording workflow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100