question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Channel maps for tetrode arrays

See original GitHub issue

In 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 and kcoords 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 suggested for loop or is there a way to use our previous channel maps, supplying them via np.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:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
samuelgarciacommented, Feb 8, 2022

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.

0reactions
alejoe91commented, Oct 13, 2022

@matiasandina

Closing this for now, feel free to reopen or open another issue if you have other questions!

Read more comments on GitHub >

github_iconTop Results From Across the Web

KS2 using tetrode channel map · Issue #95 - GitHub
Hello, I am using microdrives with 8 tetrodes (4 channels each). I specified in my chanMap that I have 8 groups (one per...
Read more >
The design of 512-channel tetrode arrays for brain-wide neural...
New method We established a novel 3D-printed multi-drive system with high-density (up to 256 channels) tetrodes/grid electrodes that enables us to record ...
Read more >
Cross-channel correlations in tetrode recordings
Our observations [2] show that noise in tetrode recordings in the cat visual cortex and in the LGN is highly correlated across channels...
Read more >
the DISC electrode array - bioRxiv
The directional and scalable electrode array (DISC), designed to ... Heat map also ... tetrode comparing only 4 channels of information.
Read more >
Construction of Microdrive Arrays for Chronic Neural ... - NCBI
The main advantage of using tetrodes is that they allow signals from putative individual neurons to be triangulated between several recording ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found