![]() |
![]() |
![]() |
![]() |
2 USERS GUIDE
2.1 Introduction
The INS System Tools ist are a set of system related services provided for the instrument developer. The need for such instrument related services where identified in the INS Common SW specification [2]. The current services supported are:
Further system related tools might follow in the future and should be located in this toolbox module.
2.2 Disk Space Monitoring
The monitoring of disk space is supported by ist at various level:
The intention of the ist disk monitoring is to provided a simple easy-to-use way of retrieving the available disk space of a harddisk. This is typically used from instrument applications where a dedicated physical disk is used to store acquisition data, thus it is essential to know the available diskspace left before starting storing the data.
The ist disk monitoring does not replace Unix level utilities like e.g. df to query disk space of the disks mounted in the system, but only provides an simpler usage adapted for instrument SW requirements.
2.2.1 istDiskSpace(3)
The function istDiskSpace can be used to return the available disk space on either a device filename or a mounted directory name. istDiskSpace returns the total disk capacity in Kbytes, the available disk space in Kbytes and the percentage of free diskSpace. istDiskSpace uses the UNIX system call statvfs() to determine the free disk space.
Following C-code example illustrates the usage:
strcpy(diskName,"/vlt/instrument/data");
if (istDiskSpace(diskName,&size,&free,
printf("Disk: %s Total: %d KB Free: %d KB %d %% free\n",
diskName, size, free, percent);
2.2.2 istDiskMon(n)
istDiskMon is an [Incr Tcl] widget that can be used to visualize the available free disk space. It can either be used from an Tcl/Tk[4] program using the seqWish windowing shell or as a panel editor class from within the panel editor[3].
Figure 2.1 illustrates the layout of the istDiskMon widget:
The available disk size is displayed in a bar chart showing the values from the disk which is entered in the provided entry field. The values can either be displayed in MByte or Percent as specified by the respective radio buttons. The disk space values can frequently update (currently every 2 seconds) by enabling the Update checkButton.
Normally the instrument disk used for acquisition is well-known, so in this case the environment variable INS_DISK must be set to the according device filename or mounted directory name. If this environment is set the entry field is updated with the device filename and protected. This means that the user can not any longer change the diskname interactively. This protection mechanism ensures an easier initialization of the widget.
Usually the INS_DISK environment should be set to $INS_ROOT/$INS_USER/DETDATA or simply to the disk that contains the INS_ROOT. This directory should be used as mount point for the dedicated disk used to store acquisition data. Please refer to [2] for more information of the over INS directory structure.
In order to use the istDiskMon widget the tcl library where the widget is located must be integrated in the Makefile. Following illustrates the setting in the users Makefile:
# TCL scripts (public and local)
# ------------------------------
istDiskMonTest_OBJECTS = istDiskMonTest
istDiskMonTest_TCLSH = seqWish -f
istDiskMonTest_LIBS = istUifClass uifClass
2.3 MIDAS Table to OLDB conversion
The utility istTbl2Db can be used to convert MIDAS FITS tables files to an OLDB table attribute. The format currently supported is not the native MIDAS table format but the FITS binary table format supported by MIDAS. See also [5]. So in order to use istTbl2Db the <xx>.tbl files from MIDAS needs to be converted into FITS tables.
The following illustrates the MIDAS commands needed to produce a FITS table file:
MIDAS version 94NOV on HP/HP-UX
**************************************************************************
** 94NOV release of ESO-MIDAS **
** Copyright 1993,1994 European Southern Observatory **
** NEW: The GNUreadline as line-editing (Emacs alike). "man readline" **
** gives you all details. To start: **
** Self-insert CTR-L -> clear-screen **
** CTR-E -> end-of-line CTR-A -> beginning-of-lin **
** CTR-U -> unix-line-discard CTR-K -> kill-line **
** TAB -> complete TABs -> possible-completions **
** CTR-X -> (also F1) on-line-help through the GUI HELP **
** OLD: "setenv TERMWINS yes" if you prefer the previous line-editing **
** NEW: INTAPE/FITS with decompression on-the-fly for compressed files **
** with extensions .z and .Z **
*************************************************************************
Midas 001> OUTTAP/FITS mytable.tbl mytable.fits
Midas 002> exitThe produced FITS table file can now be used as input for istTbl2Db.
istTbl2Db is started with the following arguments:
$ istTbl2Db -t mytable.fits -p :Appl_data:mypoint.mytable
where mytable.fits is the MIDAS FITS table file and :Appl_data:mypoint is the database destination point. This point is created by either using RtapDbConfig or dbCreatePoint utility.
Upon successful parsing of the table mytable.fits a table attribute is created by istTbl2Db with the attribute name mytable. The table field names of the table attribute will be identical to the column names of the MIDAS table. The field type is adapted to the field types available in the OLDB.
NOTE: MIDAS tables using array elements can currently not be converted as no analogous OLDB field type exists.
Use RtapPtDisplay to verify the new OLDB attribute: :Appl_data:mypoint.mytable
If the destination table attribute is already existing istTbl2Db will fail to write the table attribute unless it is explicitly told to overwrite the existing attribute. Overwriting is activated with the -d command line option.
If the -v option is specified the operational logs are redirected to the standard output.
2.4 Widgets for Instrument Control
Widgets for instrument control are common widgets and support procedures that can be used from instrument control panels for different instruments.
2.4.1 ist3State(n)
ist3State is an [Incr Tcl] widget that can be used to control an instrument function wich contains a set of elements e.g. a filter wheel.
It can either be used from an Tcl/Tk[4] program using the seqWish windowing shell or as a panel editor class [3].
Basically the ist3State widget is a collection of pushbuttons which map to the elements mounted to an instrument function such as an filter wheel. The elements (buttons) can have three states: Normal, Selected and Accepted. Only one element of the collection can be in accepted state - which is shown by using a different color and font of the button lable. The accepted state is used to reflect the current status of the function the ist3State widget is controlling. If the user pushes an elements button then this button state changes to selected. A selected button has a different color and font in order to distinguish itself from the other buttons. All other elements which are not selected or accepted are in normal state and look like usual push-buttons.
The ist3State widget has a title button which typically is the name of the function. If the user presses the title button a callback is called which can be used to popup a dialog window of function details.
A keyword string can be associated with the ist3State widget - which normally is a short FITS keyword. This keyword is passed as argument to a callback function when the user selects an element.
The function provided by the user is called with keyword and value as arguments e.g.:
proc selectCB { keyword value } {}
Figure below illustrates the layout of the ist3State widget:
2.4.1.1 Integration with ordinary Tk scripts
In order to use the ist3State widget the tcl library where the widget is located must be integrated in the Makefile. Following illustrates the setting in the users Makefile:
# TCL scripts (public and local)
# ------------------------------
ist3StateTest_OBJECTS = ist3StateTest
ist3StateTest_TCLSH = seqWish -f
ist3StateTest_LIBS = istUifClass uifClass
2.4.1.2 Integration with Panel Editor
The panel editor is capable of importing [incr Tk] widgets such as the ist3State. To do that you have to press the "Import Class ..." button and a fileselection dialog pops up. Here you search in the VLTROOT directory after the in the $VLTROOT/lib/libistUifClass.tcl directory and you select the ist3State.tcl file and the ist3State widget is shown in the display window.
As default the ist3State is shown with 4 elements. The resources of the widget can be edited by pressing the 3rd mouse button on the widget.
The "-elements" resource sets the contents of the elements in the button area as shown in the picture below.
If you do not like the space between the individual button elements then you have to set the resource "-highlightThickness" to the value 0 and the element button are packed closer together.
Figure 2.3: ist3State use in panel editor
Other resources like color and font etc. can be set in this way statically. In order to change the resources programatically the default scheme must be used e.g.:
<widgetName> config -keyword "INS.OPTI2"
2.4.2 Support procedures
In the library libistUifClass.tcl contain a set of tcl support procedures that are useful when developping instrument panels.
2.4.2.1 Dynamic menus
istMenuReadFile is a function that adds menu items such as: separator, command etc. to the panel menu base on a so-called menu file. The menu file is located in the $VLTDATA/config directory and has the following entries:
A comment line can be added by starting with a `#' character.
Note !!! The <menu name> must already exist in the panel generated by panel editor.
2.4.2.2 Dialog handling
The functions istWindowOnTop and istClassDialog assist when dealing with dialog windows.
A classical problem is that the dialog window disappears behind the main panel, because you clicked (maybe by accident) on the main panel. istWindowOnTop solves this problem by inserting the dialog window into the same window group as the main panel. You only have to pass the window name of the dialog to the function.
istClassDialog assist in building a dialog window out of a panel editor class e.g;
set myDialog [istClassDialog testPanelClass_uifClass test "Test Dialog"]
The myDialog returns a window handle for the dialog window. To remove the dialog simply use `destroy $myDialog' or `wm withdraw $myDialog'.
![]() Quadralay Corporation http://www.webworks.com Voice: (512) 719-3399 Fax: (512) 719-3606 sales@webworks.com |
![]() |
![]() |
![]() |
![]() |