Skip to content

Commit

Permalink
Merge pull request #2108 from JoeZiminski/fix_kilosort_matlab_default…
Browse files Browse the repository at this point in the history
…_configs

Use versioned kilosort options as default in `skip_preprocessed_data`.
  • Loading branch information
alejoe91 authored Oct 25, 2023
2 parents cf6613f + bbe06ed commit d07738d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
8 changes: 5 additions & 3 deletions src/spikeinterface/sorters/external/kilosort2_5_master.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function kilosort2_5_master(fpath, kilosortPath)
if skip_kilosort_preprocessing
% hack to skip the internal preprocessing
% this mimic the preprocessDataSub() function
fprintf("SKIP kilosort2.5 preprocessing\n");
fprintf("Skipping kilosort2.5 preprocessing\n");

ops.nt0 = getOr(ops, {'nt0'}, 61); % number of time samples for the templates (has to be <=81 due to GPU shared memory)
ops.nt0min = getOr(ops, 'nt0min', ceil(20 * ops.nt0/61)); % time sample where the negative peak should be aligned
Expand All @@ -49,11 +49,13 @@ function kilosort2_5_master(fpath, kilosortPath)
rez.xcoords = xc;
rez.ycoords = yc;
Nbatch = ceil(ops.sampsToRead / ops.NT); % number of data batches
ops.Nbatch = Nbatch;
NTbuff = ops.NT + 3*ops.ntbuff; % we need buffers on both sides for filtering

rez.Wrot = eye(ops.Nchan); % fake whitenning
rez.temp.Nbatch = Nbatch;
% fproc is the same as the binary
% fproc (preprocessed output) is the same as the fbinary (unprocessed input)
% because we are skipping preprocessing.
ops.fproc = ops.fbinary;

rez.ops = ops; % memorize ops
Expand All @@ -62,7 +64,7 @@ function kilosort2_5_master(fpath, kilosortPath)
rez.ops.Nbatch = Nbatch;
rez.ops.NTbuff = NTbuff;

tic; % tocs are coming
tic; % tocs are supplied in other parts of KS code

else
% preprocess data to create temp_wh.dat
Expand Down
12 changes: 7 additions & 5 deletions src/spikeinterface/sorters/external/kilosort2_master.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function kilosort2_master(fpath, kilosortPath)
if skip_kilosort_preprocessing
% hack to skip the internal preprocessing
% this mimic the preprocessDataSub() function
fprintf("SKIP kilosort2.5 preprocessing\n");
fprintf("Skipping kilosort2 preprocessing\n");

ops.nt0 = getOr(ops, {'nt0'}, 61); % number of time samples for the templates (has to be <=81 due to GPU shared memory)
ops.nt0min = getOr(ops, 'nt0min', ceil(20 * ops.nt0/61)); % time sample where the negative peak should be aligned
Expand All @@ -48,12 +48,14 @@ function kilosort2_master(fpath, kilosortPath)
rez.yc = yc;
rez.xcoords = xc;
rez.ycoords = yc;
Nbatch = ceil(ops.sampsToRead / ops.NT); % number of data batches
NTbuff = ops.NT + 3*ops.ntbuff; % we need buffers on both sides for filtering
Nbatch = ceil(ops.sampsToRead /(NT-ops.ntbuff)); % number of data batches
ops.Nbatch = Nbatch;
NTbuff = NT + 4*ops.ntbuff; % we need buffers on both sides for filtering

rez.Wrot = eye(ops.Nchan); % fake whitenning
rez.temp.Nbatch = Nbatch;
% fproc is the same as the binary
% fproc (preprocessed output) is the same as the fbinary (unprocessed input)
% because we are skipping preprocessing.
ops.fproc = ops.fbinary;

rez.ops = ops; % memorize ops
Expand All @@ -62,7 +64,7 @@ function kilosort2_master(fpath, kilosortPath)
rez.ops.Nbatch = Nbatch;
rez.ops.NTbuff = NTbuff;

tic; % tocs are coming
tic; % tocs are supplied in other parts of KS code

else
% preprocess data to create temp_wh.dat
Expand Down
8 changes: 5 additions & 3 deletions src/spikeinterface/sorters/external/kilosort3_master.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function kilosort3_master(fpath, kilosortPath)
if skip_kilosort_preprocessing
% hack to skip the internal preprocessing
% this mimic the preprocessDataSub() function
fprintf("SKIP kilosort2.5 preprocessing\n");
fprintf("Skipping kilosort3 preprocessing\n");

ops.nt0 = getOr(ops, {'nt0'}, 61); % number of time samples for the templates (has to be <=81 due to GPU shared memory)
ops.nt0min = getOr(ops, 'nt0min', ceil(20 * ops.nt0/61)); % time sample where the negative peak should be aligned
Expand All @@ -49,11 +49,13 @@ function kilosort3_master(fpath, kilosortPath)
rez.xcoords = xc;
rez.ycoords = yc;
Nbatch = ceil(ops.sampsToRead / ops.NT); % number of data batches
ops.Nbatch = Nbatch;
NTbuff = ops.NT + 3*ops.ntbuff; % we need buffers on both sides for filtering

rez.Wrot = eye(ops.Nchan); % fake whitenning
rez.temp.Nbatch = Nbatch;
% fproc is the same as the binary
% fproc (preprocessed output) is the same as the fbinary (unprocessed input)
% because we are skipping preprocessing.
ops.fproc = ops.fbinary;

rez.ops = ops; % memorize ops
Expand All @@ -62,7 +64,7 @@ function kilosort3_master(fpath, kilosortPath)
rez.ops.Nbatch = Nbatch;
rez.ops.NTbuff = NTbuff;

tic; % tocs are coming
tic; % tocs are supplied in other parts of KS code

else
% preprocess data to create temp_wh.dat
Expand Down

0 comments on commit d07738d

Please sign in to comment.