Hydra Spectrograph GUI


1. Software Code

The Hydra Spectrograph GUI software lives in /usr/local/Bench4m. The structure of the directory tree is as follows:

  • Bench4m
    • bin
    • config
    • doc
    • lib
      • bench4m
      • bitmaps
      • common
    • share
      • include
      • lib
        • tcl8.0
        • tk8.0
    • src
      • include
      • main
      • serialLib

The Hydra spectrograph GUI consists of an extended TCL/TK interpreter plus a set of TCL/TK scripts that build the functionality required by the application. The extended TCL/TK interpreter lives at sub directory "src". Support is provided for compiling the interpreter under Linux, SunOs and Solaris. The TCL/TK scripts live at sub directory lib/bench4m and lib/common.

2. Starting The Program

Open an xterm window and type start_bench4m to start the program. This start up shell script will search your home directory for file .bench4mrc to set the environment before running. If not found it will look for the default version of that file at /usr/local/Bench4m/bin for bench4mrc.
Following is an example of that file:


# Environment variables for the hydra spectrograph gui program
# modification history
# --------------------
# 01a 04apr2000, rcr - Created

# Bench 4m environment
setenv BENCH4MHOME /usr/local/Bench4m

# The TCL/TK package libraries
setenv TCL_LIBRARY $BENCH4MHOME/share/lib/tcl8.0
setenv TK_LIBRARY $BENCH4MHOME/share/lib/tk8.0

# The MPG_ROUTER variable designates the name of the host in which
# the router run. When not defined the the mpg router is supposed
# to be running in indus.tuc.noao.edu.
setenv MPG_ROUTER ctioa1

# The variable MPG_ROUTER_PORT designates the port in which the mpg
# router is listening for incoming connections. The default value
# for this variable is 1 plus the the wiyn router port (2345).
setenv MPG_ROUTER_PORT 2347

# Directory containing configuration files

# Serial port to connect to
setenv BENCH4MSPORT /dev/ttya

# Others
#setenv PATH $PATH":/usr/local/bench4m/bin"
#setenv LD_LIBRARY_PATH /local/X11R5/lib:$LD_LIBRARY_PATH

The program also use three configuration files that live at /usr/local/bench4m/config: gratings.conf, bench4m.ini and filters.ini.

gratings.conf  - text file containing grating parameters. Following is an example of this file:

# CTIO Hydra Bench Spectrograph gratings parameters.
# Name l/mm Blaze Wrange Disp gr_0 gr_fdg incl_0
KPGL3 527 5500 3417 1.16 -0.3 0.988 0.0
KPGL1 632 4200 2872 1.02 -0.491 0.988 0.0
KPGLF 632 8200 2872 1.01 -0.30 0.988 0.0
G450 632 11000 2872 0.47 -0.33 0.988 0.0
KPGLD 790 8500 2290 0.79 -0.27 0.988 0.0
KPGLG 860 11000 2101 0.68 -0.3 0.988 0.0
G380 1200 8000 1563 0.48 -0.3 0.988 0.0
Echelle 316 56120 2888/ 0.94/n -0.1 0.988 0.0

name - a label for the grating
l/mm - number of lines per millimeter
Blaze - self explanatory
Wrange - wavelength range
Disp -
gr_0 - grating angle value for order 0
gr_fdg -
incl_0 - fiber head assembly angle for

bench4m.ini - text file containing the last grating and grating order used. There is a user version of this file called ".bench4m.ini". When the user exits the application the grating and the grating order are saved to this file at the home directory.

filters.ini - text file containing the last filter labels used. There is a user version of this file called ".filters.ini". When the user exits the application the filter labels he defined are saved to this file at the home directory.

3. Hydra Spectrograph Graphic User Interface (GUI)

The Hydra Spectrograph GUI (shown below) is the front end which controls the motors on the Hydra Bench Spectrograph. The GUI connects to a "Smart Motor Controller" (SMC) which controls each of the motors via a serial line through which status information and movement commands are sent.

The GUI also connects to the so-called "GWC" router which publishes the status of the various motors and switches. This allows Arcon to build header information during image acquisition.


3.1 Menu Bar

At the top of the GUI is a menu bar with four pop-up menus: Setup, Windows, Options and Help.


3.1.1 Setup Menu

Clicking on "Setup" gives you three options:

  • Load Grating
  • Grating Specs
  • Filters Load Grating

Use the "Load Grating" option to select the desired grating. The gratings database is loaded from a text file called "gratings.conf". This file can be manually edited to add new gratings. This file is loaded when the application starts and every time the "Gratings" dialog box is opened.

Use this option also to set the current grating order. The current grating and the current grating order appear in the GUI title bar.

This dialog box will also appear when you press the left mouse button over the "Grating" entry on the main GUI. The selected grating and the grating order will be saved in the initializstion file (bench4m.ini) whenever you exit the application. Grating Specs

