Kilosort icon indicating copy to clipboard operation
Kilosort copied to clipboard

Parameters suggestion for short probes

Open chiyu1203 opened this issue 7 months ago • 2 comments

Dear Kilosort community, I have been using CambridgeNeurotech H- and P-series probes to do acute recording (typically around 1 hour) in head-fixed insects. In this particular issue, I would like to ask for advice on the kilosort4 parameters for a 32-channel 2-shank probes. Below is the diagram of the probe and GUI.

Image

I have read through issues about tuning parameters for such a short probe such as #686, #896 #892 #831 so my general approach to this issue has been

  1. set nblocks = 0 to disable drift correction;
  2. increase batch_size = 180000 to account for low number of channels (the sampling frequency is 30000);
  3. set dminx = 22.5, the horizontal spacing between contacts;
  4. set nearest_templates = 16 to account for the fact that there are 16 channels on each shank.

[Note: I use kilosort ver. 4.0.37 and sort out units from the two shanks altogether] This set of parameters seems to work fine when the recording is good enough (what I meanted by work fine is that I usually expect 1 or 2 units in a recording session and the kilosort would classifiy 10-30 putatitive units (ids), the number that I can still merge and split on phy afterwards). However, recently I have a recording session where kilosort sorted out more than 100 ids and classified nearly half of them to be good. Although there are good units among them, they are usually those with fewer spikes, which is probably how they pass the acg threshold easily. For example,

Image

Image

On the other hand, there are other id with weird mean waveform, which seems to come from units mixing up with noises. And the labels good and mua are not longer informative. For example, Image Image Image This gave me some hope that there are good units mixed up with noises and by tuning some other parameters, I would be able to improve the quality of spike sorting in this dataset. So far, what I have tried is

  1. increase batch_size to 300000 (10s);
  2. increase the highpass_cutoff to 600;
  3. increase the Th (univerisal) and/or Th (learned) by 1 or 2;
  4. reduce the max_channel_distance to 16;
  5. even reduce the whitening_range to 16.

I have also used the default setting (except for keeping drift correction off). However, none of them improved sorting quality dramatically.

Below are the log and diagnostics files from some of the testings.

Use default settings kilosort4.log Image

'batch_size': 180000, 'dminx': 22.5, 'nearest_templates': 16, 'max_channel_distance': 16.0, kilosort4.log Image

'batch_size': 300000, 'dminx': 22.5, 'nearest_templates': 16, 'max_channel_distance': 16.0, 'Th_universal': 11.0, 'highpass_cutoff': 600.0, kilosort4.log Image

'batch_size': 300000, 'dminx': 22.5, 'nearest_templates': 16, 'max_channel_distance': 16.0, 'Th_universal': 11.0, 'Th_learned': 10.0, 'highpass_cutoff': 600.0, 'whitening_range': 16, kilosort4.log Image

Could anyone please give me guidance about what to do next with those parameters, or more generally potential issues in the recording with this kind of short probes? I would be happy to provide a snippet of the recording if that helps. Many thanks in advance!

chiyu1203 avatar Jun 02 '25 17:06 chiyu1203

It's hard to say much from this, other than it looks like you have two pretty clearly separated groups of units: ones with higher spike counts and low amplitude, and ones with high amplitude but lower spike counts (on average). If you can look at those in Phy and see that one group is noise while the other is neural, then that's a pretty clear indication that the noise in your recording is interfering with clustering. Tinkering with KS4 parameters is not going to fix that, you would need to do something else to remove that noise from the recording (if possible) prior to sorting.

jacobpennington avatar Jun 10 '25 19:06 jacobpennington

I see! Thank you very much for your suggestions. I will try to reduce the noise first

chiyu1203 avatar Jun 20 '25 21:06 chiyu1203