-
Notifications
You must be signed in to change notification settings - Fork 15
/
kilosortMasterPhase3A.m
34 lines (26 loc) · 1.2 KB
/
kilosortMasterPhase3A.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
% default options are in parenthesis after the comment
addpath(genpath('[set this path]\github\KiloSort')) % path to kilosort folder
addpath(genpath('[set this path]\github\npy-matlab')) % path to npy-matlab scripts
pathToYourConfigFile = '[set this path]'; % take from Github folder and put it somewhere else (together with the master_file)
run(fullfile(pathToYourConfigFile, 'kilosortConfigPhase3A.m'))
tic; % start timer
%
if ops.GPU
gpuDevice(1); % initialize GPU (will erase any existing GPU arrays)
end
if strcmp(ops.datatype , 'openEphys')
ops = convertOpenEphysToRawBInary(ops); % convert data, only for OpenEphys
end
%
[rez, DATA, uproj] = preprocessData(ops); % preprocess data and extract spikes for initialization
rez = fitTemplates(rez, DATA, uproj); % fit templates iteratively
rez = fullMPMU(rez, DATA);% extract final spike times (overlapping extraction)
% AutoMerge. rez2Phy will use for clusters the new 5th column of st3 if you run this)
% rez = merge_posthoc2(rez);
% save matlab results file
save(fullfile(ops.root, 'rez.mat'), 'rez', '-v7.3');
% save python results file for Phy
rezToPhy(rez, ops.root);
% remove temporary file
delete(ops.fproc);
%%