Unverified Commit e3bc7250 authored by Houtan Bastani's avatar Houtan Bastani Committed by GitHub

Merge pull request #1574 from JohannesPfeifer/octave_prior

Make Octave error message more constructive and informative
parents 1d1a9123 2e69ae22
...@@ -53,9 +53,9 @@ switch pshape(indx) ...@@ -53,9 +53,9 @@ switch pshape(indx)
infbound = gaminv(truncprior,p6(indx),p7(indx))+p3(indx); infbound = gaminv(truncprior,p6(indx),p7(indx))+p3(indx);
supbound = gaminv(1-truncprior,p6(indx),p7(indx))+p3(indx); supbound = gaminv(1-truncprior,p6(indx),p7(indx))+p3(indx);
catch catch
% Workaround for ticket #161 % Workaround for ticket #161, see http://savannah.gnu.org/bugs/?52569
if isoctave if isoctave
error(['Due to a bug in Octave, you must choose other values for mean and/or variance of your prior on ' bayestopt_.name{indx} ', or use another shape']) error(['Due to a computational limitation in Octave, the prior cannot be plotted. You must either use plot_priors=0 or choose other values for mean and/or variance of your prior on ' bayestopt_.name{indx} ', or use another shape'])
else else
rethrow(lasterror) rethrow(lasterror)
end end
...@@ -72,9 +72,9 @@ switch pshape(indx) ...@@ -72,9 +72,9 @@ switch pshape(indx)
infbound = 1/sqrt(gaminv(1-10*truncprior, p7(indx)/2, 2/p6(indx)))+p3(indx); infbound = 1/sqrt(gaminv(1-10*truncprior, p7(indx)/2, 2/p6(indx)))+p3(indx);
supbound = 1/sqrt(gaminv(10*truncprior, p7(indx)/2, 2/p6(indx)))+p3(indx); supbound = 1/sqrt(gaminv(10*truncprior, p7(indx)/2, 2/p6(indx)))+p3(indx);
catch catch
% Workaround for ticket #161 % Workaround for ticket #161, see http://savannah.gnu.org/bugs/?52569
if isoctave if isoctave
error(['Due to a bug in Octave, you must choose other values for mean and/or variance of your prior on ' bayestopt_.name{indx} ', or use another shape']) error(['Due to a computational limitation in Octave, the prior cannot be plotted. You must either use plot_priors=0 or choose other values for mean and/or variance of your prior on ' bayestopt_.name{indx} ', or use another shape'])
else else
rethrow(lasterror) rethrow(lasterror)
end end
...@@ -91,9 +91,9 @@ switch pshape(indx) ...@@ -91,9 +91,9 @@ switch pshape(indx)
infbound = 1/(gaminv(1-10*truncprior, p7(indx)/2, 2/p6(indx)))+p3(indx); infbound = 1/(gaminv(1-10*truncprior, p7(indx)/2, 2/p6(indx)))+p3(indx);
supbound = 1/(gaminv(10*truncprior, p7(indx)/2, 2/p6(indx)))+p3(indx); supbound = 1/(gaminv(10*truncprior, p7(indx)/2, 2/p6(indx)))+p3(indx);
catch catch
% Workaround for ticket #161 % Workaround for ticket #161, see http://savannah.gnu.org/bugs/?52569
if isoctave if isoctave
error(['Due to a bug in Octave, you must choose other values for mean and/or variance of your prior on ' bayestopt_.name{indx} ', or use another shape']) error(['Due to a computational limitation in Octave, the prior cannot be plotted. You must either use plot_priors=0 or choose other values for mean and/or variance of your prior on ' bayestopt_.name{indx} ', or use another shape'])
else else
rethrow(lasterror) rethrow(lasterror)
end end
......
...@@ -92,9 +92,9 @@ for i=1:length(p6) ...@@ -92,9 +92,9 @@ for i=1:length(p6)
bounds.lb(i) = gaminv(prior_trunc,p6(i),p7(i))+p3(i); bounds.lb(i) = gaminv(prior_trunc,p6(i),p7(i))+p3(i);
bounds.ub(i) = gaminv(1-prior_trunc,p6(i),p7(i))+p3(i); bounds.ub(i) = gaminv(1-prior_trunc,p6(i),p7(i))+p3(i);
catch catch
% Workaround for ticket #161 % Workaround for ticket #161, see http://savannah.gnu.org/bugs/?52569
if isoctave if isoctave
error(['Due to a bug in Octave, you must choose other values for mean and/or variance of your prior on ' bayestopt.name{i} ', or use another shape']) error(['Due to a computational limitation in Octave, the prior bounds cannot be computed. You must either use prior_trunc=0 or choose other values for mean and/or variance of your prior on ' bayestopt.name{i} ', or use another shape'])
else else
rethrow(lasterror) rethrow(lasterror)
end end
...@@ -117,9 +117,9 @@ for i=1:length(p6) ...@@ -117,9 +117,9 @@ for i=1:length(p6)
bounds.lb(i) = 1/sqrt(gaminv(1-prior_trunc, p7(i)/2, 2/p6(i)))+p3(i); bounds.lb(i) = 1/sqrt(gaminv(1-prior_trunc, p7(i)/2, 2/p6(i)))+p3(i);
bounds.ub(i) = 1/sqrt(gaminv(prior_trunc, p7(i)/2, 2/p6(i)))+p3(i); bounds.ub(i) = 1/sqrt(gaminv(prior_trunc, p7(i)/2, 2/p6(i)))+p3(i);
catch catch
% Workaround for ticket #161 % Workaround for ticket #161, see http://savannah.gnu.org/bugs/?52569
if isoctave if isoctave
error(['Due to a bug in Octave, you must choose other values for mean and/or variance of your prior on ' bayestopt.name{i} ', or use another shape']) error(['Due to a computational limitation in Octave, the prior bounds cannot be computed. You must either use prior_trunc=0 or choose other values for mean and/or variance of your prior on ' bayestopt.name{i} ', or use another shape'])
else else
rethrow(lasterror) rethrow(lasterror)
end end
...@@ -142,9 +142,9 @@ for i=1:length(p6) ...@@ -142,9 +142,9 @@ for i=1:length(p6)
bounds.lb(i) = 1/gaminv(1-prior_trunc, p7(i)/2, 2/p6(i))+p3(i); bounds.lb(i) = 1/gaminv(1-prior_trunc, p7(i)/2, 2/p6(i))+p3(i);
bounds.ub(i) = 1/gaminv(prior_trunc, p7(i)/2, 2/p6(i))+ p3(i); bounds.ub(i) = 1/gaminv(prior_trunc, p7(i)/2, 2/p6(i))+ p3(i);
catch catch
% Workaround for ticket #161 % Workaround for ticket #161, see http://savannah.gnu.org/bugs/?52569
if isoctave if isoctave
error(['Due to a bug in Octave, you must choose other values for mean and/or variance of your prior on ' bayestopt.name{i} ', or use another shape']) error(['Due to a computational limitation in Octave, the prior bounds cannot be computed. You must either use prior_trunc=0 or choose other values for mean and/or variance of your prior on ' bayestopt.name{i} ', or use another shape'])
else else
rethrow(lasterror) rethrow(lasterror)
end end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment