Skip to content

Commit

Permalink
Cleaned up plotting code and comments in mc_inverse.m.
Browse files Browse the repository at this point in the history
  • Loading branch information
hayakawa16 committed Jun 8, 2021
1 parent bcf1e7d commit 0bef186
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions matlab/monte_carlo_inverse/mc_inverse.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
%% Monte Carlo Demo
% This script includes an example that is the equivalent to
% 1) Example 7 in vts_mc_demo.m: use N=1000 in infile_pMC_db_gen_template.txt
% to reproduce results in vts_mc_demo.m
% 2) Example Example ROfRho (inverse solution for chromophore concentrations
% for multiple wavelengths, single rho) in vts_solver_demo.m: use
% wv=500:100:1000 and rho=1, N=10000
Expand Down Expand Up @@ -69,15 +70,18 @@
end
[R,pmcR,dmcRmua,dmcRmus]=load_for_inv_results('PP_rho');
R_conv=pmcR(1:end-1)';
f = figure; semilogy(rhoMidpoints(1:end-1),measData,'r.',...
f = figure; semilogy(rhoMidpoints(1:end-1),measData,'rx',...
rhoMidpoints(1:end-1),R_ig,'g-',...
rhoMidpoints(1:end-1),R_conv,'b:','LineWidth',2);
xlabel('\rho [mm]');
ylabel('log10(R(\rho))');
ylabel('log10[R(\rho)]');
legend('Meas','IG','Converged','Location','Best');
legend boxoff;
grid on;
set(gca,'TickDir','out','FontSize',20);
title('Inverse solution using pMC/dMC');
set(f, 'Name', 'Inverse solution using pMC/dMC');
disp(sprintf('IG = [%f %5.3f]',measParms(1),measParms(2)));
disp(sprintf('Meas = [%f %5.3f]',measParms(1),measParms(2)));
disp(sprintf('IG = [%f %5.3f] Chi2=%5.3e',x0(1),x0(2),...
(measData-R_ig)*(measData-R_ig)'));
disp(sprintf('Conv = [%f %5.3f] Chi2=%5.3e',recoveredOPs(1),recoveredOPs(2),...
Expand Down Expand Up @@ -167,8 +171,11 @@
wv,R_ig,'g-',...
wv,R_conv,'b:','LineWidth',2);
xlabel('\lambda [nm]');
ylabel('log10(R(\lambda))');
ylabel('log10[(\lambda)]');
legend('Meas','IG','Converged','Location','Best');
legend boxoff;
grid on;
set(gca,'TickDir','out','FontSize',20);
title('Inverse solution using pMC/dMC');
set(f, 'Name', 'Inverse solution using pMC/dMC');
disp(sprintf('Meas = [%5.3f %5.3f %5.3f]',measParms(1),measParms(2),measParms(3)));
Expand Down Expand Up @@ -258,9 +265,12 @@
wv,R_ig(1:length(wv)),'g-',wv,R_ig(length(wv)+1:end),'g--',...
wv,R_conv(1:length(wv)),'b-',wv,R_conv(length(wv)+1:end),'b--','LineWidth',2);
xlabel('\lambda [nm]');
ylabel('log10(R(\lambda))');
ylabel('log10[R(\lambda)]');
legend('Meas rho=0.1429','Meas rho=1.0','IG rho=0.1429','IG rho=1.0',...
'Converged rho=0.1429','Converged rho=1.0','Location','Best');
legend boxoff;
grid on;
set(gca,'TickDir','out','FontSize',20);
title('Inverse solution using pMC/dMC');
set(f, 'Name', 'Inverse solution using pMC/dMC');
disp(sprintf('Meas = [%5.3f %5.3f %5.3f %5.3f]',measParms(1),measParms(2),...
Expand Down

0 comments on commit 0bef186

Please sign in to comment.