# catcher_v1.pro

At APS this program is installed in the /usr/local/epics/extensions/bin/$HOST_ARCH directory. This program normally is automatically invoked by the script command catcher.

# List of Routines

- BOX_CURSOR
- CATCHER_V1
- XDISPLAYFILE

# Routine Descriptions

## BOX_CURSOR

[Next Routine] [List of Routines]

     NAME:
    	BOX_CURSOR

     PURPOSE:
    	Emulate the operation of a variable-sized box cursor (also known as
    	a "marquee" selector).

     CATEGORY:
    	Interactive graphics.

     CALLING SEQUENCE:
    	BOX_CURSOR, x0, y0, nx, ny [, INIT = init] [, FIXED_SIZE = fixed_size]

     INPUTS:
    	No required input parameters.

     OPTIONAL INPUT PARAMETERS:
    	x0, y0, nx, and ny give the initial location (x0, y0) and
    	size (nx, ny) of the box if the keyword INIT is set.  Otherwise, the
    	box is initially drawn in the center of the screen.

     KEYWORD PARAMETERS:
    	INIT:  If this keyword is set, x0, y0, nx, and ny contain the initial
    	parameters for the box.

    	FIXED_SIZE:  If this keyword is set, nx and ny contain the initial
    	size of the box.  This size may not be changed by the user.

    	MESSAGE:  If this keyword is set, print a short message describing
    	operation of the cursor.

     OUTPUTS:
    	x0:  X value of lower left corner of box.
    	y0:  Y value of lower left corner of box.
    	nx:  width of box in pixels.
    	ny:  height of box in pixels.

    	The box is also constrained to lie entirely within the window.

     COMMON BLOCKS:
    	None.

     SIDE EFFECTS:
    	A box is drawn in the currently active window.  It is erased
    	on exit.

     RESTRICTIONS:
    	Works only with window system drivers.

     PROCEDURE:
    	The graphics function is set to 6 for eXclusive OR.  This
    	allows the box to be drawn and erased without disturbing the
    	contents of the window.

    	Operation is as follows:
    	Left mouse button:   Move the box by dragging.
    	Middle mouse button: Resize the box by dragging.  The corner
    		nearest the initial mouse position is moved.
    	Right mouse button:  Exit this procedure, returning the
    			     current box parameters.

     MODIFICATION HISTORY:
    	DMS, April, 1990.
    	DMS, April, 1992.  Made dragging more intutitive.
    	June, 1993 - Bill Thompson
    			prevented the box from having a negative size.
           04-18-96   bkc  Made the box color more visible.
           05-28-98   bkc  Reset bounding box color

(See catcher_v1.pro)

## CATCHER_V1

[Previous Routine] [Next Routine] [List of Routines]

     NAME:
    	CATCHER_V1

     PURPOSE:
           EPICS 3.12.2 Scan record data acquistion tool.

           This program provides the EPICS user a convenient IDL data
           acquistion tool.  It calls the IDL external CA functions which
           are defined in the ezcaIDL package.

           Currently, this program can capture both 1D and 2D scan data
           through setting monitor on the EPICS scan record. During data
           acquisition it also provides real-time plotting. Post acquisition
           it also provides primitive 1D and 2D post data plot and analysis.
           Each scan record can support up-to four positioners and fifteen
           detectors."

     CATEGORY:
    	Widgets.

     CALLING SEQUENCE:
    	CATCHER_V1

     INPUTS:
    	None

     KEYWORD PARAMETERS:
         CONFIG:   Specifies the configuration file to be saved when data
                   catcher is normally terminated. If not specified, the
                   default configuration file name 'catch1d.config' is
                   assumed.
         DATA:     Specifies the data file name to be used for appending
                   new captured scan data. If not specified, the default
                   data file name 'catch1d.trashcan.xdr' is assumed.
         ENVFILE:  Specifies the environment (process variables) file to
                   be saved with the captured scan data. If not specified,
                   the default environment file name 'catch1d.env' is
                   assumed.
         NOSAVE:   Turns off the autosave feature. If it is specified, the
                   data catcher will be able to display the life data but
                   data will not be recorded.
         VIEWONLY: Runs the data catcher as a scan data browser. If it is
                   specified, it can only display the recorded scan data
                   from a saved data file.
         GROUP:    The widget ID of the group leader of the widget.  If this
                   keyword is specified, the death of the group leader results in
                   the death of CATCHER_V1.

     OUTPUTS:
           It provides realtime plot and various post acquistion 1D and
           2D surface plot. In addition of DATA file is saved, if 2D scan
           is detected the DATA.image file will also be saved at the end
           of 2D scan. Various levels of report files can also be generated
           by this program.  All the file generated will be prefixed by the
           DATA file name.

     COMMON BLOCKS:
           CATCH1D_COM
           W_PLOTSPEC_BLOCK
           W_VIEWSCAN_BLOCK
           REALTIME_BLOCK
           ENV_FIELD_BLOCK
           FIELD_BLOCK

     SIDE EFFECTS:
           It is capable to detect scan invoked by outside channel access
           client.

     RESTRICTIONS:
           Supports EPICS 3.12.2 and later scan record.

     PROCEDURE:
           For live data acquisition: boot the IOC first, setup and initialize
           the scan records, setup the run ezcaIDL environment, run IDL,
           then start up the data catcher at the IDL prompt.

           A simplified UNIX script file catcher can be used for starting up
           this program. For help on catcher enter "catcher -h" at the UNIX
           prompt.

     EXAMPLE:
           Use default setting for config, envfile, and data file

           CATCHER_V1

           Override the default setting for config, envfile, and data file,
           the 'test' is used for this example.

           CATCHER_V1, CONFIG='test.config', ENVFILE='test.env', DATA='test.dat'

     MODIFICATION HISTORY:
           Written by:     Ben-chin K. Cha, 02-27-96.

           04-16-96  bkc  - Reduce the data catcher window size by moving scan
                            pvname entries to a pop up setup window
                          - Realtime trend plot against the real time axis is
                            implemented
                          - Realtime plot also displays the scan record name
                          - Fix various miscellaneous replot bugs
                          - Add option of accessing HTML documents on help menu

           04-29-96 bkc   - Modified pv status, main window manager, release
                            note 1.4
           09-30-96 bkc   - Implemented more new features, dialog windows,
                            exceptional catches, check for non saved scan
                            data, improve the efficiency, release note 1.5.1
                            etc...
           11-07-96 bkc   - Monitor positioner readback name, debug option,
                            various realtime plot option
           12-13-96 bkc   - Modified index file updating, aborting 2D scan,
                            image file location, report location
           07-23-97 bkc   - Added image strip to show all 15 detectors 2D image
                            (two sizes are available);
                            Added the support for different operating system, eg
                            UNIX or W95 (see SYSTEM_BLOCK, os.init);
                            Modified to run under IDL4.0.1 as well as IDL5.0
           08-08-97 bkc   - Release R2.1 changes
                            Fix the problem of 'No Save', wrong X, Y array due
                            to user aborting 2D scans from the MEDM screen
                            Database desc info for detectors are added to
                            the 2D image data
           09-08-97 bkc   - Release R2.2.X changes
                            Supports both XDR and native type data format
                            If no configuration file exists, it defaults to XDR
                            format
                            Add the curve fitting menu support
    			 Add the color support for the 24 bit visual display
    			 Fix the problem with xmax plot range exceeds the
                            valid int range 64000
           01-28-98 bkc   - Fix the trend analysis problem if time exceeds 32000
                            Fix the error in standard deviation calc if max occurs
                            at y(0)
           02-04-98 bkc   - Add realtime 2D image options for any selected detector
           02-06-98 bkc   - Fix the realtime problem of setting NPTS exceeds 1724
                            Fix the problem with 2D header on 1D drawing area
                            Fix automatic ylog plot scale problem
           02-11-98 bkc   - Allows the user enter any Y scan PV name
    			 Automatic figure out bad file selected
           02-19-98 bkc   - Load default color table once only, use the common
                            color table between view1d, view2d, default line
    			 color defined in catch1d.tbl save by IDL5
           02-27-98 bkc   - Make the File menu sensitive if 'NoSave' is specified
                            in configuration file for 2D scan
           03-02-98 bkc   - Fix Y log plot yrange not defined problem
           03-13-98 bkc   - Fix the realtime plot problem for loading table
                            positioner array
           03-24-98 bkc   - Fix the problem of runtime version the user specified
                            configuration file did not get updated but the
                            'catch1d.config' got updated
           04-14-98 bkc   - Add checking for the wrong type of file picked
           04-15-98 bkc   - Fix the print problem in cw_term function
           05-15-98 bkc   - Eliminate the repeat of 1st scan in 2D scan
                            Use P1DV value as y(0) value for 1D plot
           09-26-98 bkc   - Add Y-vector to hold the y-value for 2D scan (dim 2001)
           11-24-98 bkc   - R2.2.2b
                            New data acquisition will be saved in XDR format.
                            Data catcher will be in viewing mode only if the old
                            data is used.
                            Fix the read problem introduced by the user due to
                            too many characters entered in the comment field.
           12-08-98 bkc   - R2.2.2c Port to W95
           01-12-99 bkc   - Dynamic read in u_read,PS_open,cw_term sources
           01-20-99 bkc   - Fix nosave option at start up it stays nosave option
                            until a new file is entered
                          - Fix viewonly option at start up it stays nosave option
                            until a new file is entered
           02-02-99 bkc   - R2.2.2d
                            Fix the File->Copy option it will not work if detectors;                        number exceeds 11
                            Add the pop up message window to warn user if the 1D
                            monitor pvname in config file is not same as in data file

(See catcher_v1.pro)

## XDISPLAYFILE

[Previous Routine] [List of Routines]

     NAME:
    	XDISPLAYFILE

     PURPOSE:
    	Display an ASCII text file using widgets and the widget manager.

     CATEGORY:
    	Widgets.

     CALLING SEQUENCE:
    	XDISPLAYFILE, Filename

     INPUTS:
         Filename:	A scalar string that contains the filename of the file
    		to display.  The filename can include a path to that file.

     KEYWORD PARAMETERS:
    	FONT:   The name of the font to use.  If omitted use the default
    		font.
    	GROUP:	The widget ID of the group leader of the widget.  If this
    		keyword is specified, the death of the group leader results in
    		the death of XDISPLAYFILE.

    	HEIGHT:	The number of text lines that the widget should display at one
    		time.  If this keyword is not specified, 24 lines is the
    		default.

    	TEXT:	A string or string array to be displayed in the widget
    		instead of the contents of a file.  This keyword supercedes
    		the FILENAME input parameter.

    	TITLE:	A string to use as the widget title rather than the file name
    		or "XDisplayFile".

    	WIDTH:	The number of characters wide the widget should be.  If this
    		keyword is not specified, 80 characters is the default.

     OUTPUTS:
    	No explicit outputs.  A file viewing widget is created.

     SIDE EFFECTS:
    	Triggers the XMANAGER if it is not already in use.

     RESTRICTIONS:
    	None.

     PROCEDURE:
    	Open a file and create a widget to display its contents.

     MODIFICATION HISTORY:
    	Written By Steve Richards, December 1990
    	Graceful error recovery, DMS, Feb, 1992.
           12 Jan. 1994  - KDB
                   If file was empty, program would crash. Fixed.
           4 Oct. 1994     MLR Fixed bug if /TEXT was present and /TITLE was not.
          14 Jul. 1995     BKC Increased the max line to variable size.
          16 Jun. 1997     BKC Max dispalyable line is 10000 for non-unix OS system.
          28 Aug. 1997     BKC Add the printer button, file name label, it uses the
                           PS_print,file to print.

(See catcher_v1.pro)