-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot_ppool.m
More file actions
164 lines (149 loc) · 4.4 KB
/
plot_ppool.m
File metadata and controls
164 lines (149 loc) · 4.4 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
%fileName = './Data/cond_1_08171247';
%load(fileName);
nsim = length(p_pool);
condnames = {'B/A','B/iA','P/A','P/iA','SR/A','SR/iA','R/A','R/iA'};
layernames = {'L. Monocular', 'R. Monocular', 'Summation', 'L-R Opponency', 'R-L Opponency'};
subplotlocs = [4 6 2 1 3]; %on a 2x3 plot
%% Dominance duration: this is for the experiment that vary contrasts
% for i = 1:nsim
% domDuration(i,:) = p_pool{i}.Idx_domD;
% contrast(i,:) = p_pool{i}.contrast;
% fraction(i) = domDuration(i,2) / sum(domDuration(i,:));
% end
% domDuration(isnan(domDuration)) = 0;
% cpsFigure(.5,.5)
% plot(fraction, domDuration(:,1), '-o',fraction, domDuration(:,2) ,'-o')
% % ylim([0 10])
% % xlim([0 1])
% xlabel('Fraction B','FontSize',14)
% ylabel('Mean duration (s)','FontSize',14)
% legend({'A: fixed','B: varied'})
%
% cpsFigure(.5,.5)
% plot(contrast(:,2), domDuration(:,1), '-o',contrast(:,2), domDuration(:,2) ,'-o')
% ylim([0 10])
% %xlim([0 1])
% xlabel('Contrast B','FontSize',14)
% ylabel('Mean duration (s)','FontSize',14)
% legend({'A: fixed','B: varied'})
%
% cpsFigure(.5,.5)
% plot(contrast(:,2), fraction,'-o')
% ylim([0 1])
% %xlim([0 1])
% xlabel('Contrast B','FontSize',14)
% ylabel('Fraction B','FontSize',14)
% legend({'B: varied'})
%% Dominance duration
cpsFigure(.6*nsim,.6);
for i = 1:nsim
subplot(1,nsim,i)
hist(p_pool{i}.durationDist,100);
end
tightfig;
%% Rivalry Idx curves
cpsFigure(.6*nsim,.6);
xa = (1:p_pool{1}.epochlength-1)-p_pool{1}.epochlength/2;
xa = xa/1000;
for i = 1:nsim
subplot(1,nsim,i)
plot(xa,p_pool{i}.aSignal,'LineWidth',1.2);hold on;
plot(xa,p_pool{i}.rSignal,'k','LineWidth',1.2);
xlim([min(xa) max(xa)])
end
%%
cpsFigure(.6*nsim,.6);
Idx_rivalry = nan(1,nsim);
for i = 1:nsim
Idx_rivalry(i) = p_pool{i}.Idx_rivalry;
end
subplot(1,5,1)
bar(Idx_rivalry);
title('Rivalry Index')
Idx_wta = nan(1,nsim);
for i = 1:nsim
Idx_wta(i) = p_pool{i}.Idx_wta;
end
subplot(1,5,2)
bar(Idx_wta);
title('WTA Index')
Idx_diff = nan(1,nsim);
for i = 1:nsim
Idx_diff(i) = p_pool{i}.Idx_diff;
end
subplot(1,5,3)
bar(Idx_diff);
title('diff Index')
Idx_ratio = nan(1,nsim);
for i = 1:nsim
Idx_ratio(i) = p_pool{i}.Idx_ratio;
end
subplot(1,5,4)
bar(Idx_ratio);
title('ratio Index')
Idx_mean = nan(1,nsim);
for i = 1:nsim
Idx_mean(i) = p_pool{i}.Idx_mean;
end
subplot(1,5,5)
bar(Idx_mean);
title('mean Index')
%tightfig;
%%
pIdx = 2;
tplot = 1:10000;
cpsFigure(2,.8);
set(gcf,'Name',sprintf('%s contrast: %1.2f %1.2f', condnames{p_pool{pIdx}.cond}, p_pool{pIdx}.contrast(1), p_pool{pIdx}.contrast(2)));
for lay = 1:p_pool{1}.nLayers
subplot(2,3,subplotlocs(lay))
cla; hold on;
temp1 = squeeze(p_pool{pIdx}.r{lay}(1,tplot));
temp2 = squeeze(p_pool{pIdx}.r{lay}(2,tplot));
pL = plot(p_pool{pIdx}.tlist(tplot)/1000,temp1,'color',[1 0 1]);
pR = plot(p_pool{pIdx}.tlist(tplot)/1000,temp2,'color',[0 0 1]);
ylabel('Firing rate')
xlabel('Time (s)')
title(layernames(lay))
%set(gca,'XLim',[0 p.T(tplot)/1000]);
set(gca,'YLim',[0 max([temp1(:)' temp2(:)'])+.1]);
drawnow;
end
subplot(2,3,5)
plot(p_pool{pIdx}.tlist(tplot)/1000,p_pool{pIdx}.att(1,tplot),'color',[1 0 1]); hold on;
plot(p_pool{pIdx}.tlist(tplot)/1000,p_pool{pIdx}.att(2,tplot),'color',[0 0 1]);
title('Attention')
% Draw time sereis_2
cpsFigure(1,1.5);
set(gcf,'Name',sprintf('%s contrast: %1.1f %1.1f', condnames{p_pool{1}.cond}, p_pool{pIdx}.contrast(1), p_pool{pIdx}.contrast(2)));
%To view the two rivarly time series
subplot(3,1,1);hold on
title('LE & RE')
for lay = 1:2
temp1 = squeeze(p_pool{pIdx}.r{lay}(1,tplot));
temp2 = squeeze(p_pool{pIdx}.r{lay}(2,tplot));
switch lay
case 1
plot(p_pool{pIdx}.tlist(tplot)/1000, temp1,'r-','LineWidth',1.5)
case 2
plot(p_pool{pIdx}.tlist(tplot)/1000, temp2,'b--','LineWidth',1)
end
set(gca,'FontSize',12)
end
%Left eye
subplot(3,1,2);hold on
title('LE')
lay=1;
temp1 = squeeze(p_pool{pIdx}.r{lay}(1,tplot));
temp2 = squeeze(p_pool{pIdx}.r{lay}(2,tplot));
plot(p_pool{pIdx}.tlist(tplot)/1000, temp1,'r-','LineWidth',1.5)
plot(p_pool{pIdx}.tlist(tplot)/1000, temp2,'b-','LineWidth',1.5)
%Right eye
subplot(3,1,3);hold on
title('RE')
lay=2;
temp1 = squeeze(p_pool{pIdx}.r{lay}(1,tplot));
temp2 = squeeze(p_pool{pIdx}.r{lay}(2,tplot));
plot(p_pool{pIdx}.tlist(tplot)/1000, temp1,'r:','LineWidth',1)
plot(p_pool{pIdx}.tlist(tplot)/1000, temp2,'b:','LineWidth',1)
xlabel('Time (sec)', 'FontSize',12)
drawnow;