Text Size:
Smaller Text Normal Text Larger Text


Follow us on Twitter

Usage and examples of Sequencer scripts

The basic way of using the sequencer is by typing sequencer commands in an xterm window. The sequencer commands are exactely like any other UNIX command in the way that they are executed and exists as processes. As they get executed by the shell (C shell by default), all aspects of job control, shell syntax etc. applies to the sequencer commands as they do to any other UNIX command.

They can be put in the background, using "Ctrl-Z, bg" or using "&" after the command. An example of this is the "expose" command. If given normally, i.e. executing in the foreground, the command will not return until the image is read out and stored on disk. You can execute the command in the background ("expose &") and get the command prompt back immediately. In this case you can use the "about" command to about the on-going exposure.

These comments are only highlights of a small number of possibilities available. The real "sequencer manual" is, in fact, a manual of the UNIX C shell (or the shell of your choice if using a script).

There is great flexibility when writing scripts for the sequencer. As the normal UNIX tcsh shell is used, the syntax is well documented elsewhere

Click here for a manual in C shell script writing

It is also possible to use BASH for making scripts, in any case the full command names must be used (e.g. alfosc.xbin). The full command names for the different command groups can be found in the command reference in the header for the command groups (i.e. BIAS, instrument, TCS, etc.)

There are some basic rules that must be followed to get the correct behaviour.

  • The first line of the script MUST be




    in the case you want to use BASH.

  • Before you can use your script, you have to make it executable with the command

    chmod +x my_sript

  • Commands (in this case sequencer commands) can be executed in the background putting a '&' after the command. In this case, the script will immediately continue to the next command in the script.

  • The script can use parameters given on the command line. These are accessible in the variables $1, $2 etc.
    In the script executed like this:

    my_script var1 var2

    var1 will be available as $1 and var2 as $2.

  • Your script can (and should if it is complicated) log informative messages to the talker (and thus to the user), using the logger command.
    Three levels of logging can be used - DEBUG, NOTE and ERROR. DEBUG is used for functionality debugging and can only be seen when this level has been enabled in the Talker. NOTE is the normal way of logging informative messages. ERROR is only used for errors produced by the programme/script. The ERROR messages will appear in red in the Talker. Here is how to use it:

    /usr/bin/logger -p local0.debug -t "scriptname" "[NOTE]: My note"

    for normal log messages

    /usr/bin/logger -p local0.debug -t "scriptname" "[DEBUG]: My note"

    for debug log messages

    /usr/bin/logger -p local0.debug -t "scriptname" "[ERROR]: My note"

    for error log messages

    , where "scriptname" must be an informative name of your script. The square brackets, the colon and the following space must be there.

An example:


# An example StanCam script that will make two integrations with
# a teloffset of variable size (to be given on the command line)
# in 2 filters.
#  Use as "myscript 10.0 10.0 120."
#    which is xoffset xoffset integration_time
# The StanCam filter numbers are:
#   1=U, 2=B,3=V,4=R,5=I 6=H_alpha, 7=SDSS z, 8=Clear_WG280

#  Sets the field rotation to StanCam default
tcs.field-rotation 0 &

#  Moves the camera probe to the "ccd" (StanCam) position
#  &

#tcs.focus-position 23080
# Default focus offset between ALFOSC (no filter)
# and StanCam
tcs.focus-delta -260  &

# Default StanCam TV-focus
tv-focus 420  &


set xoffset = $1
set yoffset = $2
set inttime = $3
set filters = "4 2"
foreach filter ($filters)
  tcs.ccd-filter $filter
  stancam.mexpose inttime
  stancam.teloffset $xoffset $yoffset

#  Back to ALFOSC set-up
#  for NOTCam use 'field-rotation -90' and 'tv-focus 500'
tcs.field-rotation +90  &  &
tcs.focus-delta 0  &
tv-focus 430  &

### end of the script

This script will then be used like (xoffset, yoffset, exptime)

myscript 10.0 10.0 300.

The commands that moves an element (a filter, arm etc.etc) will not complete until this movement has been made. This means that in the script above, the 'expose' command will not start until the filter has arrived at the commanded position and the 'teloffset' command will not start until the exposure (and readout) has finished.

Back to top Last modified: 19-Apr-2010