-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdisplay_secondlayer.m
160 lines (143 loc) · 3.76 KB
/
display_secondlayer.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
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
function display_secondlayer(D,model,fig,spacing)
if nargin < 3
fig=1;
end
Acoords = model.Acoords;
if nargin < 4
% rescale Acoords
for i = 1:4
Acoords(i,:) = Acoords(i,:) - min(Acoords(i,:));
Acoords(i,:) = Acoords(i,:)/max(Acoords(i,:));
end
xyspace = 1.25;
fxspace = 1.25;
else
xyspace = spacing(1);
fxspace = spacing(2);
end
spacing = .015;
[L M]=size(D);
if floor(sqrt(M))^2 ~= M
m=ceil(sqrt(M/2));
n=M/m;
else
m=sqrt(M);
n=m;
end
% Remove BF with very low spatial frequency (removes mean)
% v = sqrt(sum(Acoords(3:4,:).^2));
% inds = find(v>.07);
% D=D(inds,:); Acoords=Acoords(:,inds);
% array=-ones(buf+n*(sz+buf),buf+m*(sz+buf));
sfigure(fig);
clf
colormap(cjet)
sfigure(fig+1);
clf
colormap(cjet)
% plot x-y display
% xyspace = 27;
k=1;
xCoords = [];
yCoords = [];
Dvals = [];
for c=1:m
for r=1:n
% subp(m,n,c+(r-1)*n,spacing);
% subplot(m,n,c+(r-1)*n)
hval = max(abs(D(:,k)));
[vals order] = sort(abs(D(:,k)),'descend');
xCoords = [xCoords (Acoords(1,order)+c*xyspace)];
yCoords = [yCoords (Acoords(2,order)-r*xyspace)];
Dvals = [Dvals (D(order,k)./hval)'];
% scatter(Acoords(1,order),Acoords(2,order),50,D(order,k),'filled'), axis square off
% axis([0 21 0 21])
% caxis([-1 1]*hval);
k=k+1;
end
end
sfigure(fig);
set(gcf,'Color','k')
set(gcf,'inverthardcopy','off')
subp(1,1,1,spacing);
scatter(xCoords,yCoords,50,Dvals,'filled'), axis equal off
% plot vx-vy display
% fxspace = 5;
k=1;
vxCoords = [];
vyCoords = [];
Dvals = [];
for c=1:m
for r=1:n
% subp(m,n,c+(r-1)*n,spacing);
% subplot(m,n,c+(r-1)*n)
hval = max(abs(D(:,k)));
[vals order] = sort(abs(D(:,k)),'descend');
vxCoords = [vxCoords (Acoords(3,order)+c*fxspace)];
vyCoords = [vyCoords (Acoords(4,order)-r*fxspace)];
Dvals = [Dvals (D(order,k)./hval)'];
% scatter(Acoords(3,order),Acoords(4,order),50,D(order,k),'filled'), axis square off
% axis([-1 1 -1 1]*2)
% caxis([-1 1]*hval);
k=k+1;
end
end
sfigure(fig+1);
set(gcf,'Color','k')
set(gcf,'inverthardcopy','off')
subp(1,1,1,spacing);
scatter(vxCoords,vyCoords,50,Dvals,'filled'), axis equal off
% % plot quiver display
% xyspace = 27;
% k=1;
% xCoords = [];
% yCoords = [];
% vxCoords = [];
% vyCoords = [];
% Dvals = [];
% for c=1:m
% for r=1:n
% % subp(m,n,c+(r-1)*n,spacing);
% % subplot(m,n,c+(r-1)*n)
% hval = max(abs(D(:,k)));
% [vals order] = sort(abs(D(:,k)),'descend');
% Dvals = [Dvals (D(order,k)./hval)'];
% vxCoords = [vxCoords (Acoords(3,order))];
% vyCoords = [vyCoords (Acoords(4,order))];
% xCoords = [xCoords (Acoords(1,order)+c*xyspace)];
% yCoords = [yCoords (Acoords(2,order)-r*xyspace)];
%
%
% % scatter(Acoords(3,order),Acoords(4,order),50,D(order,k),'filled'), axis square off
% % axis([-1 1 -1 1]*2)
% % caxis([-1 1]*hval);
% k=k+1;
% end
% end
%
% sfigure(fig+2)
% clf
% subp(1,1,1,spacing);
% Magfact = 1;
% vMag = sqrt(vxCoords.^2 + vyCoords.^2)./Magfact;
% vScaling = 1./vMag.^2;
% quiver(xCoords,yCoords,vxCoords.*Dvals./vMag.^2,vyCoords.*Dvals./vMag.^2,0), axis square off
% if exist('h','var') && ~isempty(h)
% set(h,'CData',array);
% else
% h=imagesc(array,'EraseMode','none',[-1 1]);
% axis image off
% colormap gray; freezeColors
% end
%
% if exist('Z_var','var') && ~isempty(Z_var)
% sfigure(fig_num+1)
% subplot(211)
% bar(Z_var), axis([0 M+1 0 max(Z_var)])
% title('Z variance')
% subplot(212)
% normA=sqrt(sum(abs(A).^2));
% bar(normA), axis([0 M+1 0 max(normA)])
% title('basis norm (L2)')
% end
drawnow