cortex-lab / KiloSort

GPU code for spike sorting
GNU General Public License v2.0
179 stars 100 forks source link

Explanation of ops #264

Open GoktugAlkan opened 1 year ago

GoktugAlkan commented 1 year ago

Hello,

I am currently using kilosort for sorting spikes in a UTAH array recording. The code already gives good results when using the default parameters. However, I would like to know if there is a more descriptive explanation of the parameters that the sorting algorithm uses. Particularly, I am a bit struggling in understanding the role of the following parameters:

ops.criterionNoiseChannels = 1;                                 % fraction of "noise" templates allowed to span all channel groups (see createChannelMapFile for more info).
% ops.chanMap = 1:ops.Nchan; % treated as linear probe if a chanMap file

% other options for controlling the model and optimization
ops.Nrank               = 3;        % matrix rank of spike template model (3)
ops.nfullpasses         = 6;        % number of complete passes through data during optimization (6)
ops.maxFR               = 20000;    % maximum number of spikes to extract per batch (20000)
ops.fshigh              = 250;      % frequency for high pass filtering
ops.fslow               = 7500;     % frequency for low pass filtering (optional)
ops.ntbuff              = 64;       % samples of symmetrical buffer for whitening and spike detection
ops.scaleproc           = 200;      % int16 scaling of whitened data

ops.NT                  = 32*1024+ ops.ntbuff; % for GPU should be multiple of 32 + ntbuff

% the following options can improve/deteriorate results.
% when multiple values are provided for an option, the first two are beginning and ending anneal values,
% the third is the value used in the final pass.
ops.Th               = [4 10 10];    % threshold for detecting spikes on template-filtered data ([6 12 12])
ops.lam              = [5 20 20];
ops.nannealpasses    = 4;               % should be less than nfullpasses (4)
ops.momentum         = 1./[20 400];     % start with high momentum and anneal (1./[20 1000])
ops.shuffle_clusters = 1;               % allow merges and splits during optimization (1)
ops.mergeT           = .1;              % upper threshold for merging (.1)
ops.splitT           = .1;              % lower threshold for splitting (.1)

% options for initializing spikes from data
ops.initialize      = 'no';     %'fromData' or 'no'
ops.spkTh           = -4;       % spike threshold in standard deviations (4)
ops.loc_range       = [3  1];   % ranges to detect peaks; plus/minus in time and channel ([3 1])
ops.long_range      = [30  6];  % ranges to detect isolated peaks ([30 6])
ops.maskMaxChannels = 5;        % how many channels to mask up/down ([5])
ops.crit            = .65;      % upper criterion for discarding spike repeates (0.65)
ops.nFiltMax        = 10000;    % maximum "unique" spikes to consider (10000)

Note that the comments next to the parameters are the comments that have already been there when I installed kilosort. It would be very helpful if there was a description of the algorithm where one can directly see the incorporation of these parameters.

If I understood all parameters better, I could improve the settings with respect to the characteristics of our recording.

Many thanks in advance!