forked from JaneliaSciComp/JRCLUST
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sc_auto_FP.m
79 lines (73 loc) · 2.95 KB
/
sc_auto_FP.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
function autoCall = sc_auto( firingRate, vpp, SNR, FP, ISIViolations, IsoDist, firing_std )
SNR_high_thresh = 6;
SNR_low_thresh = 2.5; %for low > SNR > high, check the isolation distance
%SNR_multi_thresh = 2; %Too little signal to be sure of separation from background, useful if uniform firing
FP_single_thresh = 0.03; %(max 0.5%)
FP_ok_thresh = 0.15;
ISIViolations_thresh = 5;
ISIViolations_ok_thresh = 10;
iso_thresh = 100;
firingRate_thresh = 0.05; %in Hz
firing_std_thresh = 0.5;
autoCall = "None";
if firingRate < firingRate_thresh
if( (SNR > SNR_high_thresh) || (FP <= FP_single_thresh) || (ISIViolations <= ISIViolations_thresh) )
autoCall = "single";
return;
else
return;
end
end
if (SNR >= SNR_high_thresh)
% call a single if ISI conditions are met
% check the ISI
if ( (FP <= FP_single_thresh) || (ISIViolations <= ISIViolations_thresh) )
autoCall = "single";
return;
elseif (FP <= FP_ok_thresh)
autoCall = "ok";
else
if firing_std < 0.5*firing_std_thresh
autoCall = "multi";
elseif firing_std < firing_std_thresh
autoCall = "multi/None";
end
end
elseif (SNR >= SNR_low_thresh)
% if isolated, can be a single or ok
if (isnan(IsoDist) || IsoDist > iso_thresh )
if ( (FP <= FP_single_thresh) || (ISIViolations <= ISIViolations_thresh) )
autoCall = "single/ok"; % whether unit is good enough to be single a function of human judged isolation
return;
elseif (FP <= FP_ok_thresh || (ISIViolations <= ISIViolations_ok_thresh))
autoCall = "ok"; % Ok
else
if firing_std < 0.5*firing_std_thresh
autoCall = "multi";
elseif firing_std < firing_std_thresh
autoCall = "multi/None";
end
end
else
% if not isolated, call as a multi/ok if ISI is low enough
% otherwise call as multi if uniform enough
if ( (FP <= FP_ok_thresh) || (ISIViolations <= ISIViolations_ok_thresh))
autoCall = "ok";
else
if firing_std < 0.5*firing_std_thresh
autoCall = "multi";
elseif firing_std < firing_std_thresh
autoCall = "multi/None";
end
end
end
% elseif (SNR >= SNR_multi_thresh)
% % just check for stable firing. If "quite stable" very likely
% % qualifies as a analyzable MUA; otherwise up to curator
% if firing_std < 0.5*firing_std_thresh
% autoCall = "multi";
% elseif firing_std < firing_std_thresh
% autoCall = "multi/None";
% end
end
end