From 832f8ee82f8f49830655afebeca052e3f86797be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Scylla=29?= Date: Fri, 13 Dec 2013 12:41:57 +0100 Subject: [PATCH] Bug fixes (related to the loading of the mcmc files) + Cosmetic changes. --- matlab/check_posterior_analysis_data.m | 22 +++++++++++----------- matlab/get_name_of_the_last_mh_file.m | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/matlab/check_posterior_analysis_data.m b/matlab/check_posterior_analysis_data.m index 96c9e78ae..a968fdbe6 100644 --- a/matlab/check_posterior_analysis_data.m +++ b/matlab/check_posterior_analysis_data.m @@ -22,16 +22,18 @@ if nargout>1 description = ''; end -%% Get informations about mcmc files. +MetropolisFolder = CheckPath('metropolis',M_.dname); + +% Get informations about mcmc files. if ~exist([ M_.dname '/metropolis'],'dir') disp('check_posterior_analysis_data:: Can''t find any mcmc file!') return end mhname = get_name_of_the_last_mh_file(M_); -mhdate = get_date_of_a_file(mhname); +mhdate = get_date_of_a_file([MetropolisFolder filesep mhname]); -%% Get informations about _posterior_draws files. -drawsinfo = dir([ M_.dname '/metropolis/' M_.fname '_posterior_draws*.mat']); +% Get informations about _posterior_draws files. +drawsinfo = dir([ MetropolisFolder filesep M_.fname '_posterior_draws*.mat']); if isempty(drawsinfo) info = 1; % select_posterior_draws has to be called first. if nargout>1 @@ -40,8 +42,7 @@ if isempty(drawsinfo) return else number_of_last_posterior_draws_file = length(drawsinfo); - pddate = get_date_of_a_file([ M_.dname '/metropolis/' M_.fname '_posterior_draws'... - int2str(number_of_last_posterior_draws_file) '.mat']); + pddate = get_date_of_a_file([ MetropolisFolder filesep M_.fname '_posterior_draws' int2str(number_of_last_posterior_draws_file) '.mat']); if pddate1 @@ -56,7 +57,7 @@ else end end -%% Get informations about posterior data files. +% Get informations about posterior data files. switch type case 'variance' generic_post_data_file_name = 'Posterior2ndOrderMoments'; @@ -69,7 +70,7 @@ switch type otherwise disp('This feature is not yest implemented!') end -pdfinfo = dir([ M_.dname '/metropolis/' M_.fname '_' generic_post_data_file_name '*']); +pdfinfo = dir([ MetropolisFolder filesep M_.fname '_' generic_post_data_file_name '*']); if isempty(pdfinfo) info = 4; % posterior draws have to be processed. if nargout>1 @@ -79,8 +80,7 @@ if isempty(pdfinfo) else number_of_the_last_post_data_file = length(pdfinfo); name_of_the_last_post_data_file = ... - [ pwd filesep M_.dname ... - filesep 'metropolis' filesep ... + [ pwd filesep MetropolisFolder filesep ... M_.fname '_' ... generic_post_data_file_name ... int2str(number_of_the_last_post_data_file) ... @@ -95,6 +95,6 @@ else info = 6; % Ok (nothing to do ;-) if nargout>1 description = 'There is nothing to do'; - end + end end end \ No newline at end of file diff --git a/matlab/get_name_of_the_last_mh_file.m b/matlab/get_name_of_the_last_mh_file.m index ece295acb..763435125 100644 --- a/matlab/get_name_of_the_last_mh_file.m +++ b/matlab/get_name_of_the_last_mh_file.m @@ -33,7 +33,7 @@ info = 1; MetropolisFolder = CheckPath('metropolis',M_.dname); ModelName = M_.fname; -BaseName = [MetropolisFolder, ModelName]; +BaseName = [MetropolisFolder filesep ModelName]; load_last_mh_history_file(MetropolisFolder, ModelName); @@ -44,7 +44,7 @@ predicted_mhname = [ BaseName '_mh' int2str(mh_number) '_blck' int2str(bk_number all_mh_files = dir([BaseName '_mh*_blck*' ]); [junk,idx] = sort([all_mh_files.datenum]); -mhnamme = all_mh_files(idx(end)).name; +mhname = all_mh_files(idx(end)).name; if ~strcmpi(mhname,predicted_mhname) info = 0;