For many users, WAVE's data analysis capabilities will be of greatest
interest.  WAVE itself does not perform analysis of the signals or
annotations it displays.  What WAVE offers is an easy-to-use means of
controlling external analysis programs and viewing their outputs.  The buttons
in the Analyze panel activate these external programs.  These buttons are easy
to create -- in fact, you can add your own buttons to those in the Analyze
panel while WAVE is running.

The controls at the top of the Analyze panel are always the same:
  Start:	The time at which analysis should begin.  When WAVE starts up,
		the contents of this field are `beginning of record'.  To
		change it, either type a time (such as `2:25') into this field,
		or insert a `start of analysis' (`<') marker (see `Editing').
  End:		The time at which analysis should end.  When WAVE starts up,
		the contents of this field are `end of record'.  To change it,
		either type a time into this field, or insert an `end of
		analysis' (`>') marker.
  Signal:	The signal number of the selected signal.  To select a signal,
		either enter its number in this field directly, or point to the
		desired signal in the signal window, depress the <Shift> key,
		and click left.  The selected signal is highlighted if a
		selection has been made since the signal window was redrawn.
  Signal list:	An ordered list of signal numbers specifying which signals are
		to be analyzed, printed, or displayed.  When WAVE starts up,
		the signal list contains all of the available signals for the
		record.  A signal may appear more than once in the signal list.
		To change the signal list, either:
		 1. type directly into the list; or
		 2. point to a signal, then depress the <Control> key and click
		    left (to add it to the list), or depress the <Meta> key
		    and click left (to delete its first occurrence, if any,
		    from the list).
		Note: by default, WAVE displays all available signals, not just
		those on the signal list.  To display the listed signals only,
		change the `Draw' selection in the `View' window.
  Show scope window
		Press this button to open WAVE's `oscilloscope' window.
  Show command window
		Press this button to reopen the Analysis commands window if
		you have closed it.
  Edit menu	Press this button to open an editor window containing WAVE's
		menu file (see below).
  Reread menu	Press this button to force WAVE to reread the menu file (be
		sure to save your changes first) and to reconfigure the Analyze
		panel.  The Analyze panel briefly disappears before returning
		(possibly in a different location on the screen, depending on
		your window manager).

The remaining buttons in the Analyze panel (both their labels and the actions
they perform) are specified by WAVE's menu file.  WAVE's menu file may be named
by the enviroment variable WAVEMENU.  If WAVEMENU is not set, WAVE reads a
file called `wavemenu' if it exists in the current directory, or the system
default menu file (usually `wavemenu.def' in /usr/local/lib) otherwise.

In menu files, comment lines begin with `#'.  The comments at the beginning of
the default menu file describe how it works.  Except for those listed above,
each of the buttons in the Analyze panel corresponds to an entry in the menu
file.  The first part of the entry -- up to the first tab character --
specifies the label that appears on the button; the remainder of the entry
specifies the command that is inserted into the Analysis commands window if you
click left on the button.  Certain strings that begin with `$' are interpreted
by WAVE before being passed to the shell in the Analysis commands window:
	$RECORD		the current record name
	$ANNOTATOR	the current input annotator name
	$START		the current `Start' time as shown in the Analyze panel
			 (the time of the `<' marker, if any)
	$END		the current `End' time as shown in the Analyze panel
			 (the time of the `>' marker, if any)
	$DURATION	the time interval between $END and $START
	$LEFT		the time of the left edge of the signal display window
	$RIGHT		the time of the right edge of the signal display window
	$WIDTH		the time interval between $RIGHT and $LEFT
	$SIGNAL		the number of the selected signal
	$SIGNALS	the signal list
	$LOG		the name of the current log file
	$WFDB		the WFDB path (from the Load panel)
	$WFDBCAL	the name of the WFDB calibration file (from the Load
			  panel)

Other strings that begin with `$' are passed to the shell unchanged.  The
character `\', if immediately followed by a newline, causes the next line to be
treated as a continuation of the current line.

In the default WAVE menu, for example, the `List annotations' and `List
samples' buttons are specified as:
  List annotations	rdann -r $RECORD -a $ANNOTATOR -f $START -t $END
  List samples		rdsamp -r $RECORD -f $START -t $END -s $SIGNALS
(Refer to the `man' pages for `rdann' and `rdsamp', or to the ECG Database
Applications Guide, for details on how these programs interpret their
command-line arguments.)

A common problem in many cases is simply selecting a segment to be analyzed,
from a digitized signal file that may include extraneous material at the
beginning or at the end.  This can be done easily by inspecting the signals
with WAVE and placing `<' and `>' markers at the beginning and end of the
region of interest.  If the analysis program is written to accept starting and
ending times, these times can be passed as command-line arguments by WAVE,
as in the examples above.  Similarly, it's simple to choose one or more of a
larger number of signals to be analyzed after viewing them with WAVE (as in
the `List samples' example).

Editing WAVE's menu file
------------------------

When you click left on `Edit menu' in the Analyze panel, WAVE's menu file
appears in an OpenWindows `textedit' window, unless you have specified a
different editor by setting the EDITOR environment variable.  The command
needed to start the editor appears in the Analysis commands window.  If you
have changed directories within the Analysis commands window, and the name
of WAVE's menu file does not begin with `/', the editor may not open the
correct menu file.  If this happens, exit from the editor, return to the
original directory in the Analysis commands window, and try again.

If WAVEMENU is not set, `wavemenu' doesn't exist, and you click on `Edit menu',
WAVE pops up a notice:
	    You are now using the system default menu file,
	           which you may not edit directly.
          Press `Copy' to copy it into the current directory
	    as `wavemenu' (and remember to set the WAVEMENU
	           environment variable next time),
			        - or -
          Press `Quit' if you prefer not to edit a menu file.
If you select `Copy', you will be able to edit the copy as many times as you
wish in the current session of WAVE.  If you wish to use the edited menu in
future sessions, WAVEMENU should be set to the path name of your customized
menu file (you can give the menu file any name you choose).  For example, if
you use the C-shell, and `wavemenu' is in your home directory, use the command
    setenv WAVEMENU ~/wavemenu
before running WAVE again.  You may wish to add this command to your `.login'
script to set the variable automatically each time you log in.

Be careful when editing the menu file to keep at least one <tab> character
between each button label and its associated command.  If you cut-and-paste
(or drag-and-drop) menu entries from another window, tabs may have been
converted to spaces.

When you have finished editing the menu file, save your work and exit from
the editor before clicking on `Reread menu' in the Analyze panel.
