Channel maps for tetrode arrays
See original GitHub issueIn the past, we have used Kilosort2 to do sorting. Because we are using 64 channel tetrodes, and the recommendations from Kilosort is to give each tetrode a different kcood
and somewhat disregard the xcoods
and ycoords
, we have used this type of channel map.
# in kilosort, Wilson Lab has been using this channel map
n_tetrodes = 16
# x placement is codified as different for each wire of tetrode
xcoords = np.tile(np.arange(4) + 1, n_tetrodes)
# y placement is the same for each wire of each tetrode, different between tetrodes
ycoords = np.repeat(np.arange(n_tetrodes) + 1, 4)
# same kcoords for each tetrode
kcoords = ycoords
# chanMap
chanMap = np.arange(1,n_tetrodes*4 + 1)
chanMap0ind = chanMap - 1
# preview array (first 2 tetrodes)
print(np.array([xcoords, ycoords, kcoords]).T[:8, :])
[[1 1 1]
[2 1 1]
[3 1 1]
[4 1 1]
[1 2 2]
[2 2 2]
[3 2 2]
[4 2 2]]
Following the Probe generator example in the probeinterface
documentation here, I tried:
# Genearate our tetrodes
total_tetrodes = int(len(recording.get_channel_ids())/4)
probegroup = ProbeGroup()
for i in range(total_tetrodes):
tetrode = generate_tetrode()
tetrode.set_device_channel_indices(np.arange(4) + i * 4)
probegroup.add_probe(tetrode)
These produce qualitatively similar channel map outputs. Although xy
positions are different, I’m not sure if they are being used at all for the sorters (and we actually can’t have certainty given tetrode array).
I am trying to understand what is going to happen with the
xy
andkcoords
in the different sorters.
What I noticed is that when calling:
recording_tetrodes = recording_sub.set_probegroup(probegroup, group_mode='by_probe')
# slice the recordings by tetrodes
recordings = recording_tetrodes.split_by(property='group')
The recording will get split and passed with channel maps that are only 4 channels. This generates one folder per tetrode. With data subsamples, I have had Kilosort fail nastly (likely because of finding no spikes in particular tetrodes in short subsets), which ruins all other sorted tetrodes and also crushes the Jupyter notebook.
I was wondering if there are ways to pass the 64 x n
matrix instead of 16 4 x n
matrices to prevent these failures. I am also wondering if the different sorters (e.g., tridesclous
, mountainsort4
) would use the channel maps in similar ways.
- Should I generate tetrodes using the
ProbeGroup()
and the suggestedfor
loop or is there a way to use our previous channel maps, supplying them vianp.array
?.
By the way, Kilosort2 failures mentioned here were also found when using simulated data, for example, when trying to reproduce this example. If splitting by tetrode, I only managed to run it with Kilosort when increasing the number of units (to 50 units) and the duration (to at least 300 secs). Not sure this example applies to channel maps, because toy_example()
provides a channel map with xy
positions separated in a line (which would be not the reality with tetrodes).
Running the toy example in mountainsort4
with 50 units on the ground truth. The tetrode split finds 77 units, while the “all-together” version finds 70. I guess one would be able to manually curate this, but I am curious as to what is the way to go about this. I can provide a jupyter notebook that is basically an expansion of the one in the docs named plot_3_sorting_by_group
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
I am not totally sure what kcoords is in KS. I guess it is simply the grouping.
Almost all sorter use coordinates. Theses coordinate are mostly used for neightboors. There are supposed to be micrometer. If you have true wire tetrode, you can use
generate_tetrode()
which in fact make a small circle. You could also use manual linear coordinate like you do.The grouping in spikeinterface by default is done on probe (and so tetrode here). Every group will be sorted independantly.
If you have planar silicon multi tetrode. Another possibility (which I would recommend) is to provide the full probe description with 64 channels. Depending the spacing, you will see that you can have some units that impact severalgroup between tetrode, so it make sens to sort globaly. Furthermore if you use one only unique probe, you will be able to use spikeinterface-gui and see in one shot the global output sorted at once. Then it will be quite easy so see if some units have impact one differents tetrode. If you do this, please use the true micrometers coordinate. If you have a cambridge neurotec probe, then your probe should be available with
get_probe()
. If it is a neuronexus one, you will need to make you own mapping because we don’t have yet the probe library.Feel free to send notebook for more discussion.
@matiasandina
Closing this for now, feel free to reopen or open another issue if you have other questions!