Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/Murat_checks.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@

if availableVelocity == 0

qLat = mean(origin(1),ending(1));
qLon = mean(origin(2),ending(2));
qLat = mean([origin(1),ending(1)]);
qLon = mean([origin(2),ending(2)]);


gridPropagation.x = xM';
Expand Down
2 changes: 2 additions & 0 deletions bin/Murat_inversionQ.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
exitflag = 'Tikhonov';
output = [];
saveFigureAsImage(pathFolder);
savefig(gcf, [pathFolder '.fig']);
close(gcf);
fval = fval*obj0;

case 'Particle'
Expand Down
4 changes: 3 additions & 1 deletion bin/Murat_inversionQc.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@
Murat_tikhonovQc(PlotI,W*Ac_k,W*Qm_k,dampValue,x0.Qc);
eflag = 'Tikhonov';
output = [];
saveFigureAsImage(pathFolder);
saveFigureAsImage(pathFolder);
savefig(gcf, [pathFolder '.fig']);
close(gcf);
fval = fval*obj0;

case 'Particle'
Expand Down
33 changes: 19 additions & 14 deletions bin/Murat_plot.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@
rtQk = retainQ(:,k);
rtQck = retainQc(:,k);
rcQck = ray_crosses_Qc(:,k);
modv_pd_k = modv_pd(:,:,k);
modv_Qc_k = modv_Qc(:,:,k);
modv_Q_k = modv_Q(:,:,k);
[X,Y,Z1,mPD]= Murat_fold(x,y,z,modv_pd_k(:,4));
[~,~,~,mQc] = Murat_fold(x,y,z,modv_Qc_k(:,4));
[~,~,~,mQ] = Murat_fold(x,y,z,modv_Q_k(:,4));
Z = Z1/1000;
evst_Qc = evst(rtQck,:);
evst_pd = evst(rtpdk,:);
evst_Q = evst(rtQk,:);
Qm_k = Qm(rtQck,k);
RZZ_k = RZZ(rtQck,k);
avQcFreq(1,k) = sum(RZZ_k.*Qm_k)/sum(RZZ_k);
avQcFreq(2,k) = std(Qm_k);

if PlotRays == 1
% Murat_plot starts plotting the ray distribution if asked by the user.
Expand All @@ -77,7 +91,7 @@
% Peak Delay rays
FName_peakDelay = ['Rays_PeakDelay_' fcName '_Hz'];
rma_pd = rma(:,2:4,rtpdk)/1000;
evst_pd = evst(rtpdk,:);

rays_peakDelay = Murat_imageRays(rma_pd,origin,ending,evst_pd,...
x,y,z,FName_peakDelay);
saveFigureAsImage(makePath(storeFolder, FName_peakDelay));
Expand All @@ -87,7 +101,7 @@
% The next figure shows the rays for the total attenuation (Q)
FName_Q = ['Rays_Q_' fcName '_Hz'];
rma_Q = rma(:,2:4,rtQk)/1000;
evst_Q = evst(rtQk,:);

rays_Q = Murat_imageRays(rma_Q,origin,ending,evst_Q,x,y,z,...
FName_Q);
saveFigureAsImage(makePath(storeFolder, FName_Q));
Expand All @@ -107,14 +121,12 @@

% Qc test
storeFolder = fullfile('Tests','Qc');
Qm_k = Qm(rtQck,k);
RZZ_k = RZZ(rtQck,k);

residualQc_k= residualQc(k);
luntot_Qc = luntot(rtQck)/1000;
Ac = Ac_i(rtQck,rcQck);

avQcFreq(1,k) = sum(RZZ_k.*Qm_k)/sum(RZZ_k);
avQcFreq(2,k) = std(Qm_k);


Qc_title = ['Qc check ' fcName ' Hz'];
Qc_analysis = Murat_imageCheckQc(Qm_k,RZZ_k,residualQc_k,...
Expand Down Expand Up @@ -168,14 +180,7 @@
% work with the function "slice". All stored in the sub-folder.
storeFolder = fullfile('Results','PeakDelay');

modv_pd_k = modv_pd(:,:,k);
modv_Qc_k = modv_Qc(:,:,k);
modv_Q_k = modv_Q(:,:,k);
[X,Y,Z1,mPD]= Murat_fold(x,y,z,modv_pd_k(:,4));
[~,~,~,mQc] = Murat_fold(x,y,z,modv_Qc_k(:,4));
[~,~,~,mQ] = Murat_fold(x,y,z,modv_Q_k(:,4));
Z = Z1/1000;
evst_Qc = evst(rtQck,:);


% Peak delays results, using interpolation defined by 'divi'.
divi = 5;
Expand Down
49 changes: 49 additions & 0 deletions bin/saveFigureAsImage.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,55 @@
fig = gcf
end

% Force white figure background
fig.Color = [1 1 1];

% Find all axes (including tiled, polar, etc.)
ax = findall(fig, 'Type', 'axes');
for k = 1:numel(ax)
% Axes background white
ax(k).Color = [1 1 1];
% Axes lines, tick labels, and title/label text to black
ax(k).XColor = [0 0 0];
ax(k).YColor = [0 0 0];
if isprop(ax(k),'ZColor') % cartesian 3D axes
ax(k).ZColor = [0 0 0];
end
% Set label and title colors (covers xlabel/ylabel/title objects)
try
ax(k).Title.Color = [0 0 0];
catch
end
try
ax(k).XLabel.Color = [0 0 0];
ax(k).YLabel.Color = [0 0 0];
if isprop(ax(k),'ZLabel')
ax(k).ZLabel.Color = [0 0 0];
end
catch
end
% Tick label interpreter may be preserved; ensure color for text objects
tickText = findall(ax(k), 'Type', 'text');
for t = 1:numel(tickText)
tickText(t).Color = [0 0 0];
end
end

% Configure legends
lg = findall(fig, 'Type', 'legend');
for L = 1:numel(lg)
lg(L).TextColor = [0 0 0]; % legend text black
lg(L).Color = [1 1 1]; % legend background white
lg(L).EdgeColor = [0 0 0]; % legend border black
% If legend contains title
try
lg(L).Title.Color = [0 0 0];
catch
end
end

drawnow; % ensure updates take effect

% Resolve figure handle
if isempty(fig) || ~ishandle(fig)
fig = gcf;
Expand Down
Loading