flatironinstitute/mountainsort5

channel locations for spike sorting

Closed this issue · 8 comments

I'm wanting to use ms5 for spike sorting but I'm running into the following error with data collected using openephys.

Exception                                 Traceback (most recent call last)
Cell In[8], line 8
      4 # need to sort the recording to continue!
      5 # 1. Build singularity continaer for matlab
      6 # 2. Run Sorter
      7 folder = "sorter_output"
----> 8 sorting = ms5.sorting_scheme1(
      9     recording["clean_data"],
     10     sorting_parameters = ms5.Scheme1SortingParameters(detect_channel_radius=0,
     11                                                      snippet_mask_radius = 0))

File ~/.conda/envs/spike_sort/lib/python3.10/site-packages/mountainsort5/schemes/sorting_scheme1.py:41, in sorting_scheme1(recording, sorting_parameters)
     38 N = recording.get_num_frames()
     39 sampling_frequency = recording.sampling_frequency
---> 41 channel_locations = recording.get_channel_locations()
     43 print(f'Number of channels: {M}')
     44 print(f'Number of timepoints: {N}')

File ~/.conda/envs/spike_sort/lib/python3.10/site-packages/spikeinterface/core/baserecordingsnippets.py:305, in BaseRecordingSnippets.get_channel_locations(self, channel_ids, axes)
    303 locations = self.get_property('location')
    304 if locations is None:
--> 305     raise Exception('There are no channel locations')
    306 locations = np.asarray(locations)[channel_indices]
    307 return select_axes(locations, axes)

Exception: There are no channel locations

I was looking at early documentation and I thought setting radius to 0 would let me move past this, but it doesn't. Is there anything I can do to get this information or by-pass this requirement?

Hi @skyetomez, I think the BaseRecording should have a set_channel_locations() function, or something similar, that you could use to set them all to (0, 0). Could you look into that? If you don't find anything, I'll take a look.

Thank you @magland I can do that. I wasn't sure what these location data would look like. Is it just a list of tuples?

  • It takes a list of tuples.

Before I close this, do you know how one would go about recovering the channel locations from a probe? We custom make our probes in our lab so these physical locations are rather difficult to determine.

Sure thing @magland . My goal is to use Scheme3 sorting with this openephys tetrode data. The problem is that we recorded using probes that we made in lab and I've been told that the channel locations are not something we'd easily recover.

Hi @magland . I've been thinking about this phrase. "sure to sort each tetrode separately." How would this be done? I'm thinking I'd have to group the channels by tetrode and then sort based on these groups. Is this what you mean?

Yes, you need to group the electrodes by tetrode, and then extract out the sub-recording for each tetrode... I believe it's the recording.channel_slice(...) function from spikeinterface... and then run the sorting on each of those sub-recordings. You'll have a different sorting object for each tetrode.