-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_errorbars_radii3DX_experiments.m
205 lines (168 loc) · 5.72 KB
/
create_errorbars_radii3DX_experiments.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
202
203
204
clear
set(0,'defaultaxeslinewidth',1)
set(0,'defaultlinelinewidth',2)
set(0,'defaultpatchlinewidth',1)
for choice = [1]
load(['data3d-',num2str(choice),'-slices'])
nSim = size(areas_grains_slices,1);
dims = [256 256 256];
max_epoch = 2;
folder_name = './Histograms3Dcomparison/';
file_name = ['simulation3dcomparison-',num2str(choice),'-',num2str(dims(1)),'x',num2str(dims(2)),'x',num2str(dims(3))];
for k = 1:nSim
for epoch = 0:max_epoch
for i = 1:length(dims)
areas_aux1{k,epoch+1,i} = vertcat(areas_grains_slices{k,epoch+1}{i,:});
isopratio_aux1{k,epoch+1,i} = vertcat(isopratio_slices{k,epoch+1}{i,:});
end
end
end
for epoch = 0:max_epoch
for i = 1:length(dims)
areas_grains_aux{epoch+1,i} = vertcat(areas_aux1{:,epoch+1,i});
isopratio_aux{epoch+1,i} = vertcat(isopratio_aux1{:,epoch+1,i});
end
end
for k = 1:nSim
for epoch = 0:max_epoch
for i = 1:length(dims)
areas_aux1{k,epoch+1,i} = vertcat(areas_grains_slices_original{k,epoch+1}{i,:});
isopratio_aux1{k,epoch+1,i} = vertcat(isopratio_slices_original{k,epoch+1}{i,:});
end
end
end
for epoch = 0:max_epoch
for i = 1:length(dims)
areas_grains_original_aux{epoch+1,i} = vertcat(areas_aux1{:,epoch+1,i});
isopratio_original_aux{epoch+1,i} = vertcat(isopratio_aux1{:,epoch+1,i});
end
end
load('data3dconstant-slices')
for k = 1:nSim
for epoch = 0:max_epoch
for i = 1:length(dims)
areas_aux1{k,epoch+1,i} = vertcat(areas_grains_slices{k,epoch+1}{i,:});
isopratio_aux1{k,epoch+1,i} = vertcat(isopratio_slices{k,epoch+1}{i,:});
end
end
end
for epoch = 0:max_epoch
for i = 1:length(dims)
areas_grains_constant_aux{epoch+1,i} = vertcat(areas_aux1{:,epoch+1,i});
isopratio_constant_aux{epoch+1,i} = vertcat(isopratio_aux1{:,epoch+1,i});
end
end
%% Setup Legend
legend_text{1} = '\sigma_{ij} = RS, \mu^{-1}_{ij} = 1';
legend_text{2} = '\sigma_{ij} = RS, \mu^{-1}_{ij} = \sigma_{ij}';
legend_text{3} = '\sigma_{ij} = 1, \mu^{-1}_{ij} = 1';
%% Slices
for i = 3:3
%% Effective Radii
data{1} = cellfun(@sqrt,areas_grains_aux(:,i)','UniformOutput',false);
data{2} = cellfun(@sqrt,areas_grains_original_aux(:,i)','UniformOutput',false);
data{3} = cellfun(@sqrt,areas_grains_constant_aux(:,i)','UniformOutput',false);
title_name = 'Probability Density vs Reduced Effective Radii';
saveto = [folder_name,file_name,'-radii_slices_',num2str(i),'_t'];
axis_bounds = [0 3 0 1.1];
scale = 1;
bin_width = [0.1 0.1 0.1];
[xradii3DX,yradii3DX,eradii3DX] = plot_errorbars_comparison(data,title_name,saveto,axis_bounds,legend_text,scale,bin_width);
save([folder_name,'radii3DX-choice',num2str(choice),'-slice',num2str(i)],'xradii3DX','yradii3DX','eradii3DX')
%% Isoperimetric ratio
data{1} = isopratio_aux(:,i)';
data{2} = isopratio_original_aux(:,i)';
data{3} = isopratio_constant_aux(:,i)';
title_name = 'Probability Density vs Reduced Isoperimetric Ratio';
saveto = [folder_name,file_name,'-isopratio_slices_',num2str(i),'_t'];
axis_bounds = [0 1 0 11];
scale = 1;
bin_width = [0.01 0.01 0.01];
plot_errorbars_comparison(data,title_name,saveto,axis_bounds,legend_text,scale,bin_width);
end
end
%%
clear
close all
%%%%%%%%%%%%%%%%%%%%%%
% EXPERIMENTAL DATA:
%%%%%%%%%%%%%%%%%%%%%%
load hull_3dx_experimental.mat
% Normalization for Hull's data:
area = 0;
for i=1:10
add = ( y(i+1)+y(i) ) / 2 * ( x(i+1) - x(i) );
area = area + add;
end
y = y / area;
moment = 0;
for i=1:10
add = ( y(i+1)*x(i+1)+y(i)*x(i) ) / 2 * ( x(i+1) - x(i) );
moment = moment + add;
end
x = x / moment;
area = 0;
for i=1:10
add = ( y(i+1)+y(i) ) / 2 * ( x(i+1) - x(i) );
area = area + add;
end
y = y / area;
xHull = x;
yHull = y;
load groeber_3dx_experimental.mat
% Normalization for Groeber's data:
area = 0;
for i=1:9
add = ( y(i+1)+y(i) ) / 2 * ( x(i+1) - x(i) );
area = area + add;
end
y = y / area;
moment = 0;
for i=1:9
add = ( y(i+1)*x(i+1)+y(i)*x(i) ) / 2 * ( x(i+1) - x(i) );
moment = moment + add;
end
x = x / moment;
area = 0;
for i=1:9
add = ( y(i+1)+y(i) ) / 2 * ( x(i+1) - x(i) );
area = area + add;
end
y = y / area;
xGroeber = x;
yGroeber = y;
load('radii3DX-choice1-slice3.mat')
dims = [256 256 256];
choice = 1;
folder_name = './Histograms3Dcomparison/';
file_name = ['simulation3dcomparison-',num2str(choice),'-',num2str(dims(1)),'x',num2str(dims(2)),'x',num2str(dims(3))];
title_name = 'Probability Density vs Reduced Effective Radii';
saveto = [folder_name,file_name,'-radii_slices_3_t'];
axis_bounds = [0 3 0 1];
scale = 1;
legend_text{1} = '\sigma_{ij} = RS, \mu^{-1}_{ij} = 1';
legend_text{2} = '\sigma_{ij} = RS, \mu^{-1}_{ij} = \sigma_{ij}';
legend_text{3} = '\sigma_{ij} = 1, \mu^{-1}_{ij} = 1';
legend_text{4} = 'Hull et. al.';
legend_text{5} = 'Groeber et. al.';
for j = 2:3
clf
hold on
for i = 1:3
switch i
case 1
marker = '-';
case 2
marker = '-';
case 3
marker = '-';
end
errorbar(xradii3DX{i,j},yradii3DX{i,j},eradii3DX{i,j},marker,'LineWidth',1.5)
end
plot(xHull,yHull,'-o',xGroeber,yGroeber,'-d')
hold off
legend(legend_text,'Location','best')
axis(axis_bounds)
title(title_name)
print(gcf, '-depsc2', [saveto,num2str(j-1),'-experiments']);
end