LRIS Shell Scripts

Background

In addition to the limited instrument-control scripts which can be composed using XLRIS, the Unix shells (sh, csh, tcsh, etc.) offer a flexible and powerful mode for controlling LRIS. Scripts can not only change the spectrograph setup, but can also set exposure parameters, initiate exposures or exposure sequences, and even move the telescope.

A rich library of LRIS commands exists and can serve as building blocks for LRIS scripts of greater complexity. To use these commands, simply include them in a shell script as shown in the example below.

Example

Here's an example which will take calibration data consisting of internal flats and line lamps for several slitmasks. It could be run at the end of the night to gather your data. To use this script, you would do the following:
  • Put the text into a file called foo
  • Put the file into your home directory on lrisserver
  • Issue the command chmod +x foo to make the file executable
  • Type ./foo at the lrisserver command line to run the script
#!/bin/csh -f
#
# Name:
#	foo
#
# Purpose:
#	Acquire calibration data (flats and arc lamps) for several
#	slitmasks, consisting of
#		3 flatfield exposures in red and blue
#		1 Ne/Ar arc lamp in red
#		1 Hg/Kr/Xe arc lamp in red
#-----------------------------------------------------------------------

# set up the instrument as desired...
trapclose			# close trapdoor
dichroic 560			# select dichroic
filterr R			# select red filter
filterb clear			# select blue filter
grism 300/4000			# select grism
grating -mswave 600/7500 7000	# select grating and central wavelength

# loop over the masks we want to calibrate...
foreach mask ( foo1.bar foo2.bar foo3.bar )

  slit $mask			# select the slitmask

  # acquire 3 flatfield images on blue and red sides...
  object Flatfield image for mask $mask
  lamps hal			# turn on Hal lamp
  tintr 2			# set red integration time to 2 sec
  tintb 4			# set blue integration time to 4 sec
  sleep 10			# pause while lamp warms up
  goibr 3			# take three red and three blue images

  # acquire Ne and Ar image in red...
  object Ne/Ar arc lamp image for mask $mask
  lamps Ne Ar			# turn on Ne and Ar lamps (Hal off)
  tintr 10			# set red integration time to 10 sec
  sleep 10			# pause while lamp warms up
  goir				# take one red image
  
  # acquire Hg/Kr/Xe image in blue...
  object Hg/Kr/Xe arc lamp image for mask $mask
  lamps Hg Kr Xe		# turn on Hg, Kr, and Xe lamps (others off)
  tintb 20			# set blue integration time to 20 sec
  sleep 10			# pause while lamp warms up
  goib  			# take one blue image
  
end

# turn off lamps...
lamps off

See Also

Last modified: 12/28/2011 20:20
Send questions or comments to:LRIS Support

The information on this page is the property of the W. M. Keck Observatory. The contents of this page or any part thereof shall not be copied or otherwise reproduced or transferred to other documents or used or disclosed to others for any purpose other than observing support at the W. M. Keck Observatory and the subsequent analysis and publication of scientific data obtained from observations conducted at the W. M. Keck Observatory. All rights reserved. © W. M. Keck Observatory.