Make gsa compatible with octave;
parent
a6b704543c
commit
b4fa7ef84e
|
@ -149,7 +149,7 @@ options_.opt_gsa = options_gsa;
|
|||
if (options_gsa.load_stab || options_gsa.load_rmse || options_gsa.load_redform) ...
|
||||
&& options_gsa.pprior,
|
||||
filetoload=[OutputDirectoryName '/' fname_ '_prior.mat'];
|
||||
if isempty(ls(filetoload)),
|
||||
if ~exist(filetoload),
|
||||
disp([filetoload,' not found!'])
|
||||
disp(['You asked to load a non existent analysis'])
|
||||
%options_gsa.load_stab=0;
|
||||
|
|
|
@ -48,7 +48,7 @@ disp('Starting sensitivity analysis')
|
|||
disp('for the fit of EACH observed series ...')
|
||||
disp(' ')
|
||||
disp('Deleting old SA figures...')
|
||||
a=dir([OutDir,'/*.*']);
|
||||
a=dir([OutDir,filesep,'*.*']);
|
||||
tmp1='0';
|
||||
if options_.opt_gsa.ppost,
|
||||
tmp=['_rmse_post'];
|
||||
|
@ -82,11 +82,11 @@ if ~isempty(options_.mode_file),
|
|||
load(options_.mode_file,'xparam1'),
|
||||
end
|
||||
if options_.opt_gsa.ppost,
|
||||
c=load([fname_,'_mean'],'xparam1');
|
||||
c=load([fname_,'_mean.mat'],'xparam1');
|
||||
xparam1_mean=c.xparam1;
|
||||
clear c
|
||||
elseif ~isempty(options_.mode_file) & ~isempty(ls([fname_,'_mean.mat']))
|
||||
c=load([fname_,'_mean'],'xparam1');
|
||||
elseif ~isempty(options_.mode_file) && exist([fname_,'_mean.mat'])==2,
|
||||
c=load([fname_,'_mean.mat'],'xparam1');
|
||||
xparam1_mean=c.xparam1;
|
||||
clear c
|
||||
end
|
||||
|
@ -118,15 +118,16 @@ if ~loadSA,
|
|||
obs = dat_fil_(options_.datafile);
|
||||
%stock_gend=data_info.gend;
|
||||
%stock_data = data_info.data;
|
||||
load([DirectoryName '/' M_.fname '_data.mat']); filfilt = dir([DirectoryName '/' M_.fname '_filter_step_ahead*.mat']);
|
||||
filparam = dir([DirectoryName '/' M_.fname '_param*.mat']);
|
||||
load([DirectoryName '/' M_.fname '_data.mat']);
|
||||
filfilt = dir([DirectoryName filesep M_.fname '_filter_step_ahead*.mat']);
|
||||
filparam = dir([DirectoryName filesep M_.fname '_param*.mat']);
|
||||
x=[];
|
||||
logpo2=[];
|
||||
sto_ys=[];
|
||||
for j=1:length(filparam),
|
||||
%load([DirectoryName '/' M_.fname '_param',int2str(j),'.mat']);
|
||||
if isempty(strmatch([M_.fname '_param_irf'],filparam(j).name))
|
||||
load([DirectoryName '/' filparam(j).name]);
|
||||
load([DirectoryName filesep filparam(j).name]);
|
||||
x=[x; stock];
|
||||
logpo2=[logpo2; stock_logpo];
|
||||
sto_ys=[sto_ys; stock_ys];
|
||||
|
@ -166,7 +167,7 @@ if ~loadSA,
|
|||
y0=zeros(nobs+1,nruns);
|
||||
nbb=0;
|
||||
for j=1:length(filfilt),
|
||||
load([DirectoryName '/' M_.fname '_filter_step_ahead',num2str(j),'.mat']);
|
||||
load([DirectoryName filesep M_.fname '_filter_step_ahead',num2str(j),'.mat']);
|
||||
nb = size(stock,4);
|
||||
% y0(:,nbb+1:nbb+nb)=squeeze(stock(1,js,:,:)) + ...
|
||||
% kron(sto_ys(nbb+1:nbb+nb,js)',ones(size(stock,3),1));
|
||||
|
@ -199,25 +200,25 @@ if ~loadSA,
|
|||
disp('... done!')
|
||||
|
||||
if options_.opt_gsa.ppost
|
||||
save([OutDir,'/',fnamtmp], 'x', 'logpo2', 'likelihood', 'rmse_MC', 'rmse_mode','rmse_pmean')
|
||||
save([OutDir,filesep,fnamtmp,'.mat'], 'x', 'logpo2', 'likelihood', 'rmse_MC', 'rmse_mode','rmse_pmean')
|
||||
else
|
||||
if options_.opt_gsa.lik_only
|
||||
save([OutDir,'/',fnamtmp], 'likelihood', '-append')
|
||||
save([OutDir,filesep,fnamtmp, '.mat'], 'likelihood', '-append')
|
||||
else
|
||||
save([OutDir,'/',fnamtmp], 'likelihood', 'rmse_MC','-append')
|
||||
save([OutDir,filesep,fnamtmp, '.mat'], 'likelihood', 'rmse_MC','-append')
|
||||
if exist('xparam1_mean','var')
|
||||
save([OutDir,'/',fnamtmp], 'rmse_pmean','-append')
|
||||
save([OutDir,filesep,fnamtmp, '.mat'], 'rmse_pmean','-append')
|
||||
end
|
||||
if exist('xparam1','var')
|
||||
save([OutDir,'/',fnamtmp], 'rmse_mode','-append')
|
||||
save([OutDir,filesep,fnamtmp,'.mat'], 'rmse_mode','-append')
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if options_.opt_gsa.lik_only & options_.opt_gsa.ppost==0
|
||||
load([OutDir,'/',fnamtmp],'x','logpo2','likelihood');
|
||||
load([OutDir,filesep,fnamtmp, '.mat'],'x','logpo2','likelihood');
|
||||
else
|
||||
load([OutDir,'/',fnamtmp],'x','logpo2','likelihood','rmse_MC','rmse_mode','rmse_pmean');
|
||||
load([OutDir,filesep,fnamtmp, '.mat'],'x','logpo2','likelihood','rmse_MC','rmse_mode','rmse_pmean');
|
||||
end
|
||||
lnprior=logpo2(:)-likelihood(:);
|
||||
nruns=size(x,1);
|
||||
|
@ -289,21 +290,27 @@ else
|
|||
hold on, cumplot(lnprior)
|
||||
h=cumplot(lnprior(ixx(nfilt0(i)+1:end,i)));
|
||||
set(h,'color','green')
|
||||
title(vvarvecm(i,:))
|
||||
title(vvarvecm(i,:),'interpreter','none')
|
||||
if mod(i,9)==0 | i==size(vvarvecm,1)
|
||||
if options_.opt_gsa.ppost
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_post_lnprior',int2str(ifig)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_post_lnprior',int2str(ifig)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_post_lnprior',int2str(ifig)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_post_lnprior',int2str(ifig) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_post_lnprior',int2str(ifig)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_post_lnprior',int2str(ifig)]);
|
||||
end
|
||||
else
|
||||
if options_.opt_gsa.pprior
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_prior_lnprior',int2str(ifig)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_prior_lnprior',int2str(ifig)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_prior_lnprior',int2str(ifig)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_prior_lnprior',int2str(ifig) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_prior_lnprior',int2str(ifig)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_prior_lnprior',int2str(ifig)]);
|
||||
end
|
||||
else
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_mc_lnprior',int2str(ifig)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_mc_lnprior',int2str(ifig)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_mc_lnprior',int2str(ifig)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_mc_lnprior',int2str(ifig) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_mc_lnprior',int2str(ifig)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_mc_lnprior',int2str(ifig)]);
|
||||
end
|
||||
end
|
||||
end
|
||||
close(gcf)
|
||||
|
@ -321,24 +328,30 @@ else
|
|||
hold on, h=cumplot(likelihood);
|
||||
h=cumplot(likelihood(ixx(nfilt0(i)+1:end,i)));
|
||||
set(h,'color','green')
|
||||
title(vvarvecm(i,:))
|
||||
title(vvarvecm(i,:),'interpreter','none')
|
||||
if options_.opt_gsa.ppost==0,
|
||||
set(gca,'xlim',[min( likelihood(ixx(1:nfilt0(i),i)) ) max( likelihood(ixx(1:nfilt0(i),i)) )])
|
||||
end
|
||||
if mod(i,9)==0 | i==size(vvarvecm,1)
|
||||
if options_.opt_gsa.ppost
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_post_lnlik',int2str(ifig)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_post_lnlik',int2str(ifig)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_post_lnlik',int2str(ifig)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_post_lnlik',int2str(ifig) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_post_lnlik',int2str(ifig)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_post_lnlik',int2str(ifig)]);
|
||||
end
|
||||
else
|
||||
if options_.opt_gsa.pprior
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_prior_lnlik',int2str(ifig)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_prior_lnlik',int2str(ifig)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_prior_lnlik',int2str(ifig)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_prior_lnlik',int2str(ifig) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_prior_lnlik',int2str(ifig)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_prior_lnlik',int2str(ifig)]);
|
||||
end
|
||||
else
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_mc_lnlik',int2str(ifig)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_mc_lnlik',int2str(ifig)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_mc_lnlik',int2str(ifig)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_mc_lnlik',int2str(ifig) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_mc_lnlik',int2str(ifig)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_mc_lnlik',int2str(ifig)]);
|
||||
end
|
||||
end
|
||||
end
|
||||
close(gcf)
|
||||
|
@ -356,24 +369,30 @@ else
|
|||
hold on, h=cumplot(logpo2);
|
||||
h=cumplot(logpo2(ixx(nfilt0(i)+1:end,i)));
|
||||
set(h,'color','green')
|
||||
title(vvarvecm(i,:))
|
||||
title(vvarvecm(i,:),'interpreter','none')
|
||||
if options_.opt_gsa.ppost==0,
|
||||
set(gca,'xlim',[min( logpo2(ixx(1:nfilt0(i),i)) ) max( logpo2(ixx(1:nfilt0(i),i)) )])
|
||||
end
|
||||
if mod(i,9)==0 | i==size(vvarvecm,1)
|
||||
if options_.opt_gsa.ppost
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_post_lnpost',int2str(ifig)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_post_lnpost',int2str(ifig)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_post_lnpost',int2str(ifig)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_post_lnpost',int2str(ifig) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_post_lnpost',int2str(ifig)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_post_lnpost',int2str(ifig)]);
|
||||
end
|
||||
else
|
||||
if options_.opt_gsa.pprior
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_prior_lnpost',int2str(ifig)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_prior_lnpost',int2str(ifig)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_prior_lnpost',int2str(ifig)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_prior_lnpost',int2str(ifig) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_prior_lnpost',int2str(ifig)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_prior_lnpost',int2str(ifig)]);
|
||||
end
|
||||
else
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_mc_lnpost',int2str(ifig)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_mc_lnpost',int2str(ifig)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_mc_lnpost',int2str(ifig)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_mc_lnpost',int2str(ifig) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_mc_lnpost',int2str(ifig)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_mc_lnpost',int2str(ifig)]);
|
||||
end
|
||||
end
|
||||
end
|
||||
close(gcf)
|
||||
|
@ -501,23 +520,33 @@ else
|
|||
title([pnam{nsnam(j)}],'interpreter','none')
|
||||
end
|
||||
%subplot(3,2,6)
|
||||
h0=legend(str2mat('base',vvarvecm(np,:)),0);
|
||||
set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3],'interpreter','none')
|
||||
if exist('OCTAVE_VERSION'),
|
||||
legend(str2mat('base',vvarvecm(np,:)),'location','eastoutside');
|
||||
else
|
||||
h0=legend(str2mat('base',vvarvecm(np,:)),0);
|
||||
set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3],'interpreter','none');
|
||||
end
|
||||
%h0=legend({'base',vnam{np}}',0);
|
||||
%set(findobj(get(h0,'children'),'type','text'),'interpreter','none')
|
||||
if options_.opt_gsa.ppost
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_post_',num2str(ix)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_post_' int2str(ix)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_post_' int2str(ix)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_post_' int2str(ix) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_post_',num2str(ix)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_post_' int2str(ix)]);
|
||||
end
|
||||
else
|
||||
if options_.opt_gsa.pprior
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_prior_',num2str(ix)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_prior_' int2str(ix)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_prior_' int2str(ix)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_prior_' int2str(ix) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_prior_',num2str(ix)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_prior_' int2str(ix)]);
|
||||
end
|
||||
else
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_mc_',num2str(ix)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_mc_' int2str(ix)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_mc_' int2str(ix)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_mc_' int2str(ix) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_mc_',num2str(ix)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_mc_' int2str(ix)]);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -562,23 +591,33 @@ else
|
|||
xlabel('')
|
||||
title([pnam{nsnam(j)}],'interpreter','none')
|
||||
end
|
||||
h0=legend(str2mat('base',vvarvecm(np,:)),0);
|
||||
set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3],'interpreter','none')
|
||||
if exist('OCTAVE_VERSION'),
|
||||
legend(str2mat('base',vvarvecm(np,:)),'location','eastoutside');
|
||||
else
|
||||
h0=legend(str2mat('base',vvarvecm(np,:)),0);
|
||||
set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3],'interpreter','none')
|
||||
end
|
||||
%h0=legend({'base',vnam{np}}',0);
|
||||
%set(findobj(get(h0,'children'),'type','text'),'interpreter','none')
|
||||
if options_.opt_gsa.ppost
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_post_dens_',num2str(ix)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_post_dens_' int2str(ix)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_post_dens_' int2str(ix)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_post_dens_' int2str(ix) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_post_dens_',num2str(ix)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_post_dens_' int2str(ix)]);
|
||||
end
|
||||
else
|
||||
if options_.opt_gsa.pprior
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_prior_dens_',num2str(ix)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_prior_dens_' int2str(ix)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_prior_dens_' int2str(ix)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_prior_dens_' int2str(ix) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_prior_dens_',num2str(ix)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_prior_dens_' int2str(ix)]);
|
||||
end
|
||||
else
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_mc_dens_',num2str(ix)])
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_mc_dens_' int2str(ix)]);
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_mc_dens_' int2str(ix)]);
|
||||
eval(['print -depsc2 ' OutDir '/' fname_ '_rmse_mc_dens_' int2str(ix) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[OutDir,'/',fname_,'_rmse_mc_dens_',num2str(ix)])
|
||||
eval(['print -dpdf ' OutDir '/' fname_ '_rmse_mc_dens_' int2str(ix)]);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -208,7 +208,7 @@ if fload==0,
|
|||
% end
|
||||
% end
|
||||
%load([fname_,'_mode'])
|
||||
eval(['load ' options_.mode_file ';']');
|
||||
eval(['load ' options_.mode_file '.mat;']);
|
||||
if neighborhood_width>0,
|
||||
for j=1:nshock,
|
||||
lpmat0(:,j) = randperm(Nsam)'./(Nsam+1); %latin hypercube
|
||||
|
@ -237,7 +237,17 @@ if fload==0,
|
|||
end
|
||||
end
|
||||
%
|
||||
h = waitbar(0,'Please wait...');
|
||||
if exist('OCTAVE_VERSION') || (options_.console_mode == 1),
|
||||
diary off;
|
||||
if exist('OCTAVE_VERSION'),
|
||||
printf('Please wait ... \r')
|
||||
else
|
||||
newString = 'Please wait ...';
|
||||
fprintf('%s',newString)
|
||||
end
|
||||
else
|
||||
h = waitbar(0,'Please wait...');
|
||||
end
|
||||
istable=[1:Nsam];
|
||||
jstab=0;
|
||||
iunstable=[1:Nsam];
|
||||
|
@ -308,9 +318,24 @@ if fload==0,
|
|||
ys_=real(dr_.ys);
|
||||
yys(:,j) = ys_;
|
||||
ys_=yys(:,1);
|
||||
waitbar(j/Nsam,h,['MC iteration ',int2str(j),'/',int2str(Nsam)])
|
||||
if exist('OCTAVE_VERSION') || (options_.console_mode == 1),
|
||||
if exist('OCTAVE_VERSION')
|
||||
printf(['MC iteration %3.i / %3.i \r'], j,Nsam);
|
||||
else
|
||||
s0=repmat('\b',1,length(newString));
|
||||
newString=sprintf('MC iteration %3.i / %3.i', j,Nsam);
|
||||
fprintf([s0,'%s'],newString);
|
||||
end
|
||||
else
|
||||
waitbar(j/Nsam,h,['MC iteration ',int2str(j),'/',int2str(Nsam)])
|
||||
end
|
||||
end
|
||||
if (exist('OCTAVE_VERSION') || (options_.console_mode == 1)),
|
||||
fprintf('\n'),
|
||||
diary on,
|
||||
else
|
||||
close(h)
|
||||
end
|
||||
close(h)
|
||||
if prepSA,
|
||||
T=T(:,:,1:jstab);
|
||||
end
|
||||
|
@ -360,38 +385,48 @@ if fload==0,
|
|||
bkpprior.p4=bayestopt_.p4;
|
||||
if pprior,
|
||||
if ~prepSA
|
||||
save([OutputDirectoryName '/' fname_ '_prior'], ...
|
||||
save([OutputDirectoryName '/' fname_ '_prior.mat'], ...
|
||||
'bkpprior','lpmat','lpmat0','iunstable','istable','iindeterm','iwrong', ...
|
||||
'egg','yys','nspred','nboth','nfwrd')
|
||||
else
|
||||
save([OutputDirectoryName '/' fname_ '_prior'], ...
|
||||
save([OutputDirectoryName '/' fname_ '_prior.mat'], ...
|
||||
'bkpprior','lpmat','lpmat0','iunstable','istable','iindeterm','iwrong', ...
|
||||
'egg','yys','T','nspred','nboth','nfwrd')
|
||||
end
|
||||
|
||||
else
|
||||
if ~prepSA
|
||||
save([OutputDirectoryName '/' fname_ '_mc'], ...
|
||||
save([OutputDirectoryName '/' fname_ '_mc.mat'], ...
|
||||
'lpmat','lpmat0','iunstable','istable','iindeterm','iwrong', ...
|
||||
'egg','yys','nspred','nboth','nfwrd')
|
||||
else
|
||||
save([OutputDirectoryName '/' fname_ '_mc'], ...
|
||||
save([OutputDirectoryName '/' fname_ '_mc.mat'], ...
|
||||
'lpmat','lpmat0','iunstable','istable','iindeterm','iwrong', ...
|
||||
'egg','yys','T','nspred','nboth','nfwrd')
|
||||
end
|
||||
end
|
||||
else
|
||||
if pprior,
|
||||
filetoload=[OutputDirectoryName '/' fname_ '_prior'];
|
||||
filetoload=[OutputDirectoryName '/' fname_ '_prior.mat'];
|
||||
else
|
||||
filetoload=[OutputDirectoryName '/' fname_ '_mc'];
|
||||
filetoload=[OutputDirectoryName '/' fname_ '_mc.mat'];
|
||||
end
|
||||
load(filetoload,'lpmat','lpmat0','iunstable','istable','iindeterm','iwrong','egg','yys','nspred','nboth','nfwrd')
|
||||
Nsam = size(lpmat,1);
|
||||
|
||||
|
||||
if prepSA & isempty(strmatch('T',who('-file', filetoload),'exact')),
|
||||
h = waitbar(0,'Please wait...');
|
||||
if exist('OCTAVE_VERSION') || (options_.console_mode == 1),
|
||||
diary off;
|
||||
if exist('OCTAVE_VERSION'),
|
||||
printf('Please wait ... \r')
|
||||
else
|
||||
newString = 'Please wait ...';
|
||||
fprintf('%s',newString)
|
||||
end
|
||||
else
|
||||
h = waitbar(0,'Please wait...');
|
||||
end
|
||||
options_.periods=0;
|
||||
options_.nomoments=1;
|
||||
options_.irf=0;
|
||||
|
@ -420,9 +455,24 @@ else
|
|||
ys_=real(dr_.ys);
|
||||
yys(:,j) = ys_;
|
||||
ys_=yys(:,1);
|
||||
waitbar(j/ntrans,h,['MC iteration ',int2str(j),'/',int2str(ntrans)])
|
||||
if exist('OCTAVE_VERSION') || (options_.console_mode == 1),
|
||||
if exist('OCTAVE_VERSION')
|
||||
printf(['MC iteration %3.i / %3.i \r'], j,ntrans);
|
||||
else
|
||||
s0=repmat('\b',1,length(newString));
|
||||
newString=sprintf('MC iteration %3.i / %3.i', j,ntrans);
|
||||
fprintf([s0,'%s'],newString);
|
||||
end
|
||||
else
|
||||
waitbar(j/ntrans,h,['MC iteration ',int2str(j),'/',int2str(ntrans)])
|
||||
end
|
||||
end
|
||||
if exist('OCTAVE_VERSION') || (options_.console_mode == 1),
|
||||
fprintf('\n'),
|
||||
diary on,
|
||||
else
|
||||
close(h);
|
||||
end
|
||||
close(h)
|
||||
save(filetoload,'T','-append')
|
||||
elseif prepSA
|
||||
load(filetoload,'T')
|
||||
|
|
|
@ -73,7 +73,7 @@ if iplot
|
|||
ftit=bayestopt_.name(ipar+nshock*(1-ishock));
|
||||
|
||||
for i=1:ceil(nparplot/12),
|
||||
figure('name',aname),
|
||||
hh=figure('name',aname);
|
||||
for j=1+12*(i-1):min(nparplot,12*i),
|
||||
subplot(3,4,j-12*(i-1))
|
||||
if ~isempty(ibehaviour),
|
||||
|
@ -88,9 +88,11 @@ for i=1:ceil(nparplot/12),
|
|||
% title([ftit{j},'. D-stat ', num2str(dproba(ipar(j)),2)],'interpreter','none')
|
||||
title([ftit{j},'. p-value ', num2str(proba(ipar(j)),2)],'interpreter','none')
|
||||
end
|
||||
saveas(gcf,[dirname,'/',fname_,'_',aname,'_SA_',int2str(i)])
|
||||
eval(['print -depsc2 ' dirname '/' fname_ '_' aname '_SA_' int2str(i)]);
|
||||
eval(['print -dpdf ' dirname '/' fname_ '_' aname '_SA_' int2str(i)]);
|
||||
if options_.nograph, close(gcf), end
|
||||
eval(['print -depsc2 ' dirname '/' fname_ '_' aname '_SA_' int2str(i) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(hh,[dirname,'/',fname_,'_',aname,'_SA_',int2str(i)])
|
||||
eval(['print -dpdf ' dirname '/' fname_ '_' aname '_SA_' int2str(i)]);
|
||||
end
|
||||
if options_.nograph, close(hh), end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -59,7 +59,7 @@ for j=1:npar,
|
|||
j2=j2+1;
|
||||
if mod(j2,12)==1,
|
||||
ifig=ifig+1;
|
||||
figure('name',['Correlations in the ',fnam,' sample ', num2str(ifig)]),
|
||||
hh=figure('name',['Correlations in the ',fnam,' sample ', num2str(ifig)]);
|
||||
end
|
||||
subplot(3,4,j2-(ifig-1)*12)
|
||||
% bar(c0(i2,j)),
|
||||
|
@ -78,19 +78,23 @@ for j=1:npar,
|
|||
ylabel(bayestopt_.name{i2(jx)+nshock},'interpreter','none'),
|
||||
end
|
||||
title(['cc = ',num2str(c0(i2(jx),j))])
|
||||
if (mod(j2,12)==0) & j2>0,
|
||||
saveas(gcf,[dirname,'/',fig_nam_,int2str(ifig)])
|
||||
eval(['print -depsc2 ' dirname '/' fig_nam_ int2str(ifig)]);
|
||||
eval(['print -dpdf ' dirname '/' fig_nam_ int2str(ifig)]);
|
||||
if options_.nograph, close(gcf), end
|
||||
if (mod(j2,12)==0) && j2>0,
|
||||
eval(['print -depsc2 ' dirname '/' fig_nam_ int2str(ifig) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(hh,[dirname,'/',fig_nam_,int2str(ifig)])
|
||||
eval(['print -dpdf ' dirname '/' fig_nam_ int2str(ifig)]);
|
||||
end
|
||||
if options_.nograph, close(hh), end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if (j==(npar)) & j2>0,
|
||||
saveas(gcf,[dirname,'/',fig_nam_,int2str(ifig)])
|
||||
eval(['print -depsc2 ' dirname '/' fig_nam_ int2str(ifig)]);
|
||||
eval(['print -dpdf ' dirname '/' fig_nam_ int2str(ifig)]);
|
||||
if (j==(npar)) && j2>0,
|
||||
eval(['print -depsc2 ' dirname '/' fig_nam_ int2str(ifig) '.eps']);
|
||||
if ~exist('OCTAVE_VERSION'),
|
||||
saveas(gcf,[dirname,'/',fig_nam_,int2str(ifig)])
|
||||
eval(['print -dpdf ' dirname '/' fig_nam_ int2str(ifig)]);
|
||||
end
|
||||
if options_.nograph, close(gcf), end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue