spikeinterface: calling aggregate_channels returned AttributeError
Dear Spikeinterface community I was hoping to correct drift/motion and run spike sorting shank by shank for our 4-shank probe. I followed this tutorial and was able to run those analysis. However, when I called the function to aggregate those object together, I bumped into this error.
Traceback (most recent call last): File “<string>”, line 1, in <module> File “c:\Users\einat\anaconda3\envs\spike_interface\lib\site-packages\spikeinterface\core\channelsaggregationrecording.py”, line 217, in aggregate_channels return ChannelsAggregationRecording(recording_list, renamed_channel_ids) File “c:\Users\einat\anaconda3\envs\spike_interface\lib\site-packages\spikeinterface\core\channelsaggregationrecording.py”, line 20, in init self._perform_consistency_checks() File “c:\Users\einat\anaconda3\envs\spike_interface\lib\site-packages\spikeinterface\core\channelsaggregationrecording.py”, line 104, in _perform_consistency_checks sampling_frequencies = [rec.get_sampling_frequency() for rec in self.recordings] File “c:\Users\einat\anaconda3\envs\spike_interface\lib\site-packages\spikeinterface\core\channelsaggregationrecording.py”, line 104, in <listcomp> sampling_frequencies = [rec.get_sampling_frequency() for rec in self.recordings] AttributeError: ‘numpy.int64’ object has no attribute ‘get_sampling_frequency’
I have tried to change the class type into float32 but still received the same error. Does anyone know how to fix this?
Below is the code I used:
raw_rec = se.read_openephys(oe_folder, load_sync_timestamps=True)
fs = raw_rec.get_sampling_frequency()
stacked_probes = pi.read_probeinterface("H10_stacked_probes.json")
probe = stacked_probes.probes[0]
raw_rec = raw_rec.set_probe(probe,group_mode='by_shank')
probe_rec = raw_rec.get_probe()
probe_rec.to_dataframe(complete=True).loc[
raw_rec = spre.astype(raw_rec, "float32")
raw_rec_dict = raw_rec.split_by(property='group', outputs='dict')
recording_corrected = si.aggregate_channels(raw_rec_dict)
And here is what I have in the raw_rec_dict
{0: ChannelSliceRecording: 32 channels - 30.0kHz - 1 segments - 25,237,540 samples …(14.02 minutes) - float32 dtype - 3.01 GiB, 1: ChannelSliceRecording: 32 channels - 30.0kHz - 1 segments - 25,237,540 samples …(14.02 minutes) - float32 dtype - 3.01 GiB, 2: ChannelSliceRecording: 32 channels - 30.0kHz - 1 segments - 25,237,540 samples …(14.02 minutes) - float32 dtype - 3.01 GiB, 3: ChannelSliceRecording: 32 channels - 30.0kHz - 1 segments - 25,237,540 samples …(14.02 minutes) - float32 dtype - 3.01 GiB}
Operation System: Windows 11, spikeinterface 0.102.1 and 0.101.2 under python 3.10 In case it is my probe being too complicated. I have attached the probe info here
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (6 by maintainers)
Thanks, then I will let you close this issue! Yes, on one hand, I was hoping to do spike sorting for multi-shank probes just based on the position of channels on the probe map, without splitting channels shank by shank. On the other hand, thinking about that the physical distance between channels, across shanks is not as accurate as within shanks, it is a good idea to analyze the data shank by shank. These new features will certainly make things much easier and encourage researchers to take this approach!
Haha @chiyu1203 you’re finding all the edge cases I’m currently trying to fix!!! There are two preprocessing steps which aren’t implemented like the others: motion correction and bad channel removal. We’re in the middle of turning these into classes (for bad channel removal: #3685) and then you’ll be able to pass dictionaries of recordings to them! We also need to add a
savefunction for dicts of recordings.For now, you need to do a manual splitting to correct motion, then aggregate at the end. I’ll ping you once the new features are added!
I’m tagging @alejoe91 @samuelgarcia so they see that there’s high demand (well, some demand) for these features!