%Figures for the paper
%% Figure 1: 2M and 3M baseline
jp=0; %total panel count initialization
ns=2; %number of simulation sets to analyze
imomset=[3,0,6]; %moments to analyze

figure('position',[1 1 1100 250*ns])

testset='../AMP_45_NP/output_2M_gamma/cc';
testsetb='../AMP_45_NP/output_3M_gamma/cc';
ins=1; %simulation set number
vars{1}='cM0M0type1';
vars{2}='bin';
simname='c03-r03';
read_nonparametric
nonparametric_analysis

testset='../AMP_45_NP/output_3M_gamma/cc';
testsetb='../AMP_45_NP/output_3M_gamma/cc';
ins=2; %simulation set number
vars{1}='cM6M6type1';
simname='c036-r036';
read_nonparametric
nonparametric_analysis

minspace(gcf,ns,5)

%% Figure 8: 2M and 3M baseline, 4M, 4M-np error dependencies

jp=0; %total panel count initialization
ns=2; %number of simulation sets to analyze
titles={'(a) c03-r03','(b) c036-r036','(c) f0349','(d) np0369'};
imomset=[3]; %moments to analyze

testset='../AMP_45_NP/output_2M_gamma/cc';
testsetb='../AMP_45_NP/output_3M_gamma/cc';

figure('position',[1 1 550 500])

ins=1; %simulation set number
vars{1}='cM0M0type1';
vars{2}='bin';
simname='c03-r03';
read_nonparametric
errors_depend

testset='../AMP_45_NP/output_3M_gamma/cc';
testsetb='../AMP_45_NP/output_3M_gamma/cc';
ins=2; %simulation set number
vars{1}='cM6M6type1';
simname='c036-r036';
read_nonparametric
errors_depend

testset='../AMP_45_NP/output_4M_gamma/cc';
testsetb=testset;
ins=3; %simulation set number
vars{1}='cM4949type0';
simname='f0349';
read_nonparametric
errors_depend

testset='../AMP_45_NP/output_4M-v7/cc';
testsetb=testset;
ins=4; %simulation set number
vars{1}='cM0369type2';
vars{2}='binM0369';
simname='np0369';
read_nonparametric
errors_depend

minspace(gcf,2,2,'outermargin',[0.01 0.01 .15 .01])
%% Figure 2: 3M separate modes, moment tests

jp=0; %panel counter
ns=3; %number of simulation sets to analyze
imomset=[3,0,6]; %moments to analyze

%testset='/glade/scratch/adeleig/AMP_NP_45/output_3M_gamma/cc';
testset='../AMP_45_NP/output_3M_gamma/cc';
testsetb=testset;

figure('position',[1 1 1100 250*ns])

ins=1; %simulation set number
vars{1}='cM2M2type1';
vars{2}='bin';
simname='c032-r032';
read_nonparametric
nonparametric_analysis

ins=2; %simulation set number
vars{1}='cM8M2type1';
simname='c038-r032';
read_nonparametric
nonparametric_analysis

ins=3; %simulation set number
vars{1}='cM8M8type1';
simname='c038-r038';
read_nonparametric
nonparametric_analysis

minspace(gcf,ns,5)
%% Figure 3: 4M double mode, moment tests

jp=0; %panel counter
ns=3; %number of simulation sets to analyze
imomset=[3,0,6]; %moments to analyze

testset='../AMP_45_NP/output_4M_gamma/cc';
testsetb=testset;

figure('position',[1 1 1100 250*ns])

ins=1; %simulation set number
vars{1}='cM6969type0';
vars{2}='bin';
simname='f0369';
read_nonparametric
nonparametric_analysis

ins=2; %simulation set number
vars{1}='cM4545type0';
simname='f0345';
% vars{1}='cM4848type0';
% simname='f0348';
read_nonparametric
nonparametric_analysis

ins=3; %simulation set number
vars{1}='cM4949type0';
simname='f0349';
%vars{1}='cM5656type0';
%simname='f0356';
read_nonparametric
nonparametric_analysis

minspace(gcf,ns,5)

%% Figure 5: 6M double mode, moment tests

jp=0; %total panel count
ns=3; %number of simulation sets to analyze
imomset=[3 0 6];

testset='../AMP_45_NP/output_6M_gamma/cc';
testsetb=testset;

figure('position',[1 1 300 250*ns])

ins=1; %simulation set number
vars{1}='cM2456type0';
vars{2}='bin';
simname='f023456';
read_nonparametric
nonparametric_analysis

ins=2; %simulation set number
vars{1}='cM2467type0';
simname='f023467';
read_nonparametric
nonparametric_analysis

ins=3; %simulation set number
vars{1}='cM4567type0';
simname='f034567';
read_nonparametric
nonparametric_analysis

minspace(gcf,ns,1)
%Removed some noisy poitnts near the end of plots by hand for clarity. 
%% Figure 7: 4M nonparametric

jp=0; %total panel count
ns=3; %number of simulation sets to analyze
imomset=[3,0,6];

testset='../AMP_45_NP/output_4M-v7/cc';
testsetb=testset;

figure('position',[1 1 1100 250*ns])

ins=1; %simulation set number
vars{1}='cM0369type2';
vars{2}='binM0369';
simname='np0369';
read_nonparametric
nonparametric_analysis

ins=2; %simulation set number
vars{1}='cM0345type2';
vars{2}='binM0345';
simname='np0345';
read_nonparametric
nonparametric_analysis

ins=3; %simulation set number
vars{1}='cM0349type2';
vars{2}='binM0349';
simname='np0349';
read_nonparametric
nonparametric_analysis

minspace(gcf,ns,5)
%% Figure 6

parameter_evolution

%% Figure 4