From 411ec42e3240f2bc0e95eb0d8f340c0236929ae6 Mon Sep 17 00:00:00 2001 From: Marco Ratto <marco.ratto@jrc.ec.europa.eu> Date: Tue, 14 Nov 2017 18:08:19 +0100 Subject: [PATCH] - bug fix for when NO parameter is detected below pvalue threshold - fix to the case when no plot is done when there are too few behavioral/non-behavioral runs [as it already happens when one of the two sets is empty] - added more explicit messages on screen (cherry picked from commit ec35210e06ac45a46da52c272d78173990cb92c4) --- matlab/gsa/redform_map.m | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/matlab/gsa/redform_map.m b/matlab/gsa/redform_map.m index a7ae7f712..1f72a9306 100644 --- a/matlab/gsa/redform_map.m +++ b/matlab/gsa/redform_map.m @@ -232,10 +232,27 @@ for j=1:size(anamendo,1) istable=[1:length(iy)]; save([xdir,filesep, fname_ '_' type '_' namendo,'_vs_', namexo '_threshold' ],'lpmat','lpmat0','istable','y0','x0','xx0','iy','iyc') lpmat=[]; lpmat0=[]; istable=[]; + if length(iy)<=10 || length(iyc)<=10 + icheck = []; % do the generic plot in any case + end else icheck=[]; end if isempty(icheck) + if length(iy)<=10 + if isempty(iy) + disp(['There are NO MC samples in the desired range [' num2str(threshold) ']!']) + else + disp(['There are TOO FEW (<=10) MC samples in the desired range [' num2str(threshold) ']!']) + end + elseif length(iyc)<=10 + if isempty(iyc) + disp(['ALL MC samples are in the desired range [' num2str(threshold) ']!']) + else + disp(['Almost ALL MC samples are in the desired range [' num2str(threshold) ']!']) + disp('There are TOO FEW (<=10) MC samples OUTSIDE the desired range!') + end + end atitle0=['Monte Carlo Filtering for ',namendo,' vs ', namexo]; options_mcf.title = atitle0; indmcf = redform_mcf(y0, x0, options_mcf, options_); @@ -280,6 +297,8 @@ for j=1:size(anamendo,1) end end + else + disp(['This entry in the shock matrix is CONSTANT = ' num2str(mean(y0),3)]) end end end @@ -369,11 +388,28 @@ for j=1:size(anamendo,1) istable=[1:length(iy)]; save([xdir,filesep, fname_ '_' type '_' namendo,'_vs_', namlagendo '_threshold' ],'lpmat','lpmat0','istable','y0','x0','xx0','iy','iyc') lpmat=[]; lpmat0=[]; istable=[]; + if length(iy)<=10 || length(iyc)<=10, + icheck = []; % do the generic plot in any case + end else icheck = []; end if isempty(icheck) + if length(iy)<=10 + if isempty(iy) + disp(['There are NO MC samples in the desired range [' num2str(threshold) ']!']) + else + disp(['There are TOO FEW (<=10) MC samples in the desired range [' num2str(threshold) ']!']) + end + elseif length(iyc)<=10 + if isempty(iyc) + disp(['ALL MC samples are in the desired range [' num2str(threshold) ']!']) + else + disp(['Almost ALL MC samples are in the desired range [' num2str(threshold) ']!']) + disp('There are TOO FEW (<=10) MC samples OUTSIDE the desired range!') + end + end atitle0=['Monte Carlo Filtering for ',namendo,' vs ', namlagendo]; options_mcf.title = atitle0; indmcf = redform_mcf(y0, x0, options_mcf, options_); @@ -417,6 +453,8 @@ for j=1:size(anamendo,1) end end + else + disp(['This entry in the transition matrix is CONSTANT = ' num2str(mean(y0),3)]) end end end @@ -736,6 +774,11 @@ for jt=1:10 end [proba, dproba] = stab_map_1(x0, indy{1}, indy{end}, [],0); indmcf=find(proba<options_mcf.pvalue_ks); +if isempty(indmcf) + [tmp,jtmp] = sort(proba,2,'ascend'); + indmcf = jtmp(1); +% indmcf = jtmp(1:min(2,length(proba))); +end [tmp,jtmp] = sort(proba(indmcf),2,'ascend'); indmcf = indmcf(jtmp); nbr_par = length(indmcf); -- GitLab