function mctool
%   Name: mctool
%
%   Usage: mctool
%
%   Description: Creates the palette of statistical analysis tools 
%     (Monte Carlo and Bootstrap)
%
     
%
%  Version SWD970709
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This matlab source code was originally     %
% developed as part of "DIAMOND" at          %
% Los Alamos National Laboratory. It may     %
% be copied, modified, and distributed in    %
% any form, provided:                        %
%  a) This notice accompanies the files and  %
%     appears near the top of all source     %
%     code files.                            %
%  b) No payment or commercial services are  %
%     received in exchange for the code.     %
%                                            %
% Original copyright is reserved by the      %
% Regents of the University of California,   %
% in addition to Scott W. Doebling, Phillip  %
% J. Cornwell, Erik G. Straser, and Charles  %
% R. Farrar.                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global HANDLES MODES

%
%  Initialize variables
%

MODES.nstatiter = 10; % nstatiter is number of statistical iterations
MODES.istatmeth = 'None'; % Possible values: 'None','Monte Carlo','Bootstrap'

HANDLES.hmctl(1) = figure('units','pixel','position',[40 40 300 150 ],...
			'menubar','none','numbertitle','off','resize','off',...
			'name','Diamond: Statistical Analysis Setup','visible','off');

top=.95;
left=.05;
btnwd=.75;
btnht=.12;
spacing=.01;

%
%  Popup menu to select the statistical technique
%

btnnum=2;
ypos=top-(btnnum-1)*(btnht+spacing);
btnpos=[left ypos-btnht btnwd btnht];

HANDLES.hmctl(6) = uicontrol(HANDLES.hmctl(1),...
   'style','popup',...
	'position',btnpos,...
   'string','None|Monte Carlo|Bootstrap',...
   'visible','on',...
   'callback',...
   ['switch get(HANDLES.hmctl(6),''value''),',...
    'case 1, MODES.istatmeth = ''None'';',...
    '   set(HANDLES.hmctl(2:3),''visible'',''off''),',...
    'case 2, MODES.istatmeth = ''Monte Carlo'';',...
    '   set(HANDLES.hmctl(2:3),''visible'',''on''),',...
    'case 3, MODES.istatmeth = ''Bootstrap'';',...
    '   set(HANDLES.hmctl(2:3),''visible'',''on''),',...
    'end,',...
]);

%
%  Text selector of number of iterations
%

btnnum=4;
ypos=top-(btnnum-1)*(btnht+spacing);
btnpos=[left ypos-btnht btnwd btnht];

HANDLES.hmctl(2) = uicontrol(HANDLES.hmctl(1),...
   'style','text',...
   'position',btnpos,...
   'string','Number of Stat. Analysis Runs:',...
   'visible','off');

btnpos(1) = btnpos(1) + btnpos(3);
btnpos(3) = btnpos(3)/6;

HANDLES.hmctl(3) = uicontrol(HANDLES.hmctl(1),...
		'style','edit',...
	   'position',btnpos,...
      'visible','off',...
      'string',num2str(MODES.nstatiter),...
      'callback','MODES.nstatiter = str2num(get(HANDLES.hmctl(3),''string''));');


%
%  Close Button
%

btnpos = [0.8 0.2 0.2 0.1];
HANDLES.hmctl(4) = uicontrol(HANDLES.hmctl(1),...
	'style','push',...
	'units','normal',...
	'position',btnpos,...
	'string','Close',...
   'call','set(HANDLES.hmctl(1),''visible'',''off'')');

return