Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Moment_of_Correlation_2DPIV_uncertainty/postprocess_codes/plot_MC_uncertainty.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1534 lines (1316 sloc)
40.7 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [covxMC,covyMC,covxIM,covyIM,covxCS,covyCS,covP,covD]=plot_MC_uncertainty(A,casename,outputdir,savematplot,printfig,runCS,runIM,runMC) | |
width=3; | |
height=3; | |
left=200; | |
bottom=200; | |
maxyl=40; | |
% Set the defaults for saving/printing to a file | |
set(0,'defaultFigureInvertHardcopy','on'); % This is the default anyway | |
set(0,'defaultFigurePaperUnits','inches'); % This is the default anyway | |
% % defsize = get(0, 'PaperSize'); | |
% left = (defsize(1)- width)/2; | |
% bottom = (defsize(2)- height)/2; | |
defsize = [left, bottom, width, height]; | |
set(0, 'defaultFigurePaperPosition', defsize); | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
if strcmp(casename{1},'PivChal03B') | |
% A=load(fullfile(outputdir{1},'PivChal03B.mat')); | |
%% Convert to vectors | |
err_up=A.err_up(:); | |
err_vp=A.err_vp(:); | |
err_ud=A.err_ud(:); | |
err_vd=A.err_vd(:); | |
UMCx=A.UMCx(:); | |
UMCy=A.UMCy(:); | |
UIMx=A.UIMx(:); | |
UIMy=A.UIMy(:); | |
UCSx=A.UCSx(:); | |
UCSy=A.UCSy(:); | |
%% Eliminate bad vectors | |
veccutoff=0.1; | |
inx1=(find(abs(err_up)>veccutoff)); | |
iny1=(find(abs(err_vp)>veccutoff)); | |
inx2=(find(abs(err_ud)>veccutoff)); | |
iny2=(find(abs(err_vd)>veccutoff)); | |
err_up(inx1)=[]; | |
err_vp(iny1)=[]; | |
UMCx(inx1)=[]; | |
UMCy(iny1)=[]; | |
UIMx(inx1)=[]; | |
UIMy(iny1)=[]; | |
err_ud(inx2)=[]; | |
err_vd(iny2)=[]; | |
UCSx(inx2)=[]; | |
UCSy(iny2)=[]; | |
%% | |
% err_up=err_up-mean(err_up); | |
% err_vp=err_vp-mean(err_vp); | |
%% Calculate coverage | |
ngmx1=length(err_up); | |
ngmy1=length(err_vp); | |
ngmx2=length(err_ud); | |
ngmy2=length(err_vd); | |
cnt=0; | |
for j=1:ngmx1 | |
if err_up(j)<=UMCx(j) && err_up(j)>-UMCx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxMC=100*cnt/ngmx1; | |
cnt=0; | |
for j=1:ngmy1 | |
if err_vp(j)<=UMCy(j) && err_vp(j)>-UMCy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyMC=100*cnt/ngmy1; | |
cnt=0; | |
for j=1:ngmx1 | |
if err_up(j)<=UIMx(j) && err_up(j)>-UIMx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxIM=100*cnt/ngmx1; | |
cnt=0; | |
for j=1:ngmy1 | |
if err_vp(j)<=UIMy(j) && err_vp(j)>-UIMy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyIM=100*cnt/ngmy1; | |
cnt=0; | |
for j=1:ngmx2 | |
if err_ud(j)<=UCSx(j) && err_ud(j)>-UCSx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxCS=100*cnt/ngmx2; | |
cnt=0; | |
for j=1:ngmy2 | |
if err_vd(j)<=UCSy(j) && err_vd(j)>-UCSy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyCS=100*cnt/ngmy2; | |
[covxMC covyMC covxIM covyIM covxCS covyCS] | |
% [rms(err_up) rms(err_vp) rms(err_ud) rms(err_vd)] | |
% keyboard; | |
%% Plot Functions call | |
%Plot X and Y error and uncertainty histogram together for all 3 metrics | |
error_prana=[err_up;err_vp]; | |
error_davis=[err_ud;err_vd]; | |
UMC=[UMCx;UMCy]; | |
UIM=[UIMx;UIMy]; | |
UCS=[UCSx;UCSy]; | |
%% Find percentage of error within Std deviation error | |
cutoff=0.1;%0.1%0.5 | |
%Prana | |
eP=error_prana; | |
eP(eP>cutoff)=[]; | |
eP=eP-mean(eP); | |
ePstd=std(eP); | |
indexP=find(abs(eP)<=ePstd); | |
covP=100*length(indexP)/length(eP); | |
%DaVis | |
eD=error_davis; | |
eD(eD>cutoff)=[]; | |
eD=eD-mean(eD); | |
eDstd=std(eD); | |
indexD=find(abs(eD)<=eDstd); | |
covD=100*length(indexD)/length(eD); | |
[covP covD] | |
%% | |
Nbin1=40; | |
ler=-0.1;uer=0.1; | |
Nbin2=60; | |
lun=0;uun=0.1; | |
vec=linspace(ler,uer,Nbin1); | |
Nep=histc(error_prana,vec); | |
Ned=histc(error_davis,vec); | |
vec2=linspace(lun,uun,Nbin2); | |
Nmc=histc(UMC,vec2); | |
Nim=histc(UIM,vec2); | |
Ncs=histc(UCS,vec2); | |
Lp=length(error_prana); | |
Ld=length(error_davis); | |
Nep=(Nep/Lp)*100; | |
Ned=(Ned/Ld)*100; | |
Nmc=(Nmc/Lp)*100; | |
Nim=(Nim/Lp)*100; | |
Ncs=(Ncs/Ld)*100; | |
lw=1.2;fs=20; | |
set(0,'DefaultAxesFontName', 'Times New Roman'); | |
crimson=rgb('crimson'); | |
dblue=rgb('deepskyblue'); | |
blueviolet=rgb('blueviolet'); | |
figure; | |
set(gcf,'DefaultLineLineWidth',lw);set(gca,'FontSize',fs); | |
hold on; | |
plot(vec,Nep,'k-'); | |
plot(vec,Ned,'k--'); | |
plot(vec2,Nmc,'r-','MarkerSize',4,'color',crimson); | |
plot(vec2,Nim,'c-','MarkerSize',4,'color',dblue); | |
plot(vec2,Ncs,'g-','MarkerSize',4,'color',blueviolet); | |
yl=ylim(gca); | |
ll=linspace(0,maxyl,10); | |
% ll2=1:100:max(0.75*yl(2)); | |
sigprana=rms(error_prana(abs(error_prana)<=0.1)).*ones(length(ll),1); | |
sigdavis=rms(error_davis(abs(error_davis)<=0.1)).*ones(length(ll),1); | |
sigMC=rms(UMC(UMC<=0.1)).*ones(length(ll),1); | |
sigIM=rms(UIM(UIM<=0.1)).*ones(length(ll),1); | |
sigCS=rms(UCS(UCS<=0.1)).*ones(length(ll),1); | |
[mean(error_prana) mean(error_davis)] | |
plot(sigprana,ll,'k-'); | |
plot(sigdavis,ll,'k--'); | |
plot(sigMC,ll,'r-','MarkerSize',4,'color',crimson); | |
plot(sigIM,ll,'c-.','MarkerSize',4,'color',dblue); | |
plot(sigCS,ll,'g--','MarkerSize',4,'color',blueviolet); | |
hold off; | |
% ylabel('No. of Data Points'); | |
% xlabel('Error and Uncertainty (pixels)'); | |
% lbox=legend('e_{prana}','e_{davis}','MC','PD','CS','location','northeast'); | |
% set(lbox,'FontSize',16); | |
% title('Turbulent Boundary Layer \newline'); | |
grid on;box on; | |
set(gcf,'color','white'); | |
% axis square; | |
hold off; | |
if printfig==1 | |
export_fig(gcf,fullfile(outputdir{2},[casename{1},'_Histogram.png']),'-painters','-r360'); | |
end | |
if savematplot==1 | |
save(fullfile(outputdir{1},'PivChal03B_hist.mat'),'vec','Nep','Ned','vec2','Nmc','Nim','Ncs','ll','sigprana','sigdavis','sigMC','sigIM','sigCS'); | |
end | |
[sigprana(1) sigdavis(1) sigMC(1) sigIM(1) sigCS(1)] | |
%% Plot RMS error in uncertainty bins scatter plot | |
% For MC | |
Nbin3=8; | |
Ubin1=linspace(0, 0.08, Nbin3); | |
numcx1=zeros(Nbin3,1); | |
covxbin1=zeros(Nbin3,1); | |
rmserru1=zeros(Nbin3,1); | |
rmsMC=zeros(Nbin3,1); | |
for p=1:length(Ubin1) | |
if p<length(Ubin1) | |
[val1]= find((UMC<Ubin1(p+1)) & (UMC>=Ubin1(p))); | |
elseif p==length(Ubin1) | |
[val1]= find((UMC>=Ubin1(p))); | |
end | |
numcx1(p)=(length(val1)); | |
tmperr=(error_prana(val1)); | |
tempMC=UMC(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin1(p)=100*length(cvrx1)/numcx1(p); | |
rmserru1(p)=rms(tmperr); | |
rmsMC(p)=rms(tempMC); | |
end | |
%%%%%%% FOR IM | |
Ubin2=linspace(0, 0.08, Nbin3); | |
numcx2=zeros(Nbin3,1); | |
covxbin2=zeros(Nbin3,1); | |
rmserru2=zeros(Nbin3,1); | |
rmsIM=zeros(Nbin3,1); | |
for p=1:length(Ubin2) | |
if p<length(Ubin2) | |
[val1]= find((UIM<Ubin2(p+1)) & (UIM>=Ubin2(p))); | |
elseif p==length(Ubin2) | |
[val1]= find((UIM>=Ubin2(p))); | |
end | |
numcx2(p)=(length(val1)); | |
tmperr=(error_prana(val1)); | |
tempMC=UIM(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin2(p)=100*length(cvrx1)/numcx2(p); | |
rmserru2(p)=rms(tmperr); | |
rmsIM(p)=rms(tempMC); | |
end | |
%%%%% FOR CS | |
Ubin3=linspace(0, 0.08, Nbin3); | |
numcx3=zeros(Nbin3,1); | |
covxbin3=zeros(Nbin3,1); | |
rmserru3=zeros(Nbin3,1); | |
rmsCS=zeros(Nbin3,1); | |
for p=1:length(Ubin3) | |
if p<length(Ubin3) | |
[val1]= find((UCS<Ubin3(p+1)) & (UCS>=Ubin3(p))); | |
elseif p==length(Ubin3) | |
[val1]= find((UCS>=Ubin3(p))); | |
end | |
numcx3(p)=(length(val1)); | |
tmperr=(error_davis(val1)); | |
tempMC=UCS(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin3(p)=100*length(cvrx1)/numcx3(p); | |
rmserru3(p)=rms(tmperr); | |
rmsCS(p)=rms(tempMC); | |
end | |
% Plots | |
figure; | |
set(gcf,'DefaultLineLineWidth',lw);set(gca,'FontSize',fs); | |
hold on; | |
plot(rmserru1(1:end-1),rmsMC(1:end-1),'r-o','color',crimson); | |
plot(rmserru2(1:end-1),rmsIM(1:end-1),'b-o','color',dblue); | |
plot(rmserru3(1:end-1),rmsCS(1:end-1),'b-o','color',blueviolet); | |
xl=xlim(gca); | |
plot(linspace(xl(1),xl(2),10),linspace(xl(1),xl(2),10),'k-'); | |
% plot(rmserru3(1:end-1),rmserru3(1:end-1),'k--'); | |
hold off; | |
% axis([0 0.06 0 0.1]); | |
% xlabel('RMS error(pixels)'); | |
% ylabel('RMS Uncertainty in each bin(pixels)'); | |
% lbox=legend('MC','PD','CS','e_{RMS}','location','northwest'); | |
% set(lbox,'FontSize',16); | |
% title('Turbulent Boundary Layer \newline'); | |
grid on;box on; | |
set(gcf,'color','white'); | |
axis square; | |
hold off; | |
if printfig==1 | |
export_fig(gcf,fullfile(outputdir{2},[casename{1},'_RMSerroruncertainty.png']),'-painters','-r360'); | |
end | |
if savematplot==1 | |
save(fullfile(outputdir{1},'PivChal03B_RMS.mat'),'rmserru1','rmserru2','rmserru3','rmsMC','rmsIM','rmsCS'); | |
end | |
% keyboard; | |
%% Plot Covergae Histogram | |
end | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
if strcmp(casename{2},'PivChal05B'); | |
% A=load(fullfile(outputdir{1},'PivChal03B.mat')); | |
%% Convert to vectors | |
err_up=A.err_up(:); | |
err_vp=A.err_vp(:); | |
err_ud=A.err_ud(:); | |
err_vd=A.err_vd(:); | |
UMCx=A.UMCx(:); | |
UMCy=A.UMCy(:); | |
UIMx=A.UIMx(:); | |
UIMy=A.UIMy(:); | |
UCSx=A.UCSx(:); | |
UCSy=A.UCSy(:); | |
%% Eliminate bad vectors | |
veccutoff=0.1; | |
inx1=(find(abs(err_up)>veccutoff)); | |
iny1=(find(abs(err_vp)>veccutoff)); | |
inx2=(find(abs(err_ud)>veccutoff)); | |
iny2=(find(abs(err_vd)>veccutoff)); | |
err_up(inx1)=[]; | |
err_vp(iny1)=[]; | |
UMCx(inx1)=[]; | |
UMCy(iny1)=[]; | |
UIMx(inx1)=[]; | |
UIMy(iny1)=[]; | |
err_ud(inx2)=[]; | |
err_vd(iny2)=[]; | |
UCSx(inx2)=[]; | |
UCSy(iny2)=[]; | |
%% Calculate coverage | |
ngmx1=length(err_up); | |
ngmy1=length(err_vp); | |
ngmx2=length(err_ud); | |
ngmy2=length(err_vd); | |
cnt=0; | |
for j=1:ngmx1 | |
if err_up(j)<=UMCx(j) && err_up(j)>-UMCx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxMC=100*cnt/ngmx1; | |
cnt=0; | |
for j=1:ngmy1 | |
if err_vp(j)<=UMCy(j) && err_vp(j)>-UMCy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyMC=100*cnt/ngmy1; | |
cnt=0; | |
for j=1:ngmx1 | |
if err_up(j)<=UIMx(j) && err_up(j)>-UIMx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxIM=100*cnt/ngmx1; | |
cnt=0; | |
for j=1:ngmy1 | |
if err_vp(j)<=UIMy(j) && err_vp(j)>-UIMy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyIM=100*cnt/ngmy1; | |
cnt=0; | |
for j=1:ngmx2 | |
if err_ud(j)<=UCSx(j) && err_ud(j)>-UCSx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxCS=100*cnt/ngmx2; | |
cnt=0; | |
for j=1:ngmy2 | |
if err_vd(j)<=UCSy(j) && err_vd(j)>-UCSy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyCS=100*cnt/ngmy2; | |
[covxMC covyMC covxIM covyIM covxCS covyCS] | |
% [rms(err_up) rms(err_vp) rms(err_ud) rms(err_vd)] | |
% keyboard; | |
%% Plot Functions call | |
%Plot X and Y error and uncertainty histogram together for all 3 metrics | |
error_prana=[err_up;err_vp]; | |
error_davis=[err_ud;err_vd]; | |
UMC=[UMCx;UMCy]; | |
UIM=[UIMx;UIMy]; | |
UCS=[UCSx;UCSy]; | |
%% Find percentage of error within Std deviation error | |
cutoff=0.1;%0.1 | |
%Prana | |
eP=error_prana; | |
eP(eP>cutoff)=[]; | |
eP=eP-mean(eP); | |
ePstd=std(eP); | |
indexP=find(abs(eP)<=ePstd); | |
covP=100*length(indexP)/length(eP); | |
%DaVis | |
eD=error_davis; | |
eD(eD>cutoff)=[]; | |
eD=eD-mean(eD); | |
eDstd=std(eD); | |
indexD=find(abs(eD)<=eDstd); | |
covD=100*length(indexD)/length(eD); | |
[covP covD] | |
%% | |
Nbin1=40; | |
ler=-0.1;uer=0.1; | |
Nbin2=60; | |
lun=0;uun=0.1; | |
vec=linspace(ler,uer,Nbin1); | |
Nep=histc(error_prana,vec); | |
Ned=histc(error_davis,vec); | |
vec2=linspace(lun,uun,Nbin2); | |
Nmc=histc(UMC,vec2); | |
Nim=histc(UIM,vec2); | |
Ncs=histc(UCS,vec2); | |
Lp=length(error_prana); | |
Ld=length(error_davis); | |
Nep=(Nep/Lp)*100; | |
Ned=(Ned/Ld)*100; | |
Nmc=(Nmc/Lp)*100; | |
Nim=(Nim/Lp)*100; | |
Ncs=(Ncs/Ld)*100; | |
lw=1.2;fs=20; | |
set(0,'DefaultAxesFontName', 'Times New Roman'); | |
crimson=rgb('crimson'); | |
dblue=rgb('deepskyblue'); | |
blueviolet=rgb('blueviolet'); | |
figure; | |
set(gcf,'DefaultLineLineWidth',lw);set(gca,'FontSize',fs); | |
hold on; | |
plot(vec,Nep,'k-'); | |
plot(vec,Ned,'k--'); | |
plot(vec2,Nmc,'r-','MarkerSize',4,'color',crimson); | |
plot(vec2,Nim,'c-','MarkerSize',4,'color',dblue); | |
plot(vec2,Ncs,'g-','MarkerSize',4,'color',blueviolet); | |
yl=ylim(gca); | |
ll=linspace(0,maxyl,10); | |
% ll2=1:100:max(0.75*yl(2)); | |
sigprana=rms(error_prana(abs(error_prana)<=0.1)).*ones(length(ll),1); | |
sigdavis=rms(error_davis(abs(error_davis)<=0.1)).*ones(length(ll),1); | |
sigMC=rms(UMC(UMC<=0.1)).*ones(length(ll),1); | |
sigIM=rms(UIM(UIM<=0.1)).*ones(length(ll),1); | |
sigCS=rms(UCS(UCS<=0.1)).*ones(length(ll),1); | |
[mean(error_prana) mean(error_davis)] | |
plot(sigprana,ll,'k-'); | |
plot(sigdavis,ll,'k--'); | |
plot(sigMC,ll,'r-','MarkerSize',4,'color',crimson); | |
plot(sigIM,ll,'c-.','MarkerSize',4,'color',dblue); | |
plot(sigCS,ll,'g--','MarkerSize',4,'color',blueviolet); | |
hold off; | |
% ylabel('No. of Data Points'); | |
% xlabel('Error and Uncertainty (pixels)'); | |
% lbox=legend('e_{prana}','e_{davis}','MC','PD','CS','location','northeast'); | |
% set(lbox,'FontSize',16); | |
% title('Laminar Separation Bubble \newline'); | |
grid on;box on; | |
set(gcf,'color','white'); | |
% axis square; | |
hold off; | |
if printfig==1 | |
export_fig(gcf,fullfile(outputdir{2},[casename{2},'_Histogram.png']),'-painters','-r360'); | |
end | |
if savematplot==1 | |
save(fullfile(outputdir{1},'PivChal05B_hist.mat'),'vec','Nep','Ned','vec2','Nmc','Nim','Ncs','ll','sigprana','sigdavis','sigMC','sigIM','sigCS'); | |
end | |
[sigprana(1) sigdavis(1) sigMC(1) sigIM(1) sigCS(1)] | |
%% Plot RMS error in uncertainty bins scatter plot | |
% For MC | |
Nbin3=8; | |
Ubin1=linspace(0, 0.08, Nbin3); | |
numcx1=zeros(Nbin3,1); | |
covxbin1=zeros(Nbin3,1); | |
rmserru1=zeros(Nbin3,1); | |
rmsMC=zeros(Nbin3,1); | |
for p=1:length(Ubin1) | |
if p<length(Ubin1) | |
[val1]= find((UMC<Ubin1(p+1)) & (UMC>=Ubin1(p))); | |
elseif p==length(Ubin1) | |
[val1]= find((UMC>=Ubin1(p))); | |
end | |
numcx1(p)=(length(val1)); | |
tmperr=(error_prana(val1)); | |
tempMC=UMC(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin1(p)=100*length(cvrx1)/numcx1(p); | |
rmserru1(p)=rms(tmperr); | |
rmsMC(p)=rms(tempMC); | |
end | |
%%%%%%% FOR IM | |
Ubin2=linspace(0, 0.08, Nbin3); | |
numcx2=zeros(Nbin3,1); | |
covxbin2=zeros(Nbin3,1); | |
rmserru2=zeros(Nbin3,1); | |
rmsIM=zeros(Nbin3,1); | |
for p=1:length(Ubin2) | |
if p<length(Ubin2) | |
[val1]= find((UIM<Ubin2(p+1)) & (UIM>=Ubin2(p))); | |
elseif p==length(Ubin2) | |
[val1]= find((UIM>=Ubin2(p))); | |
end | |
numcx2(p)=(length(val1)); | |
tmperr=(error_prana(val1)); | |
tempMC=UIM(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin2(p)=100*length(cvrx1)/numcx2(p); | |
rmserru2(p)=rms(tmperr); | |
rmsIM(p)=rms(tempMC); | |
end | |
%%%%% FOR CS | |
Ubin3=linspace(0, 0.08, Nbin3); | |
numcx3=zeros(Nbin3,1); | |
covxbin3=zeros(Nbin3,1); | |
rmserru3=zeros(Nbin3,1); | |
rmsCS=zeros(Nbin3,1); | |
for p=1:length(Ubin3) | |
if p<length(Ubin3) | |
[val1]= find((UCS<Ubin3(p+1)) & (UCS>=Ubin3(p))); | |
elseif p==length(Ubin3) | |
[val1]= find((UCS>=Ubin3(p))); | |
end | |
numcx3(p)=(length(val1)); | |
tmperr=(error_davis(val1)); | |
tempMC=UCS(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin3(p)=100*length(cvrx1)/numcx3(p); | |
rmserru3(p)=rms(tmperr); | |
rmsCS(p)=rms(tempMC); | |
end | |
% Plots | |
figure; | |
set(gcf,'DefaultLineLineWidth',lw);set(gca,'FontSize',fs); | |
hold on; | |
plot(rmserru1(1:end-1),rmsMC(1:end-1),'r-o','color',crimson); | |
plot(rmserru2(1:end-1),rmsIM(1:end-1),'b-o','color',dblue); | |
plot(rmserru3(1:end-1),rmsCS(1:end-1),'b-o','color',blueviolet); | |
xl=xlim(gca); | |
plot(linspace(xl(1),xl(2),10),linspace(xl(1),xl(2),10),'k-'); | |
% plot(rmserru3(1:end-1),rmserru3(1:end-1),'k--'); | |
hold off; | |
axis([0 0.06 0 0.1]); | |
% xlabel('RMS error(pixels)'); | |
% ylabel('RMS Uncertainty in each bin(pixels)'); | |
% lbox=legend('MC','PD','CS','e_{RMS}','location','northwest'); | |
% set(lbox,'FontSize',16); | |
% title('Laminar Separation Bubble \newline'); | |
grid on;box on; | |
set(gcf,'color','white'); | |
% axis square; | |
hold off; | |
if printfig==1 | |
export_fig(gcf,fullfile(outputdir{2},[casename{2},'_RMSerroruncertainty.png']),'-painters','-r360'); | |
end | |
if savematplot==1 | |
save(fullfile(outputdir{1},'PivChal05B_RMS.mat'),'rmserru1','rmserru2','rmserru3','rmsMC','rmsIM','rmsCS'); | |
end | |
%% | |
% keyboard; | |
%% Plot Covergae Histogram | |
end | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
if strcmp(casename{3},'stagnation_flow'); | |
% A=load(fullfile(outputdir{1},'PivChal03B.mat')); | |
%% Convert to vectors | |
err_up=A.err_up(:); | |
err_vp=A.err_vp(:); | |
err_ud=A.err_ud(:); | |
err_vd=A.err_vd(:); | |
UMCx=A.UMCx(:); | |
UMCy=A.UMCy(:); | |
UIMx=A.UIMx(:); | |
UIMy=A.UIMy(:); | |
UCSx=A.UCSx(:); | |
UCSy=A.UCSy(:); | |
%% Eliminate bad vectors | |
veccutoff=0.3; | |
inx1=(find(abs(err_up)>veccutoff)); | |
iny1=(find(abs(err_vp)>veccutoff)); | |
inx2=(find(abs(err_ud)>veccutoff)); | |
iny2=(find(abs(err_vd)>veccutoff)); | |
err_up(inx1)=[]; | |
err_vp(iny1)=[]; | |
UMCx(inx1)=[]; | |
UMCy(iny1)=[]; | |
UIMx(inx1)=[]; | |
UIMy(iny1)=[]; | |
err_ud(inx2)=[]; | |
err_vd(iny2)=[]; | |
UCSx(inx2)=[]; | |
UCSy(iny2)=[]; | |
%% Calculate coverage | |
ngmx1=length(err_up); | |
ngmy1=length(err_vp); | |
ngmx2=length(err_ud); | |
ngmy2=length(err_vd); | |
cnt=0; | |
for j=1:ngmx1 | |
if err_up(j)<=UMCx(j) && err_up(j)>-UMCx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxMC=100*cnt/ngmx1; | |
cnt=0; | |
for j=1:ngmy1 | |
if err_vp(j)<=UMCy(j) && err_vp(j)>-UMCy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyMC=100*cnt/ngmy1; | |
cnt=0; | |
for j=1:ngmx1 | |
if err_up(j)<=UIMx(j) && err_up(j)>-UIMx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxIM=100*cnt/ngmx1; | |
cnt=0; | |
for j=1:ngmy1 | |
if err_vp(j)<=UIMy(j) && err_vp(j)>-UIMy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyIM=100*cnt/ngmy1; | |
cnt=0; | |
for j=1:ngmx2 | |
if err_ud(j)<=UCSx(j) && err_ud(j)>-UCSx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxCS=100*cnt/ngmx2; | |
cnt=0; | |
for j=1:ngmy2 | |
if err_vd(j)<=UCSy(j) && err_vd(j)>-UCSy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyCS=100*cnt/ngmy2; | |
[covxMC covyMC covxIM covyIM covxCS covyCS] | |
% [rms(err_up) rms(err_vp) rms(err_ud) rms(err_vd)] | |
% keyboard; | |
%% Plot Functions call | |
%Plot X and Y error and uncertainty histogram together for all 3 metrics | |
error_prana=[err_up;err_vp]; | |
error_davis=[err_ud;err_vd]; | |
UMC=[UMCx;UMCy]; | |
UIM=[UIMx;UIMy]; | |
UCS=[UCSx;UCSy]; | |
%% Find percentage of error within Std deviation error | |
cutoff=0.2;%0.2 | |
%Prana | |
eP=error_prana; | |
eP(eP>cutoff)=[]; | |
eP=eP-mean(eP); | |
ePstd=std(eP); | |
indexP=find(abs(eP)<=ePstd); | |
covP=100*length(indexP)/length(eP); | |
%DaVis | |
eD=error_davis; | |
eD(eD>cutoff)=[]; | |
eD=eD-mean(eD); | |
eDstd=std(eD); | |
indexD=find(abs(eD)<=eDstd); | |
covD=100*length(indexD)/length(eD); | |
[covP covD] | |
%% | |
Nbin1=40; | |
ler=-0.3;uer=0.3; | |
Nbin2=60; | |
lun=0;uun=0.3; | |
vec=linspace(ler,uer,Nbin1); | |
Nep=histc(error_prana,vec); | |
Ned=histc(error_davis,vec); | |
vec2=linspace(lun,uun,Nbin2); | |
Nmc=histc(UMC,vec2); | |
Nim=histc(UIM,vec2); | |
Ncs=histc(UCS,vec2); | |
Lp=length(error_prana); | |
Ld=length(error_davis); | |
Nep=(Nep/Lp)*100; | |
Ned=(Ned/Ld)*100; | |
Nmc=(Nmc/Lp)*100; | |
Nim=(Nim/Lp)*100; | |
Ncs=(Ncs/Ld)*100; | |
lw=1.2;fs=20; | |
set(0,'DefaultAxesFontName', 'Times New Roman'); | |
crimson=rgb('crimson'); | |
dblue=rgb('deepskyblue'); | |
blueviolet=rgb('blueviolet'); | |
figure; | |
set(gcf,'DefaultLineLineWidth',lw);set(gca,'FontSize',fs); | |
hold on; | |
plot(vec,Nep,'k-'); | |
plot(vec,Ned,'k--'); | |
plot(vec2,Nmc,'r-','MarkerSize',4,'color',crimson); | |
plot(vec2,Nim,'c-','MarkerSize',4,'color',dblue); | |
plot(vec2,Ncs,'g-','MarkerSize',4,'color',blueviolet); | |
yl=ylim(gca); | |
ll=linspace(0,maxyl,10); | |
% ll2=1:100:max(0.75*yl(2)); | |
sigprana=rms(error_prana(abs(error_prana)<=0.2)).*ones(length(ll),1); | |
sigdavis=rms(error_davis(abs(error_davis)<=0.2)).*ones(length(ll),1); | |
sigMC=rms(UMC(UMC<=0.2)).*ones(length(ll),1); | |
sigIM=rms(UIM(UIM<=0.2)).*ones(length(ll),1); | |
sigCS=rms(UCS(UCS<=0.2)).*ones(length(ll),1); | |
[mean(error_prana) mean(error_davis)] | |
plot(sigprana,ll,'k-'); | |
plot(sigdavis,ll,'k--'); | |
plot(sigMC,ll,'r-','MarkerSize',4,'color',crimson); | |
plot(sigIM,ll,'c-.','MarkerSize',4,'color',dblue); | |
plot(sigCS,ll,'g--','MarkerSize',4,'color',blueviolet); | |
hold off; | |
% ylabel('No. of Data Points'); | |
% xlabel('Error and Uncertainty (pixels)'); | |
% lbox=legend('e_{prana}','e_{davis}','MC','PD','CS','location','northeast'); | |
% set(lbox,'FontSize',16); | |
% title('Stagnation Flow \newline'); | |
grid on;box on; | |
set(gcf,'color','white'); | |
% axis square; | |
hold off; | |
if printfig==1 | |
export_fig(gcf,fullfile(outputdir{2},[casename{3},'_Histogram.png']),'-painters','-r360'); | |
end | |
if savematplot==1 | |
save(fullfile(outputdir{1},'stagnation_flow_hist.mat'),'vec','Nep','Ned','vec2','Nmc','Nim','Ncs','ll','sigprana','sigdavis','sigMC','sigIM','sigCS'); | |
end | |
[sigprana(1) sigdavis(1) sigMC(1) sigIM(1) sigCS(1)] | |
%% Plot RMS error in uncertainty bins scatter plot | |
% For MC | |
Nbin3=8; | |
Ubin1=linspace(0, 0.3, Nbin3); | |
numcx1=zeros(Nbin3,1); | |
covxbin1=zeros(Nbin3,1); | |
rmserru1=zeros(Nbin3,1); | |
rmsMC=zeros(Nbin3,1); | |
for p=1:length(Ubin1) | |
if p<length(Ubin1) | |
[val1]= find((UMC<Ubin1(p+1)) & (UMC>=Ubin1(p))); | |
elseif p==length(Ubin1) | |
[val1]= find((UMC>=Ubin1(p))); | |
end | |
numcx1(p)=(length(val1)); | |
tmperr=(error_prana(val1)); | |
tempMC=UMC(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin1(p)=100*length(cvrx1)/numcx1(p); | |
rmserru1(p)=rms(tmperr); | |
rmsMC(p)=rms(tempMC); | |
end | |
%%%%%%% FOR IM | |
Ubin2=linspace(0, 0.3, Nbin3); | |
numcx2=zeros(Nbin3,1); | |
covxbin2=zeros(Nbin3,1); | |
rmserru2=zeros(Nbin3,1); | |
rmsIM=zeros(Nbin3,1); | |
for p=1:length(Ubin2) | |
if p<length(Ubin2) | |
[val1]= find((UIM<Ubin2(p+1)) & (UIM>=Ubin2(p))); | |
elseif p==length(Ubin2) | |
[val1]= find((UIM>=Ubin2(p))); | |
end | |
numcx2(p)=(length(val1)); | |
tmperr=(error_prana(val1)); | |
tempMC=UIM(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin2(p)=100*length(cvrx1)/numcx2(p); | |
rmserru2(p)=rms(tmperr); | |
rmsIM(p)=rms(tempMC); | |
end | |
%%%%% FOR CS | |
Ubin3=linspace(0, 0.3, Nbin3); | |
numcx3=zeros(Nbin3,1); | |
covxbin3=zeros(Nbin3,1); | |
rmserru3=zeros(Nbin3,1); | |
rmsCS=zeros(Nbin3,1); | |
for p=1:length(Ubin3) | |
if p<length(Ubin3) | |
[val1]= find((UCS<Ubin3(p+1)) & (UCS>=Ubin3(p))); | |
elseif p==length(Ubin3) | |
[val1]= find((UCS>=Ubin3(p))); | |
end | |
numcx3(p)=(length(val1)); | |
tmperr=(error_davis(val1)); | |
tempMC=UCS(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin3(p)=100*length(cvrx1)/numcx3(p); | |
rmserru3(p)=rms(tmperr); | |
rmsCS(p)=rms(tempMC); | |
end | |
% Plots | |
figure; | |
set(gcf,'DefaultLineLineWidth',lw);set(gca,'FontSize',fs); | |
hold on; | |
plot(rmserru1(1:end-1),rmsMC(1:end-1),'r-o','color',crimson); | |
plot(rmserru2(1:end-1),rmsIM(1:end-1),'b-o','color',dblue); | |
plot(rmserru3(1:end-1),rmsCS(1:end-1),'b-o','color',blueviolet); | |
xl=xlim(gca); | |
plot(linspace(xl(1),xl(2),10),linspace(xl(1),xl(2),10),'k-'); | |
% plot(rmserru3(1:end-1),rmserru3(1:end-1),'k--'); | |
hold off; | |
% axis([0 0.06 0 0.1]); | |
% xlabel('RMS error(pixels)'); | |
% ylabel('RMS Uncertainty in each bin(pixels)'); | |
% lbox=legend('MC','PD','CS','e_{RMS}','location','northwest'); | |
% set(lbox,'FontSize',16); | |
% title('Stagnation Flow \newline'); | |
grid on;box on; | |
set(gcf,'color','white'); | |
% axis square; | |
hold off; | |
if printfig==1 | |
export_fig(gcf,fullfile(outputdir{2},[casename{3},'_RMSerroruncertainty.png']),'-painters','-r360'); | |
end | |
if savematplot==1 | |
save(fullfile(outputdir{1},'stagnation_flow_RMS.mat'),'rmserru1','rmserru2','rmserru3','rmsMC','rmsIM','rmsCS'); | |
end | |
%% | |
% keyboard; | |
%% Plot Covergae Histogram | |
end | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
if strcmp(casename{4},'Vortex_Ring'); | |
% A=load(fullfile(outputdir{1},'PivChal03B.mat')); | |
%% Convert to vectors | |
err_up=A.err_up(:); | |
err_vp=A.err_vp(:); | |
err_ud=A.err_ud(:); | |
err_vd=A.err_vd(:); | |
UMCx=A.UMCx(:); | |
UMCy=A.UMCy(:); | |
UIMx=A.UIMx(:); | |
UIMy=A.UIMy(:); | |
UCSx=A.UCSx(:); | |
UCSy=A.UCSy(:); | |
%% Eliminate bad vectors | |
veccutoff=0.2; | |
inx1=(find(abs(err_up)>veccutoff)); | |
iny1=(find(abs(err_vp)>veccutoff)); | |
inx2=(find(abs(err_ud)>veccutoff)); | |
iny2=(find(abs(err_vd)>veccutoff)); | |
err_up(inx1)=[]; | |
err_vp(iny1)=[]; | |
UMCx(inx1)=[]; | |
UMCy(iny1)=[]; | |
UIMx(inx1)=[]; | |
UIMy(iny1)=[]; | |
err_ud(inx2)=[]; | |
err_vd(iny2)=[]; | |
UCSx(inx2)=[]; | |
UCSy(iny2)=[]; | |
%% Calculate coverage | |
ngmx1=length(err_up); | |
ngmy1=length(err_vp); | |
ngmx2=length(err_ud); | |
ngmy2=length(err_vd); | |
cnt=0; | |
for j=1:ngmx1 | |
if err_up(j)<=UMCx(j) && err_up(j)>-UMCx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxMC=100*cnt/ngmx1; | |
cnt=0; | |
for j=1:ngmy1 | |
if err_vp(j)<=UMCy(j) && err_vp(j)>-UMCy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyMC=100*cnt/ngmy1; | |
cnt=0; | |
for j=1:ngmx1 | |
if err_up(j)<=UIMx(j) && err_up(j)>-UIMx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxIM=100*cnt/ngmx1; | |
cnt=0; | |
for j=1:ngmy1 | |
if err_vp(j)<=UIMy(j) && err_vp(j)>-UIMy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyIM=100*cnt/ngmy1; | |
cnt=0; | |
for j=1:ngmx2 | |
if err_ud(j)<=UCSx(j) && err_ud(j)>-UCSx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxCS=100*cnt/ngmx2; | |
cnt=0; | |
for j=1:ngmy2 | |
if err_vd(j)<=UCSy(j) && err_vd(j)>-UCSy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyCS=100*cnt/ngmy2; | |
[covxMC covyMC covxIM covyIM covxCS covyCS] | |
% [rms(err_up) rms(err_vp) rms(err_ud) rms(err_vd)] | |
% keyboard; | |
%% Plot Functions call | |
%Plot X and Y error and uncertainty histogram together for all 3 metrics | |
error_prana=[err_up;err_vp]; | |
error_davis=[err_ud;err_vd]; | |
UMC=[UMCx;UMCy]; | |
UIM=[UIMx;UIMy]; | |
UCS=[UCSx;UCSy]; | |
%% Find percentage of error within Std deviation error | |
cutoff=0.2;%0.2 | |
%Prana | |
eP=error_prana; | |
eP(eP>cutoff)=[]; | |
eP=eP-mean(eP); | |
ePstd=std(eP); | |
indexP=find(abs(eP)<=ePstd); | |
covP=100*length(indexP)/length(eP); | |
%DaVis | |
eD=error_davis; | |
eD(eD>cutoff)=[]; | |
eD=eD-mean(eD); | |
eDstd=std(eD); | |
indexD=find(abs(eD)<=eDstd); | |
covD=100*length(indexD)/length(eD); | |
[covP covD] | |
%% | |
Nbin1=40; | |
ler=-0.2;uer=0.2; | |
Nbin2=60; | |
lun=0;uun=0.2; | |
vec=linspace(ler,uer,Nbin1); | |
Nep=histc(error_prana,vec); | |
Ned=histc(error_davis,vec); | |
vec2=linspace(lun,uun,Nbin2); | |
Nmc=histc(UMC,vec2); | |
Nim=histc(UIM,vec2); | |
Ncs=histc(UCS,vec2); | |
Lp=length(error_prana); | |
Ld=length(error_davis); | |
Nep=(Nep/Lp)*100; | |
Ned=(Ned/Ld)*100; | |
Nmc=(Nmc/Lp)*100; | |
Nim=(Nim/Lp)*100; | |
Ncs=(Ncs/Ld)*100; | |
lw=1.2;fs=20; | |
set(0,'DefaultAxesFontName', 'Times New Roman'); | |
crimson=rgb('crimson'); | |
dblue=rgb('deepskyblue'); | |
blueviolet=rgb('blueviolet'); | |
figure; | |
set(gcf,'DefaultLineLineWidth',lw);set(gca,'FontSize',fs); | |
hold on; | |
plot(vec,Nep,'k-'); | |
plot(vec,Ned,'k--'); | |
plot(vec2,Nmc,'r-','MarkerSize',4,'color',crimson); | |
plot(vec2,Nim,'c-','MarkerSize',4,'color',dblue); | |
plot(vec2,Ncs,'g-','MarkerSize',4,'color',blueviolet); | |
yl=ylim(gca); | |
ll=linspace(0,maxyl,10); | |
% ll2=1:100:max(0.75*yl(2)); | |
sigprana=rms(error_prana(abs(error_prana)<=0.2)).*ones(length(ll),1); | |
sigdavis=rms(error_davis(abs(error_davis)<=0.2)).*ones(length(ll),1); | |
sigMC=rms(UMC(UMC<=0.2)).*ones(length(ll),1); | |
sigIM=rms(UIM(UIM<=0.2)).*ones(length(ll),1); | |
sigCS=rms(UCS(UCS<=0.2)).*ones(length(ll),1); | |
[mean(error_prana(abs(error_prana)<=0.2)) mean(error_davis(abs(error_davis)<=0.2))] | |
plot(sigprana,ll,'k-'); | |
plot(sigdavis,ll,'k--'); | |
plot(sigMC,ll,'r-','MarkerSize',4,'color',crimson); | |
plot(sigIM,ll,'c-.','MarkerSize',4,'color',dblue); | |
plot(sigCS,ll,'g--','MarkerSize',4,'color',blueviolet); | |
hold off; | |
% ylabel('No. of Data Points'); | |
% xlabel('Error and Uncertainty (pixels)'); | |
% lbox=legend('e_{prana}','e_{davis}','MC','PD','CS','location','northeast'); | |
% set(lbox,'FontSize',16); | |
% title('Vortex Ring \newline'); | |
grid on;box on; | |
set(gcf,'color','white'); | |
% axis square; | |
hold off; | |
if printfig==1 | |
export_fig(gcf,fullfile(outputdir{2},[casename{4},'_Histogram.png']),'-painters','-r360'); | |
end | |
if savematplot==1 | |
save(fullfile(outputdir{1},'Vortex_Ring_hist.mat'),'vec','Nep','Ned','vec2','Nmc','Nim','Ncs','ll','sigprana','sigdavis','sigMC','sigIM','sigCS'); | |
end | |
[sigprana(1) sigdavis(1) sigMC(1) sigIM(1) sigCS(1)] | |
%% Plot RMS error in uncertainty bins scatter plot | |
% For MC | |
Nbin3=8; | |
Ubin1=linspace(0, 0.1, Nbin3); | |
numcx1=zeros(Nbin3,1); | |
covxbin1=zeros(Nbin3,1); | |
rmserru1=zeros(Nbin3,1); | |
rmsMC=zeros(Nbin3,1); | |
for p=1:length(Ubin1) | |
if p<length(Ubin1) | |
[val1]= find((UMC<Ubin1(p+1)) & (UMC>=Ubin1(p))); | |
elseif p==length(Ubin1) | |
[val1]= find((UMC>=Ubin1(p))); | |
end | |
numcx1(p)=(length(val1)); | |
tmperr=(error_prana(val1)); | |
tempMC=UMC(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin1(p)=100*length(cvrx1)/numcx1(p); | |
rmserru1(p)=rms(tmperr); | |
rmsMC(p)=rms(tempMC); | |
end | |
%%%%%%% FOR IM | |
Ubin2=linspace(0, 0.1, Nbin3); | |
numcx2=zeros(Nbin3,1); | |
covxbin2=zeros(Nbin3,1); | |
rmserru2=zeros(Nbin3,1); | |
rmsIM=zeros(Nbin3,1); | |
for p=1:length(Ubin2) | |
if p<length(Ubin2) | |
[val1]= find((UIM<Ubin2(p+1)) & (UIM>=Ubin2(p))); | |
elseif p==length(Ubin2) | |
[val1]= find((UIM>=Ubin2(p))); | |
end | |
numcx2(p)=(length(val1)); | |
tmperr=(error_prana(val1)); | |
tempMC=UIM(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin2(p)=100*length(cvrx1)/numcx2(p); | |
rmserru2(p)=rms(tmperr); | |
rmsIM(p)=rms(tempMC); | |
end | |
%%%%% FOR CS | |
Ubin3=linspace(0, 0.1, Nbin3); | |
numcx3=zeros(Nbin3,1); | |
covxbin3=zeros(Nbin3,1); | |
rmserru3=zeros(Nbin3,1); | |
rmsCS=zeros(Nbin3,1); | |
for p=1:length(Ubin3) | |
if p<length(Ubin3) | |
[val1]= find((UCS<Ubin3(p+1)) & (UCS>=Ubin3(p))); | |
elseif p==length(Ubin3) | |
[val1]= find((UCS>=Ubin3(p))); | |
end | |
numcx3(p)=(length(val1)); | |
tmperr=(error_davis(val1)); | |
tempMC=UCS(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin3(p)=100*length(cvrx1)/numcx3(p); | |
rmserru3(p)=rms(tmperr); | |
rmsCS(p)=rms(tempMC); | |
end | |
% Plots | |
figure; | |
set(gcf,'DefaultLineLineWidth',lw);set(gca,'FontSize',fs); | |
hold on; | |
plot(rmserru1(1:end-1),rmsMC(1:end-1),'r-o','color',crimson); | |
plot(rmserru2(1:end-1),rmsIM(1:end-1),'b-o','color',dblue); | |
plot(rmserru3(1:end-1),rmsCS(1:end-1),'b-o','color',blueviolet); | |
xl=xlim(gca); | |
plot(linspace(xl(1),xl(2),10),linspace(xl(1),xl(2),10),'k-'); | |
% plot(rmserru3(1:end-1),rmserru3(1:end-1),'k--'); | |
hold off; | |
% axis([0 0.06 0 0.1]); | |
% xlabel('RMS error(pixels)'); | |
% ylabel('RMS Uncertainty in each bin(pixels)'); | |
% lbox=legend('MC','PD','CS','e_{RMS}','location','northwest'); | |
% set(lbox,'FontSize',16); | |
% title('Vortex Ring \newline'); | |
grid on;box on; | |
set(gcf,'color','white'); | |
% axis square; | |
hold off; | |
if printfig==1 | |
export_fig(gcf,fullfile(outputdir{2},[casename{4},'_RMSerroruncertainty.png']),'-painters','-r360'); | |
end | |
if savematplot==1 | |
save(fullfile(outputdir{1},'Vortex_Ring_RMS.mat'),'rmserru1','rmserru2','rmserru3','rmsMC','rmsIM','rmsCS'); | |
end | |
%% | |
% keyboard; | |
%% Plot Covergae Histogram | |
end | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
if strcmp(casename{5},'Jetdata'); | |
% A=load(fullfile(outputdir{1},'PivChal03B.mat')); | |
%% Convert to vectors | |
err_up=A.err_up(:); | |
err_vp=A.err_vp(:); | |
err_ud=A.err_ud(:); | |
err_vd=A.err_vd(:); | |
UMCx=A.UMCx(:); | |
UMCy=A.UMCy(:); | |
UIMx=A.UIMx(:); | |
UIMy=A.UIMy(:); | |
UCSx=A.UCSx(:); | |
UCSy=A.UCSy(:); | |
%% Eliminate bad vectors | |
veccutoff=0.4; | |
inx1=(find(abs(err_up)>veccutoff)); | |
iny1=(find(abs(err_vp)>veccutoff)); | |
inx2=(find(abs(err_ud)>veccutoff)); | |
iny2=(find(abs(err_vd)>veccutoff)); | |
err_up(inx1)=[]; | |
err_vp(iny1)=[]; | |
UMCx(inx1)=[]; | |
UMCy(iny1)=[]; | |
UIMx(inx1)=[]; | |
UIMy(iny1)=[]; | |
err_ud(inx2)=[]; | |
err_vd(iny2)=[]; | |
UCSx(inx2)=[]; | |
UCSy(iny2)=[]; | |
%% Calculate coverage | |
ngmx1=length(err_up); | |
ngmy1=length(err_vp); | |
ngmx2=length(err_ud); | |
ngmy2=length(err_vd); | |
cnt=0; | |
for j=1:ngmx1 | |
if err_up(j)<=UMCx(j) && err_up(j)>-UMCx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxMC=100*cnt/ngmx1; | |
cnt=0; | |
for j=1:ngmy1 | |
if err_vp(j)<=UMCy(j) && err_vp(j)>-UMCy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyMC=100*cnt/ngmy1; | |
cnt=0; | |
for j=1:ngmx1 | |
if err_up(j)<=UIMx(j) && err_up(j)>-UIMx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxIM=100*cnt/ngmx1; | |
cnt=0; | |
for j=1:ngmy1 | |
if err_vp(j)<=UIMy(j) && err_vp(j)>-UIMy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyIM=100*cnt/ngmy1; | |
cnt=0; | |
for j=1:ngmx2 | |
if err_ud(j)<=UCSx(j) && err_ud(j)>-UCSx(j) | |
cnt=cnt+1; | |
end | |
end | |
covxCS=100*cnt/ngmx2; | |
cnt=0; | |
for j=1:ngmy2 | |
if err_vd(j)<=UCSy(j) && err_vd(j)>-UCSy(j) | |
cnt=cnt+1; | |
end | |
end | |
covyCS=100*cnt/ngmy2; | |
[covxMC covyMC covxIM covyIM covxCS covyCS] | |
% [rms(err_up) rms(err_vp) rms(err_ud) rms(err_vd)] | |
% keyboard; | |
%% Plot Functions call | |
%Plot X and Y error and uncertainty histogram together for all 3 metrics | |
error_prana=[err_up;err_vp]; | |
error_davis=[err_ud;err_vd]; | |
UMC=[UMCx;UMCy]; | |
UIM=[UIMx;UIMy]; | |
UCS=[UCSx;UCSy]; | |
%% Find percentage of error within Std deviation error | |
cutoff=0.2;%0.2 | |
%Prana | |
eP=error_prana; | |
eP(eP>cutoff)=[]; | |
eP=eP-mean(eP); | |
ePstd=std(eP); | |
indexP=find(abs(eP)<=ePstd); | |
covP=100*length(indexP)/length(eP); | |
%DaVis | |
eD=error_davis; | |
eD(eD>cutoff)=[]; | |
eD=eD-mean(eD); | |
eDstd=std(eD); | |
indexD=find(abs(eD)<=eDstd); | |
covD=100*length(indexD)/length(eD); | |
[covP covD] | |
%% | |
Nbin1=40; | |
ler=-0.4;uer=0.4; | |
Nbin2=60; | |
lun=0;uun=0.4; | |
vec=linspace(ler,uer,Nbin1); | |
Nep=histc(error_prana,vec); | |
Ned=histc(error_davis,vec); | |
vec2=linspace(lun,uun,Nbin2); | |
Nmc=histc(UMC,vec2); | |
Nim=histc(UIM,vec2); | |
Ncs=histc(UCS,vec2); | |
Lp=length(error_prana); | |
Ld=length(error_davis); | |
Nep=(Nep/Lp)*100; | |
Ned=(Ned/Ld)*100; | |
Nmc=(Nmc/Lp)*100; | |
Nim=(Nim/Lp)*100; | |
Ncs=(Ncs/Ld)*100; | |
lw=1.2;fs=20; | |
set(0,'DefaultAxesFontName', 'Times New Roman'); | |
crimson=rgb('crimson'); | |
dblue=rgb('deepskyblue'); | |
blueviolet=rgb('blueviolet'); | |
figure; | |
set(gcf,'DefaultLineLineWidth',lw);set(gca,'FontSize',fs); | |
hold on; | |
plot(vec,Nep,'k-'); | |
plot(vec,Ned,'k--'); | |
plot(vec2,Nmc,'r-','MarkerSize',4,'color',crimson); | |
plot(vec2,Nim,'c-','MarkerSize',4,'color',dblue); | |
plot(vec2,Ncs,'g-','MarkerSize',4,'color',blueviolet); | |
yl=ylim(gca); | |
ll=linspace(0,maxyl,10); | |
% ll2=1:100:max(0.75*yl(2)); | |
sigprana=rms(error_prana(abs(error_prana)<=0.2)).*ones(length(ll),1); | |
sigdavis=rms(error_davis(abs(error_davis)<=0.2)).*ones(length(ll),1); | |
sigMC=rms(UMC(UMC<=0.2)).*ones(length(ll),1); | |
sigIM=rms(UIM(UIM<=0.2)).*ones(length(ll),1); | |
sigCS=rms(UCS(UCS<=0.2)).*ones(length(ll),1); | |
[mean(error_prana(abs(error_prana)<=0.2)) mean(error_davis(abs(error_davis)<=0.2))] | |
plot(sigprana,ll,'k-'); | |
plot(sigdavis,ll,'k--'); | |
plot(sigMC,ll,'r-','MarkerSize',4,'color',crimson); | |
plot(sigIM,ll,'c-.','MarkerSize',4,'color',dblue); | |
plot(sigCS,ll,'g--','MarkerSize',4,'color',blueviolet); | |
hold off; | |
% ylabel('No. of Data Points'); | |
% xlabel('Error and Uncertainty (pixels)'); | |
% lbox=legend('e_{prana}','e_{davis}','MC','PD','CS','location','northeast'); | |
% set(lbox,'FontSize',16); | |
% title('Jet Inviscid Core \newline'); | |
grid on;box on; | |
set(gcf,'color','white'); | |
% axis square; | |
hold off; | |
if printfig==1 | |
export_fig(gcf,fullfile(outputdir{2},[casename{5},'_Histogram.png']),'-painters','-r360'); | |
end | |
if savematplot==1 | |
save(fullfile(outputdir{1},'Jetdata_hist.mat'),'vec','Nep','Ned','vec2','Nmc','Nim','Ncs','ll','sigprana','sigdavis','sigMC','sigIM','sigCS'); | |
end | |
[sigprana(1) sigdavis(1) sigMC(1) sigIM(1) sigCS(1)] | |
%% Plot RMS error in uncertainty bins scatter plot | |
% For MC | |
Nbin3=8; | |
Ubin1=linspace(0, 0.12, Nbin3); | |
numcx1=zeros(Nbin3,1); | |
covxbin1=zeros(Nbin3,1); | |
rmserru1=zeros(Nbin3,1); | |
rmsMC=zeros(Nbin3,1); | |
for p=1:length(Ubin1) | |
if p<length(Ubin1) | |
[val1]= find((UMC<Ubin1(p+1)) & (UMC>=Ubin1(p))); | |
elseif p==length(Ubin1) | |
[val1]= find((UMC>=Ubin1(p))); | |
end | |
numcx1(p)=(length(val1)); | |
tmperr=(error_prana(val1)); | |
tempMC=UMC(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin1(p)=100*length(cvrx1)/numcx1(p); | |
rmserru1(p)=rms(tmperr); | |
rmsMC(p)=rms(tempMC); | |
end | |
%%%%%%% FOR IM | |
Ubin2=linspace(0, 0.12, Nbin3); | |
numcx2=zeros(Nbin3,1); | |
covxbin2=zeros(Nbin3,1); | |
rmserru2=zeros(Nbin3,1); | |
rmsIM=zeros(Nbin3,1); | |
for p=1:length(Ubin2) | |
if p<length(Ubin2) | |
[val1]= find((UIM<Ubin2(p+1)) & (UIM>=Ubin2(p))); | |
elseif p==length(Ubin2) | |
[val1]= find((UIM>=Ubin2(p))); | |
end | |
numcx2(p)=(length(val1)); | |
tmperr=(error_prana(val1)); | |
tempMC=UIM(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin2(p)=100*length(cvrx1)/numcx2(p); | |
rmserru2(p)=rms(tmperr); | |
rmsIM(p)=rms(tempMC); | |
end | |
%%%%% FOR CS | |
Ubin3=linspace(0, 0.12, Nbin3); | |
numcx3=zeros(Nbin3,1); | |
covxbin3=zeros(Nbin3,1); | |
rmserru3=zeros(Nbin3,1); | |
rmsCS=zeros(Nbin3,1); | |
for p=1:length(Ubin3) | |
if p<length(Ubin3) | |
[val1]= find((UCS<Ubin3(p+1)) & (UCS>=Ubin3(p))); | |
elseif p==length(Ubin3) | |
[val1]= find((UCS>=Ubin3(p))); | |
end | |
numcx3(p)=(length(val1)); | |
tmperr=(error_davis(val1)); | |
tempMC=UCS(val1); | |
cvrx1=find(tmperr<tempMC); | |
covxbin3(p)=100*length(cvrx1)/numcx3(p); | |
rmserru3(p)=rms(tmperr); | |
rmsCS(p)=rms(tempMC); | |
end | |
% Plots | |
figure; | |
set(gcf,'DefaultLineLineWidth',lw);set(gca,'FontSize',fs); | |
hold on; | |
plot(rmserru1(1:end-1),rmsMC(1:end-1),'r-o','color',crimson); | |
plot(rmserru2(1:end-1),rmsIM(1:end-1),'b-o','color',dblue); | |
plot(rmserru3(1:end-1),rmsCS(1:end-1),'b-o','color',blueviolet); | |
xl=xlim(gca); | |
plot(linspace(xl(1),xl(2),10),linspace(xl(1),xl(2),10),'k-'); | |
% plot(rmserru3(1:end-1),rmserru3(1:end-1),'k--'); | |
hold off; | |
% axis([0 0.06 0 0.1]); | |
% xlabel('RMS error(pixels)'); | |
% ylabel('RMS Uncertainty in each bin(pixels)'); | |
% lbox=legend('MC','PD','CS','e_{RMS}','location','northwest'); | |
% set(lbox,'FontSize',16); | |
% title('Jet Inviscid Core \newline'); | |
grid on;box on; | |
set(gcf,'color','white'); | |
% axis square; | |
hold off; | |
if printfig==1 | |
export_fig(gcf,fullfile(outputdir{2},[casename{5},'_RMSerroruncertainty.png']),'-painters','-r360'); | |
end | |
if savematplot==1 | |
save(fullfile(outputdir{1},'Jetdata_RMS.mat'),'rmserru1','rmserru2','rmserru3','rmsMC','rmsIM','rmsCS'); | |
end | |
%% | |
%% Plot Covergae Histogram | |
end | |
end |