This option allows you to view the current grating specifications. The user must select a grating using "Load Grating" before using this option. The data presented in this box is read from the grating database each time "Load Grating" is used.

Note: Grating parameters may not be altered in this window. They can only be changed by manually editing the gratings.conf file. Filter

The "Filter" option permits the user to label the installed filters with names. Labeling the filters will allow the program to publish the filter names through the GWC router. The user names will also be used to label the filter control buttons on the GUI.

The filter labels you are saved every time the application is exited.


3.1.2 Windows Menu

The "Windows Option on the GUI menu offers a single option: "Terminal". This opens a terminal window allowing one to manually send commands to the SMC. The user should not normally have any need to use this option.

If commands must be sent manually to the SMC, read the following document explaining the syntax and function of SMC commands. This is usually only done for testing and diagnosing equipment failures.


3.1.3 Options Menu

The "Options" menu presents a single option: "Alarm Bell". Use this option to activate/deactivate a bell tone that warns the user that the link to the GWC router is not functioning.

3.2. Status Panel

The status panel consists of a set of labels that show the current status of the spectrographs motors and switches. When no motion is sensed, the status labels are blue and white. When a mechanism is active or moving the status labels blink and the background color goes yellow to reflect the new status. If no status information is available or an error condition is sensed the status labels blink and the background goes red.


3.3. Control Panel

The control panel consists of a set of widget clusters that group some common functionality.
Four clusters are present: grating control, fiber mount focus control, shutter/newall control and
filter wheel control.


3.3.1 Grating Control

Use the grating control panel to set the grating tilt angle the inclination of fibers angle. To set this values the user must load a grating with the "Load Grating" option first.

The user typically enters a wave length and press return to calculate the proper grating tilt angle and inclination angle. To actually move the mechanisms the user must select "Set Grating and Inclination Angles" from the "Commands" menu button.


3.3.2 Fiber Mount Focus Control

Use the fiber mount focus control panel to set the focus distance. The user typically enters a focus value and press return to actually move the focus mechanism.


3.3.3 Shutter/Newall Control

Use the shutter/newall control panel to set the shutter/newall position. The actions taken depend on whether control of the shutter comes from the SMC or Arcon.

When the SMC is in control, the actions taken are immediate and direct. The shutter is a large rotating disc. If you ask for it to be open or closed, it does exactly what you expect. When you ask for "upper" or "lower" position, it moves to a positions with the upper or lower half of the aperture covered.

When control over the shutter is transferred to Arcon, if "Newall normal" has been selected, Arcon will open the shutter fully when an exposure begins. If "Newall upper" or "lower" is selected, during the exposure the respective half the aperture is left covered. At all other times the shutter remains fully closed.


3.3.4 Filter Control

Use the filter control panel to set the filter wheel position and to set the LEDs intensity.


3.4 Status Bar

So far the status bar has a single widget that presents the status of the GWC link. When the GWC link brakes the widget goes blinking and if the "Alarm Bell" option is set, a tone will be heard.

4. GWC Status Variables

The status information collected by the application is published by the GWC router to other applications that use it (i.e icsInfo). Following are the data streams that the application defines to publish its data. Client applications can subscribe to this data through the GWC router.

bench4m.main.grat - grating angle (degrees)
bench4m.main.fiber - fiber mount focus
bench4m.main.filter - filter position
bench4m.main.shutter - Shutter position
bench4m.main.newall - Newal mask position
bench4m.main.led - LED status (on/off)
bench4m.main.incli - fiber line inclination


5. Trouble Shooting

"ERROR: gwc_init: can't connect to GWC ROUTER" -

Check that the GWC router is actually running on its host machine. If its running check that the machine in which the bench spectrograph GUI is running is an enabled machine. Check the /usr/local/gwc/config/routersetup.tcl file for your machine name. If not present add the name using the rest of the file as a template.
Check also that the environment variables MPG_ROUTER and MPG_ROUTER_PORT are set to the proper values in the bench4mrc file.


"ERROR: smc_init: can't open serial device ..." -

Check that environment variable BENCH4MSPORT is set to the right serial device in the bench4mrc file. Under SunOs and Solaris that variable is either /dev/ttya or /dev/ttyb. Under Linux that variable is either /dev/ttyS0 or /dev/ttyS1.


"ERROR: smc box not responding" -

This error message signals that the serial device was opened successfully but no answer has been received to a sent command. Check you opened the right serial device and that the receptor of your commands is connected to that port and alive.


"WARNING: not connected to GWC ROUTER..." -

This warning message appear to warn the user he chose not to connect to the GWC router. Consequences are that no header information will be available when image acquisition with the Arcon system.

Last Modified:
2 August 2000 - rc
2 August 2000 - tei