-
Notifications
You must be signed in to change notification settings - Fork 0
/
bfs.m
52 lines (41 loc) · 1.14 KB
/
bfs.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
fs = [6 8.5 12 17 24 34 48];
% 21 - hc bf0
% 22 - tone bf
for u=1:445
% for hc best
res = [];
h = ephys_rms_match_db{u,19};
for freq=5:11
spikes = ephys_rms_match_db{u,freq};
if isempty(spikes) || h(freq-4) ~= 1 || isnan(h(freq-4))
res = [res -1];
else
res = [res mean( mean(spikes(:,501:570),2) )];
end
end
if sum(res) == -7 % if no significant res to all freqs
ephys_rms_match_db{u,21} = -1;
else
[max_res, idx] = max(res);
bf = fs(idx);
ephys_rms_match_db{u,21} = bf;
end
% for tone best
res = [];
h = ephys_rms_match_db{u,20};
for freq=12:18
spikes = ephys_rms_match_db{u,freq};
if isempty(spikes) || h(freq-11) ~= 1 || isnan(h(freq-11))
res = [res -1];
else
res = [res mean( mean(spikes(:,501:570),2) )];
end
end
if sum(res) == -7 % if no significant res to all freqs
ephys_rms_match_db{u,22} = -1;
else
[max_res idx] = max(res);
bf = fs(idx);
ephys_rms_match_db{u,22} = bf;
end
end