forked from sgarrettroe/data_analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy3dSlices.m
201 lines (190 loc) · 6.63 KB
/
my3dSlices.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
function my3dSlices(freq,spec3d,t2_array,t4_array,ind,ind1,ind2)
%function my3dSlices(freq,spec3d,t2_array,t4_array,ind,ind1,ind2)
%
% this takes a 3d spectrum or probability distribution and plots the 3d
% object with slices indicated in one figure, and a time series of the
% slices in another figure
%
% see also my3dSlices2 for just plotting the cuts of a single spectrum or
% probability distribution
map = myMapRGB(65);
i_fig = 100;
%% slices of 3D
%----------------------------------------------------------------------------
%3-point joint-probability distribution (one large figure with
%slices indicated)
%----------------------------------------------------------------------------
i_fig = i_fig+1;
figure(i_fig),clf reset
%figure(8),clf reset
fontsize=12;
n_i=length(ind);
count = 0;
for i = ind
count = count+1;
subplot(1,n_i,count)
v = spec3d{i};
v=v./max(max(max(v)));
hold on
%xy plane
s=sum(v,3);
[c,h]=contourf(freq,freq,s,6);
h=findobj(h,'type','patch');
colormap(map),myCaxis(s);
for i=1:length(h),zd=freq(1).*ones(size(get(h(i),'XData')));set(h(i),'ZData',zd);end
set(h,'FaceLighting','none');
%yz plane
s=squeeze(sum(v,2))';
[c,h]=contourf(freq,freq,s,6);colormap(map),myCaxis(s);
h=findobj(h,'type','patch');
for i=1:length(h),
xd=freq(end).*ones(size(get(h(i),'YData')));
zd=get(h(i),'YData');
yd=get(h(i),'XData');
set(h(i),'XData',xd,'YData',yd,'ZData',zd);
end
set(h,'FaceLighting','none');
%xz plane
s=squeeze(sum(v,1))';
[c,h]=contourf(freq,freq,s,6);colormap(map),myCaxis(s);
h=findobj(h,'type','patch');
for i=1:length(h),
xd=get(h(i),'XData');
zd=get(h(i),'YData');
yd=freq(end).*ones(size(get(h(i),'YData')));
set(h(i),'XData',xd,'YData',yd,'ZData',zd);
end
set(h,'FaceLighting','none');
%cut1
s = squeeze(v(:,ind2,:))';
max_s = max(max(s));
[c,h]=contour(freq,freq,s,[max_s*0.1 max_s*0.25 max_s*0.5]);
hs=findobj(h,'type','patch');
for j = 1:length(hs)
xd = freq(22)*ones(size(get(hs(j),'XData')));
yd = get(hs(j),'XData');
zd = get(hs(j),'YData');
set(hs(j),'XData',xd,'YData',yd,'ZData',zd);
end
set(hs,'EdgeColor',[0 0 1],'LineWidth',2,'EdgeLighting','none')
%cut2
s = squeeze(v(:,ind1,:))';
max_s = max(max(s));
[c,h]=contour(freq,freq,s,[max_s*0.1 max_s*0.25 max_s*0.5]);
hs2=findobj(h,'type','patch');
for j = 1:length(hs)
xd = freq(11)*ones(size(get(hs2(j),'XData')));
yd = get(hs2(j),'XData');
zd = get(hs2(j),'YData');
set(hs2(j),'XData',xd,'YData',yd,'ZData',zd);
end
set(hs2,'EdgeColor',[1 1 0],'LineWidth',2,'EdgeLighting','none')
p10 = patch(isosurface(freq,freq,freq,v,0.10));
p25 = patch(isosurface(freq,freq,freq,v,0.25));
p50 = patch(isosurface(freq,freq,freq,v,0.5));
isonormals(freq,freq,freq,v,p10);
set(p10,'FaceColor','red','EdgeColor','none','FaceAlpha',0.1);
set(p25,'FaceColor','red','EdgeColor','none','FaceAlpha',0.5);
set(p50,'FaceColor','red','EdgeColor','none','FaceAlpha',0.75);
set(gca,'XLim',[freq(1),freq(end)],...
'YLim',[freq(1),freq(end)],...
'ZLim',[freq(1),freq(end)],...
'XTick',[-200 0 200],...
'YTick',[-200 0 200],...
'ZTick',[-200 0 200],...
'FontSize',fontsize);
l=line([freq(1),freq(end)],[freq(1),freq(end)],[freq(1),freq(end)]);
set(l,'Color',[0 0 0]);
xlabel('\delta\omega_1 / 2\pic','Fontsize',fontsize);ylabel('\delta\omega_3 / 2\pic','Fontsize',fontsize);zlabel('\delta\omega_5 / 2\pic','Fontsize',fontsize);
daspect([1 1 1]);
view(3),box off
%only light the isosurfs
set([p10 p25 p50],'FaceLighting','gouraud',...
'DiffuseStrength',0.7,...
'SpecularStrength',1);
hl(1) = camlight;
hl(2) = camlight(-120,45);
set(hs,'EdgeLighting','none')
set(hs2,'EdgeLighting','none')
hold off
end
set(gcf,'PaperUnits','inches','PaperPosition',[1 1 6 6]);
%if flag_print
% print(gcf,'-dtiff',[base_name,'_120fs_spec_slices.tif'])
%end
%% ----------------------------------------------------------------------------
%slice of joint prob dist +100 cm-1
%----------------------------------------------------------------------------
i_fig = i_fig+1;
figure(i_fig),clf reset
%figure(9),clf reset
n_rows = length(ind);
n_cols=length(ind2);
map = myMapRGB(65);
count = 0;
for i = ind;
v = spec3d{i};
count = count+1;
for j = 1:n_cols
subplot(n_rows,n_cols,(count-1)*n_cols+j)
s = squeeze(v(:,ind2(j),:))';
contourf(freq,freq,s,6);
set(gca,'XLim',[freq(1),freq(end)],...
'YLim',[freq(1),freq(end)],...
'XTick',[-200 0 200],...
'YTick',[-200 0 200],...
'XTickLabel',[]);
l=line([freq(1),freq(end)],[freq(1),freq(end)]);
set(l,'Color',[0 0 0]);
daspect([1 1 1]);
colormap(map);
myCaxis(s);
set(gca,'FontSize',8,'Tickdir','out','TickLength',[0.05 0.1]);
ylabel(['\delta\omega_5 / 2\pic'],'Fontsize',10);
text(-280,180,[num2str(t2_array(i)+t4_array(i)),' ps'],'Fontsize',10)
end
end
set(gca,'XTick',[-200 0 200],'XTickLabelMode','auto')
xlabel('\delta\omega_3 / 2\pic','Fontsize',10);
set(gcf,'PaperUnits','inches','PaperPosition',[1 1 2.335 8],'InvertHardcopy','off','Color',[230/255 230/255 1]);
%if flag_print
% print(gcf,'-depsc','-adobecset',[base_name,'_p100cm_spec_slices.eps'])
%end
%----------------------------------------------------------------------------
%slice of joint prob dist -100 cm-1
%----------------------------------------------------------------------------
i_fig = i_fig+1;
figure(i_fig),clf reset
%figure(10),clf reset
n_rows = length(ind);
n_cols=length(ind1);
map = myMapRGB(65);
count = 0;
for i = ind;
v = spec3d{i};
count = count+1;
for j = 1:n_cols
subplot(n_rows,n_cols,(count-1)*n_cols+j)
s = squeeze(v(:,ind1(j),:))';
contourf(freq,freq,s,6);
set(gca,'XLim',[freq(1),freq(end)],...
'YLim',[freq(1),freq(end)],...
'XTick',[-200 0 200],...
'YTick',[-200 0 200],...
'XTickLabel',[]);
l=line([freq(1),freq(end)],[freq(1),freq(end)]);
set(l,'Color',[0 0 0]);
daspect([1 1 1]);
colormap(map);
myCaxis(s);
set(gca,'FontSize',8,'Tickdir','out','TickLength',[0.05 0.1]);
ylabel(['\delta\omega_5 / 2\pic'],'Fontsize',10);
text(-280,180,[num2str(t2_array(i)+t4_array(i)),' ps'],'Fontsize',10)
end
end
set(gca,'XTick',[-200 0 200],'XTickLabelMode','auto')
xlabel('\delta\omega_3 / 2\pic','Fontsize',10);
set(gcf,'PaperUnits','inches','PaperPosition',[1 1 2.335 8],'InvertHardcopy','off','Color',[1 1 230/255]);
%if flag_print
% print(gcf,'-depsc','-adobecset',[base_name,'_m100cm_spec_slices.eps'])
%end