forked from cortex-lab/KiloSort
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_weak_detect.m
36 lines (25 loc) · 736 Bytes
/
test_weak_detect.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
35
ops.spkTh = -4;
ops.loc_range = [3 1];
ops.long_range = [30 6];
ops.maskMaxChannels = 5;
ops.crit = .1;
ops.nFiltMax = 10000;
dd = load('PCspikes.mat');
ops.wPCA = dd.Wi;
%%
tic
% find isolated spikes
[row, col, mu] = isolated_peaks(S1, loc_range, long_range, Th);
% find their PC projections
uS = get_PCproj(S1, row, col, wPCA, maskMaxChannels);
% merge in with existing templates
[nSnew, iNonMatch] = merge_spikes_in(uBase(:,1:ncurr,:), nS(1:ncurr), uS, crit);
nS(1:ncurr) = nS(1:ncurr) + nSnew;
% reduce non-matches
[uNew, nSadd] = reduce_clusters(uS(:,iNonMatch,:), crit);
% add new spikes to list
uBase(:, ncurr + [1:size(uNew,2)], :) = uNew;
nS(ncurr + [1:size(uNew,2)]) = nSadd;
ncurr = ncurr + size(uNew,2);
toc
%%