Skip to content

Commit

Permalink
Option to hide windows in ple calculation
Browse files Browse the repository at this point in the history
Use flag hideWindows to hide calculation of ple and waitbar.
Use flag ar.config.noWaitBarWindow to move waitbar to command line output in general.
Use flag ar.config.noWaitBar to hide waitbar completely.
  • Loading branch information
fgwieland committed Jan 17, 2024
1 parent e9dbb68 commit d558983
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
12 changes: 8 additions & 4 deletions arFramework3/MatlabTools/arWaitbar.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ function arWaitbar(j, n, text)
global arWaitbarGlobal;
global arOutputLevel;

global ar;
% disable waitbar window and use command line output instead
if ~isfield(arWaitbarGlobal,'showWindow')
arWaitbarGlobal.showWindow = 1;
if ( isfield( ar, 'config' ) && isfield( ar.config, 'noWaitBarWindow' ) && ar.config.noWaitBarWindow == 1 )
arWaitbarGlobal.showWindow = 0;
else
if ~isfield(arWaitbarGlobal,'showWindow')
arWaitbarGlobal.showWindow = 1;
end
end

global ar;
if ( isfield( ar, 'config' ) && isfield( ar.config, 'noWaitBar' ) && ar.config.noWaitBar == 1 )
return;
end
Expand Down Expand Up @@ -116,7 +120,7 @@ function arWaitbar(j, n, text)
sprintf('%s\n%i/%i %2i%% %s -> %s%s', ...
strrep(text, '_','\_'), j, n, round(j/n*100), secToHMS(timeleft), secToHMS(timeelapsed), funtext));
else
fprintf('%s %i/%i %2i%% %s -> %s%s\n', ...
fprintf('%s %i/%i %2i%% Estimated: %s -> Elapsed: %s%s\n', ...
strrep(text, '_','\_'), j, n, round(j/n*100), secToHMS(timeleft), secToHMS(timeelapsed), funtext);
drawnow;
end
Expand Down
14 changes: 12 additions & 2 deletions arFramework3/PLE/ple.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% ple([i], [samplesize], [relchi2stepincrease], [maxstepsize], [minstepsize], [breakonbounds], [doLeftRightBranch])
% ple([i], [samplesize], [relchi2stepincrease], [maxstepsize], [minstepsize], [breakonbounds], [doLeftRightBranch],[hideWindows])
%
% Profile Likelihood Exploit
%
Expand All @@ -18,6 +18,8 @@
% break regardless for the profile parameter if it
% reaches the boundary.
% doLeftRightBranch calculate left/right branch [true true]
% hideWindows hide windows of calculation and [false]
% wait bar
%
% The profile likelihood calculation by the functions ple* was intended
% as running independent of D2D, i.e. it was intended to be also used by
Expand All @@ -29,7 +31,7 @@
% See also: arPLEInit, pleExtend, pleSmooth

function ple(jk, samplesize, relchi2stepincrease, ...
maxstepsize, minstepsize, breakonlb, breakonub, doLeftRightBranch)
maxstepsize, minstepsize, breakonlb, breakonub, doLeftRightBranch,hideWindows)

global ar

Expand Down Expand Up @@ -89,6 +91,14 @@ function ple(jk, samplesize, relchi2stepincrease, ...
doLeftRightBranch = [true true];
end

if(~exist('hideWindows','var') || isempty(hideWindows))
hideWindows = false;
end
if hideWindows == true
ar.ple.showCalculation = false;
ar.config.noWaitBarWindow = true;
end

% Specifications on what to do if there are more than 1 parameter. The
% function ple will evaluate itself for every parameter separately.
if(nargin<1)
Expand Down

0 comments on commit d558983

Please sign in to comment.