MouseLand / Kilosort

Fast spike sorting with drift correction
https://kilosort.readthedocs.io/en/latest/
GNU General Public License v3.0
488 stars 247 forks source link

BUG: Odd merging behavior #801

Closed Lathomas42 closed 1 month ago

Lathomas42 commented 1 month ago

Describe the issue:

I am not sure this is a bug, or something wonky with parameters, but I am seeing a reoccurring pattern, and would like to know what parameters to tweak to fix this. After sorting, I will have units that look like this in phy, which, I would consider noise based on the ISI plot alone KSBUG_01 And, as you can see by the feature view, there appears to be one main cluster, and a lot around that. If i just crudely go and isolate the main cluster, the ISI plot changes dramatically. KSBUG_02 I am wondering if there is a parameter i can tune to prevent this kind of merging from happening?

Changed Parameters from default: settings['nearest_chans'] = 16 settings['batch_size'] = 30000*4 # 4s of data settings['dminx'] = 18.5

Reproduce the bug:

No response

Error message:

No response

Version information:

KSVersion: up to comit ddb16d12d06355ee727531e7a3130ed387a9b272 OS: Ubuntu 20.04 GPU: 1080Ti Probe: Cambridge Neuro 2 shank 64 channels (shanks sorted individually)

jacobpennington commented 1 month ago

This looks like a recording artifact that will need to be removed prior to sorting. If you know what is causing it, you should try to remove that from the data yourself. You could also try using the artifact_threshold parameter in KS4, but that will simply zero out the whole batch where those big fluctuations occur, which may not be ideal.

Lathomas42 commented 1 month ago

By "remove it" do you mean zero out the parts of the data where that is occurring? would that be sufficient?

jacobpennington commented 1 month ago

That's one option, yes. That's what the artifact_threshold parameter does, but it's sort of a last-resort method. Ideally you would apply some kind of filtering or other operation that removes the noise without affecting the rest of the data, but that may or may not be possible and requires knowledge of what's causing it. How you deal with that is up to you.

Lathomas42 commented 1 month ago

Thank you.