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

Kilosort 4 - Algorithm missing fast-spiking units/narrow shaped units #675

Open
msj220001 opened this issue Apr 23, 2024 · 5 comments
Open
Assignees

Comments

@msj220001
Copy link

Describe the issue:

Similar to a previous problem on Kilosort 3.0 (Issue #395 ), Kilosort 4.0 is consistently missing the yellow (Plexon Offline Sorter's GUI) fast-spiking unit even after I've adjusted the parameters a few times.
Kilosort 4.0 is able to detect the green unit every time, which is the only one it finds for channel 6.

What parameters would you recommend I change to detect the yellow unit?

image
image

image

@msj220001
Copy link
Author

msj220001 commented Apr 30, 2024

I've updated the version of Kilosort 4 I'm using to the latest version.

Still having some trouble with finding fast spiking units.

This unit on channel 3 phy (which is equivalent to channel 12 on Plexon Offline Sorter) comes close to looking like a fast spiking unit, but in Plexon Offline Sorter, it is still within the regular spiking unit range. I think it's because it has a larger amplitude which makes it look 'spikier.'
image

Here are the current parameters I'm using:
image

I think this might be due to there not being that many fast-spiking universal templates. Is this reasonable?
Is there a way to manually add universal templates such that there are more fast spiking templates?

@marius10p
Copy link
Contributor

Hi, sorry for the slow response. There is no underlying reason why Kilosort would not be able to detect fast spiking neurons. The universal templates are actually obtained from your own data by default ("templates_from_data = True"). If the fast-spiking neurons have threshold crossings then they will be identified. You can also try templates_from_data = False, which will use predefined templates and then you can be sure there is a fast-spiking template in there. It's also possible that your fast spiking units are just a little too noisy to be identified by Kilosort. You can try other algorithms, but in our experiments in the paper we find that Kilosort is typically much better than other algorithms especially at low amplitudes.

@jacobpennington
Copy link
Collaborator

Another suggestion, I didn't notice before: it looks like you've modified a lot of parameters, some of them in ways that are really not intended. For example, nt = 801 is well outside the normal range we would use (typically 61 or 81). You also should not need to modify x_centers at all, the default of x_centers = None should set a single column of grouping centers (which is what you want for a single shank). The thresholds are set quite high as well. I would recommend resetting all of the parameters to their defaults as a starting point.

@msj220001
Copy link
Author

msj220001 commented May 14, 2024

Thank you! Switching to using the universal templates seems to have worked!

One thing though: I don't know why the units suddenly look cut off in the middle (in phy). I had reset kilosort's gui and then switched to universal templates (templates from data false), so I'm not sure if reseting the gui caused this to happen or if using universal templates does this.
Do you know what might be causing this 'cut off' unit effect?
At first I though it might be the batch size that was too large resulting in each batch being smaller/shorter time segment, but decreasing the batch size (so each batch is longer) didn't do much to reduce how cut off the units were.
image
image
image

@jacobpennington
Copy link
Collaborator

I think it's because you changed nt0min, which sets the expected location of the peak of the waveform. The default of None will probably work better. It may also be related to using nt = 61 with a higher sampling rate, which is effectively shortening the waveforms to be ~1.5ms instead of ~2ms, but that's required for using the default templates.

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

No branches or pull requests

3 participants