function opshapewindow
%
%  Name:   opshapewindow
%
%  Usage:  opshapewindow
%
%  This m-file allows the user to 'slice' FRFs 
%  so an estimate of the frequencies and mode shapes can 
%  determined
% 

%  Version SWD970805
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 DISPLAY DATA MODES iaxesvec iaxes indsvec inds

%  Configure the DIAMOND buttons

hideallbtns
showall(HANDLES.hopshapeb)

%
%  Define the default DISPLAY plot parameters
%

if isempty(DISPLAY),
   
   DISPLAY{1}.haxes = HANDLES.hopshapeb(14);
   DISPLAY{1}.specfun{1} = 'FRF';
   DISPLAY{1}.displayfun{1} = 'SISO';
   DISPLAY{1}.iyscale  = 'MAG';
   DISPLAY{1}.iylog = 1;
   DISPLAY{1}.idatafile{1} = 1;
   DISPLAY{1}.iavg{1} = 1;   % Number of the average to display
   DISPLAY{1}.lnst{1} = '- ';
   DISPLAY{1}.lnco{1} = 'y';
   DISPLAY{1}.marker{1} = 'none';
   DISPLAY{1}.xlim = [DATA{1}.cf - DATA{1}.sp/2 , DATA{1}.cf + DATA{1}.sp/2];
   DISPLAY{1}.iresp{1} = 1;
   DISPLAY{1}.iref{1} = 1;
   DISPLAY{1}.lnlab{1} = 'Primary Data';

end

DISPLAY{1}.hcursor{1} = 1;
DISPLAY{1}.haxes = HANDLES.hopshapeb(14);
DISPLAY{1}.hlegax = [];
DISPLAY{1}.ioverlay = 0;

%  Set cursor line color

DISPLAY{1}.curslnco{1} = 'r';

indsvec = 1; % Only 1 line is visible on this plot
iaxesvec = 1; % Only 1 axis is visible 

iaxes = 1;   % Default axis is number 1
inds = 1;    % Default plot line is number 1

defspecdatavec(1)  % Define the spectral data vector in DISPLAY

%  Set initial cursor value

DISPLAY{1}.cursfreq{1} = DISPLAY{1}.xvec((end-1)/2+1);
DISPLAY{1}.dx = DISPLAY{1}.xvec(2) - DISPLAY{1}.xvec(1);

defdisplay(1)      % Apply the display function and the yscale selection to the spectral data vector in DISPLAY
plotdisplay(1)      % Plot the data in the DISPLAY global variable in the display window

%  Configure plot tools based on DISPLAY characteristics

configplttl(1,1)

%%
%%  CURSOR SETUP
%%

%  Set edit box string

set(HANDLES.hopshapeb(4),'string',num2str(DISPLAY{iaxes}.cursfreq{1}))

%  Set slider parameters

set(HANDLES.hopshapeb(2),'max',max(DISPLAY{iaxes}.xvec));
set(HANDLES.hopshapeb(2),'min',min(DISPLAY{iaxes}.xvec));
set(HANDLES.hopshapeb(2),'userdata',DISPLAY{iaxes}.xvec);
set(HANDLES.hopshapeb(2),'sliderstep',[DISPLAY{iaxes}.dx/(max(DISPLAY{iaxes}.xvec)- min(DISPLAY{iaxes}.xvec)) 0.1]);
set(HANDLES.hopshapeb(2),'value',DISPLAY{iaxes}.cursfreq{1});

%  Set up number of modes in identified set

if ~isfield(MODES,'nmodes')
   MODES.nmodes = 0;
end

figure(HANDLES.hfigdmnd)
rotate3d off

%%
%% ALL DONE
%%

return