Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KS2 using tetrode channel map #95

Closed
CarloCerquetella opened this issue Aug 5, 2019 · 11 comments · Fixed by #595
Closed

KS2 using tetrode channel map #95

CarloCerquetella opened this issue Aug 5, 2019 · 11 comments · Fixed by #595

Comments

@CarloCerquetella
Copy link

Hello,

I am using microdrives with 8 tetrodes (4 channels each).
I specified in my chanMap that I have 8 groups (one per tetrode), my kcoords is: 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 6 6 6 6 7 7 7 7 8 8 8 8 indeed.
xcoords and ycoords are as following (I don't really know the position of one electrode in relation to the others in the same group)

xcoords: 20 40 60 80 20 40 60 80 20 40 60 80 20 40 60 80 20 40 60 80 20 40 60 80 20 40 60 80 20 40 60 80

ycoords: 20 20 20 20 40 40 40 40 60 60 60 60 80 80 80 80 100 100 100 100 120 120 120 120 140 140 140 140 160 160 160 160

Each tetrode is placed far from the others, so, every event shared by tetrodes can't be a spike and I need to delete them.

I need to see a difference in the amplitude of a spike picked up by a tetrode within the channels belonging to that tetrode.

Is it possible to define these conditions?

Moreover, I have the impression that if a channel is defined as a bad channel, it is removed and all the others channels are reassigned a numeric value, let's say channel 13 is broken. I will not have channels: 0 1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 anymore but 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30. Is it correct?

I would like to have a final structure with no reassigned channels or tetrodes. Is that possible?

Best regards,

Carlo

@marius10p
Copy link
Contributor

What you do in your export scripts is up to you. Different users have different requirements, so we try to provide an output as basic as possible. I do not know why you got the error with mismatched number of spikes. Please check the corresponding fields of rez for the spike times and clusters (st3), and for the PC features.

Also, consider switching to Phy, which is a modern GUI interface for evaluating the results of Kilosort2 and for manual curation. Phy makes it much easier to inspect your data/results closely from lots of different views.

You are correct that bad channels are removed, and you'll have to work your way back with the channel map in the rez file if you want assignments back to the original channels. Alternatively, you could make it not remove channels at all (ops.minfr_goodchannels = 0).

kcoords has not been implemented in Kilosort2 yet, so you'll have to space out your electrodes using xcoords and ycoords. I think you need to change the spacing between ycoords to something much larger, like 100um, if you really think the tetrodes are that far apart from each other.

@CarloCerquetella
Copy link
Author

Dear Dr. Pachitariu,

Perfect, thanks a lot for your quick response! Is there a condition I can set to pick up only units showing a difference in the spike amplitude within the channels belonging to the same tetrode?

Best, Carlo

@chris-angeloni
Copy link

chris-angeloni commented Aug 22, 2019

Hi Carlo, it sounds like KS2 doesn't yet have the functionality to isolate spikes to individual sets of channels, but I use KiloSort2 and phy to sort tetrode arrays, and maybe my process could be helpful.

In general, unless there is a lot of motion noise in the recording, KS2 is really good at finding spikes localized to each tetrode:
isolated_unit

To examine how well spikes are localized to tetrodes, I sort my units by channel:
channel

and use the TemplateView module to verify that spikes are localized to tetrode groups (which you can see here along the diagonal, that there is a sort of "rectangle" for each group of 4 channels (here I have 16 tetrodes):
template-view

Zooming in to template view, it is easy to see that spikes are generally well isolated to each tetrode (with the exception of noise clusters, which are quite obvious in this view and easy to remove, outlined in red):
template_zoom

@nsteinme
Copy link
Collaborator

How sure are you that those circled clusters are 'noise'? the fact that the waveform shape inverts (in the grey-ish one) and goes slowly lower and lower amplitude seems more like an extended neuronal process to me. Is there other evidence? Just curious.

@chris-angeloni
Copy link

chris-angeloni commented Aug 22, 2019

Fairly sure, because these are tetrodes we wouldn't really expect to see the spikes except on the four channels included in the tetrode. In any case, seeing more broadly across the array what these waveforms look like makes it pretty obvious, I think, given that you see widely distributed and fairly symmetrical waveforms:
noise_cluster

(in any case, the grey unit has only 25 spikes which might be from another unit, but I'm not sure it's worth merging)

@nsteinme
Copy link
Collaborator

Yeah, I understood that they were tetrodes. The non-uniform pattern can't really be explained by electrical artifact - I guess you think it is some sort of motion artifact? That is synchronized on a ms timescale with differing signatures across sites? The flipped polarity of the waveforms still strikes me: if you knew the true 3D positions of all these sites in the brain and you computed a current source density, you would conclude there's some current source or sink somewhere in between the tetrodes.

@chris-angeloni
Copy link

chris-angeloni commented Aug 22, 2019

Hmm, that's a good point. I mostly suspect it is a motion artifact because it is something you can see in the raw recording, and we have noticed that when the mouse moves this "noise" will affect some tetrodes more than others.

Note that the original data is rereferenced with a common median across all channels, which could possibly contribute to the inversion and could explain why it affects only certain tetrodes?. Maybe it would be better to do a local rereferencing for each tetrode, but I'd worry that it could remove spikes?

Another alternative is that it is high gamma activity or something? It certainly doesn't look very much like spikes to me

I'd appreciate your input either way!

@nsteinme
Copy link
Collaborator

nsteinme commented Aug 22, 2019 via email

@marius10p
Copy link
Contributor

Issue has become inactive. Closing.

@410pfeliciano
Copy link

Hi Carlo, it sounds like KS2 doesn't yet have the functionality to isolate spikes to individual sets of channels, but I use KiloSort2 and phy to sort tetrode arrays, and maybe my process could be helpful.

In general, unless there is a lot of motion noise in the recording, KS2 is really good at finding spikes localized to each tetrode:
isolated_unit

To examine how well spikes are localized to tetrodes, I sort my units by channel:
channel

and use the TemplateView module to verify that spikes are localized to tetrode groups (which you can see here along the diagonal, that there is a sort of "rectangle" for each group of 4 channels (here I have 16 tetrodes):
template-view

Zooming in to template view, it is easy to see that spikes are generally well isolated to each tetrode (with the exception of noise clusters, which are quite obvious in this view and easy to remove, outlined in red):
template_zoom

Hi angelonc, could you provide the configuration parameters that you use for the 16 tetrodes?

@chris-angeloni
Copy link

chris-angeloni commented Dec 16, 2019

Hi, @410pfeliciano, we really didn't deviate much from the default parameters, but here is how we do it:

The tetrodes are twisted from NiCr wire, then gold plated to approx. 300kOhm. We record using an openEphys acquisition box with openEphys GUI software to flat binary files @ 30kHz.

First, broadband traces are high pass filtered @ 500Hz and rereferenced to the common average median.

Then the only differences in KS are that we don't drop bad channels: ops.minfr_goodchannels = 0;

and we change the thresholds slightly to prevent missing spikes: ops.Th = [10 2];

and changed KS2's internal high pass to 300Hz: ops.fshigh = 300;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants