Yviewer - An EPICS Scan Browser Written in Python and Yorick

Maintained by Ben-chin Cha ([email protected])

Intruduction

Yviewer is an EPICS extensions tool specially written for displaying catcher/scanSee data file and can provide a graphic simulation of the 1D/2D realtime scanning. It is written in Python/Tkinter and Yca. Yca is an extended interactive Yorick graphic package specially written for displaying 1D/2D/3D scan data.

The yviewer is designed with the goal that the scan data saved by yviewer can also be viewed by the catcher/viewer program written in IDL. The yviewer is also able to process the scanSee 1D/2D/3D .mda files which are automatically saved by the IOC. It can be served as a tentative alternative scan visualization tool for catcher or scanSee.

Programs written in IDL are licensed package which is not free. While the programs written in python and yca is free of license and is free.

Currently yviewer is only available for UNIX system.

System Requirement

The complete package includes all the yca and python application functions and programs required for channel accessing, scanning, and displaying the 1D/2D/3D data. Please refer to the Yca for instructions abobut download, installation, system setup, and detailed functions.

Access Yviewer on Unix

To access the yviewer on the Unix system after the system installation, just enter
	yviewer

Yviewer User Interface

The yviewer is an application build on top of yca package. The top level user interface is implemented in python/Tkinter language. Any button end with '...' implies there is/are windows associated with it.

Different function of yca progrom can be brought up by different menu of yviewer. Yca program is running sequentially depending on the event button clicked by users. A user has to close the pop-up child window before accesses another button in the same parent window. A user has to close the yca program as soon as it is no longer needed. If not careful few copies of yca can be brought up simultaneously, a user may be confused by too many windows opened by yviewer.

How to Stop Yca Program ?

Normally yca quit automatically at the end of each processor. In case of yca hung, the CNTL-C key can stop the yca execution, a command prompt '>' returns. The quit command at the yca prompt normally exit the yca program. If no response to CNTL-C resulted, a user could use the CNTL-\ key to kill the yca processor.

yviewer-main dialog

The yviewer provides the function of viewing the crude 1D/2D realtime scanning, 1D/2D/3D visualization of mda data, or catcher 1D/2D data. It can start and save scan file like data catcher. The scanSee option handles 85 detectors and the catcherScan option handles first 15 detectors. It provides very flexible ascii report generation for processing catcher or scanSee files.

The main dialog consists of a menu bar and set of widgets which control the ascii report parameters.

The ascii report parameters include:

    Radio Toggle Buttons
    Report FileType : scanSee / catcher1D /catcher2D

    Input Text Fields
    seq1:      starting seq #, or a range of valid seq# list
    seq2:      ending seq #
    2D scan# : specify the 2D scan # for catcher image file
   
For catcher 1D file seq1 and seq2 represent the 1D scan sequence number in data file. For catcher 2D image file seq1 and seq2 represent the 2D image sequence number in data file. For scanSee file seq1 and seq2 may represent the detector number or inner scan sequence number depends the data type addressed.

The seq1 field accepts flexible random numbers, if more than one number entered in seq1, the equivalent selected list will be regenerated and for each item in the list a yca report program will be submitted. For continuous range of sequence number using both seq1 and seq2 fields is more efficient than of using seq1 field only because only one yca report program will be submitted.

The main window menu bar includes following selection menus:

File Menu
     Open Viewer/ScanSee...- pops up Tkinter file selection window to pick any type of 1D/2D/3D 
				 scanSee or 1D/2D catcher file then start the appropriate 
				 yca function depending on the picked file
     Open Yca...           - uses xterm window to start a yca interactive processor
     Quit                  - stops all subprocessors and quits the yviewer program 
 
CatcherScan Menu
     Setup...      - dialog to setup scan1 and scan2 PV names to be monitored 
     Save New...   - dialog to pick a new catcher file and start Yca/catcher program with
			  scan dialog window and two realtime windows
     Append Old... - dialog to pick an old catcher file and start Yca/catcher program with 
			  scan dialog window and two realtime windows
     Abort 1D      - stop 1D scan immediately
     Abort 2D      - stop 2D scan immediately
     Scan 1D       - start 1D scan 
     Scan 2D       - start 2D scan 
	
AsciiReport Menu
     Generate Report... - dialog to pick a catcher or scanSee file and then start yca
			to run various report options based on filetype and seq# entered 
     View Report...     - dialog to pick an ascii file and then start the UNIX dtpad 
			to display the text file 
	
ReportSetup Menu
     Reset        - clear the seq1,seq2,and scan# fields 
     Default Seq# - reset the seq1 and seq2 fields based on report type setting
	
Help Menu
     Help         - help text about main window
     CatcherScan  - help text about catcher scan option
     Reset        - help text about legible seq1,seq2 and scan# fields
     Default Seq# - help text about deault setting of seq1,seq2, and scan# fields
	

Open Viewer/scanSee... dialog

The python/Tkinter file selection dialog is used to pick the scan data file then submitted the yca program with the picked file. Which portion of yca dialog pops up depends on the file selected by the user. It can accept 1D/2D/3D mda file, or 1D catcher file, or 2D catcher image file.

If the file ended with '.mda' scanSee file is assumed, if file ended with '.image' 2D catcher image file is assumed, all other file 1D catcher file is assumed. User has to make sure the correct type of file is passed into yca program.

   For scanSee file:
     Refer the scanSee Interface section in the Yca document.

   For catcher 1D/2D file:
     Refer the catcher Interface section in Yca document.
 
At the end of scanSee interface, the file selection dialog has an ".mda Scan..." button (as shown below) which allows the user to access the scanSee realtime scanning option. Currently it will only allow the owner of the scan record to start the scan through yca/scanSee program. The purpose is to prevent a user accidentally start other people's scan record. But if the outside CA client started the scan, yca should allow any user to view the crude realtime scanning. At the end of scanning, yca always provides the user an efficient tool to view the saved scan data.

scanSee Realtime dialog

The ".mda scan..." button will pop up scanSee realtime dialog window with window 0 reserved for displaying 1D scanning data, window 2 reserved for displaying 2D image data. The scanSee realtime dialog window is given below. It contains a set of control buttons and 1D displaying toggle buttons, they are described below.

 
   pv1,pv2           - user scan record PV names 
   Init              - re-initialize the realtime parameters
   Show/View Scan... - displaying realtime scan data if scan is going on
   Done              - close scanSee realtime dialog
   Start scan1...    - start 1D scan if user same as the owner
   Start scan2...    - start 2D scan if user same as the owner
   85 toggle buttons - detector hide/show toggle buttons for 1D line plot
			  (highlighted implies plotted)
  
If the user is not same as the owner of the mda file, the 'Start scan1...'/ 'Start scan2...' will not work for the user, a user has to use the other method to start the scan (e.g. external medm client). Click the Show / Start buttons can display the realtime 1D/2D scan data after the scanning is invoked by any other client.

Open yca... dialog

The "Open yca..." button brings up a copy of interactive yca program. Please refer the Yca document for the functions available in yca. This yca program must be explicitly closed by the user through the quit command when it is no long needed.

CatcherScan - Setup... dialog

This dialog pops up the setup window for scan PV names. The defualt setting is based on the system variable $USER. The user can change to any other valid scan PV names he is monitoring. This will be used by the catcher file later on during realtime scanning.

CatcherScan - Save New/Old... dialog

The "CatcherScan - Save New..." / "CatcherScan - Append Old..." menu pops up file selection dialog then passed the selected file to the catcherScan dialog. The catcherScan dialog allows the user to access either scanning mode or viewing mode of catcher functions of yca. It consists of two sections, top section contains the controls related to scannig, the bottom section contains the controls of viewing 1D/2D data. If new filename option picked, the bottom setion will not be drawn.

The user interface is given below:

    filename    - label to show 1D catcher file used
    Init        - re-init scan record realtime information
    Start scan1... - start 1D scan and append scan data to 'filename'
    Start scan2... - start 2D scan and append 1D scan data to 'filename'
		     at the end of 2D scan append 2D image data to 
		     'filename.image'
    Done        - done with catcher dialog and properly close yca program
    pv1,pv2     - label to show scan1 and scan2 PV names used
    Di buttons  - 15 toggle buttons for setting detector realtime plot
		     highlighted number implies the detector will be plotted
		     default pick is detector 1 and 2
    View1d...   - invoke 1D viewer of catcher 1D data selection
    View2d...   - invoke 2D image viewer of catcher 2D image selection
The catcher_scanDialog program will check the user against the file write permission and the validity of the scan record. If error detected, error message in red will by displayed on scan dialog. A user has to correct the scan setup or pick another catcher file before doing catcher scan.

The Di buttons can not be reset during scanning, therefore a user must set Di buttons before starting the 1D/2D scan.

The yca output window will be closed normally by the "Done" button. For abnormal termination of yca please refer the previous setion of 'How to Stop Yca Program?'

AsciiReport - Generate Report... dialog

Based on the setting of the report file type and sequence number entered, the "AsciiReport - Generate Report..." menu pops up file selection dialog then passed the selected file and the sequence numbers to the yca program for automatical ascii report generation.

A sub-directory "ASCII" at the current working directory will be created, all the ascii file created by yca will be stored under the "ASCII" sub-directory. The printed output of ascii file generation is recorded in the root window where yviewer was invoked.

There are three types of scan file supported by yca: catcher 1D file, catcher 2D image file, and scanSee mda file. A user has to make sure the picked file and the report type selection are consistant in report generation.

AsciiReport - View Report... dialog

The "AsciiReport - View Report..." menu pops up the file selection dialog with all the txt file in the "ASCII" sub-directory then passed the selected file to the UNIX text editor dtpad with the option of viewonly turned on.