-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexperiment.m
100 lines (79 loc) · 2.16 KB
/
experiment.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
freqs = [6, 8.5, 12, 17, 24, 34];
data = cell(11, 2);
for u=1:445
if ephys_rms_match_db{u,21} == - 1 || ephys_rms_match_db{u,22} == -1 || ephys_rms_match_db{u,21} == 48 || ephys_rms_match_db{u,22} == 48
continue
end
bfi = find(freqs == ephys_rms_match_db{u,22});
for f=12:17
r = mean(ephys_rms_match_db{u,f}(:,301:1000), 1);
r1 = mean(reshape(r, 50, 700/50), 1);
r2 = r1./max(r1);
rebf = ((f-11) - bfi)*0.5;
rebf_index = 6 + rebf*2;
data{rebf_index,1} = [data{rebf_index,1}; r2];
end % end of f
spont = [];
for f=5:18
r = ephys_rms_match_db{u,f}(:, 301:1000);
r1 = reshape(mean(reshape(r, size(r,1),50,700/50), 2), size(r,1),14);
r1s = mean(r1(:, 1:4), 2);
r1s0 = reshape(r1s, length(r1s),1);
spont = [spont; r1s0];
end
for f=12:17
h_matrix = zeros(length(6:14),1);
r = ephys_rms_match_db{u,f}(:, 301:1000);
r1 = squeeze(mean(reshape(r, size(r,1),50,700/50), 2));
for i=6:14
h_matrix(i-5,1) = ttest2(spont, r1(:,i));
end
rebf = ((f-11) - bfi)*0.5;
rebf_index = 6 + rebf*2;
data{rebf_index,2} = [data{rebf_index,2} h_matrix];
end
end
%%
for re=1:11
data{re,2} = data{re,2}';
end
%%
for re=1:11
figure
imagesc(data{re,1})
hold on
for r=1:size(data{re,2},1)
for c=1:size(data{re,2},2)
if data{re,2}(r,c) == 1
plot(c+5,r, 'marker','x','color','red')
end
end
end
grid
end
%%
re = 6;
figure
imagesc(data{re,1})
grid
%%
num_start = zeros(5,9); % 5 rebf, 9 bins
for re=6:10
h_vals = data{re,2};
for u=1:size(h_vals,1)
h_unit = h_vals(u,:);
h1_at = find(h_unit == 1);
if ~isempty(h1_at)
h1_at = h1_at(1);
num_start(re-5,h1_at) = num_start(re-5,h1_at) + 1;
end
end
num_start(re-5,:) = num_start(re-5,:)./size(h_vals,1);
end
% figure
% imagesc(num_start)
% grid
for re=1:5
figure
bar(num_start(re,:))
end