#!/bin/csh -f #+ # do_focusloop -- configure DEIMOS and run focusloop # # Purpose: # Automate the process of running a focus sequence on # the instrument # # Usage: # do_focusloop [filter1 .. filterN] # # Arguments: # source = type of lamp source, either "dome" or "internal" # filterN = name of the filter to calibrate (BVRIZ) # # Procedure: # - store current instrument settings # - open or close the DEIMOS hatch as needed # - insert the grid-of-holes slitmask # - switch to the mirror # - set CCD readout mode to Direct and Obstype to DmFlat or IntFlat # - for each filter: # = turn on the appropriate lamp # = set the proper integration time # = insert the filter # = run focusloop script # - turn off lamps # - restore original instrument settings # # Restrictions: # - General dome lights must be extinguished by the OA before # running a dome focus sequence. # # Bugs: # - Currently the script only acquires data for direct mode focusloops # # Exit values: # 0 = normal completion # 1 = wrong number of arguments # # Example: # 1) Acquire a typical DEIMOS focusloop in the R filter: # do_focusloop dome R # # 2) Acquire internal DEIMOS focusloops in BVRIZ: # do_focusloop internal B V R I Z #- # Modification history: # 2003-Mar-05 GDW Original version # 2003-Apr-24 GDW Changed GOH_X to GOH_FOO # 2003-May-02 GDW Enable TODISK # 2003-Aug-20 GDW Added rotator angle check # 2004-Feb-15 GDW Added shutter cycle prior to exposures # 2005-Apr-08 GDW Added AUTOPANE # 2009-Mar-27 GDW Change to using SINGLE amp mode; # also invoke set_state # 2009-Oct-13 GDW Changed GOH_Xfoo to GOH_X #----------------------------------------------------------------------- set buf = $0 set cmd = $buf:t set usage = "Usage: $cmd dome|internal [filter1 .. filterN]" set current_filter = `filter` set good_filters = ( B V R I Z GG495 GG455 BAL12 NB8560) set nexp = 7 set start = -5000 # verify args... if ( $#argv < 1 ) then printf "$usage\n\a" exit 1 endif # parse args... if ( $#argv >= 1 ) then set mode = $1 shift endif if ( $#argv >= 1 ) then set filters = ( $* ) else set filters = ( $current_filter ) endif # validate filters... foreach filter ( $filters ) set good = 0 foreach good_filt ( $good_filters ) if ( "$filter" == "$good_filt" ) then set good = 1 endif end if ( ! $good) then printf "[$cmd] ERROR:\trequested filter $filter is not a valid choice.\n" printf "\tPlease specify one of the following: $good_filters\n" exit 1 endif end # validate mode... switch ($mode) case i: case int: case internal: set mode = internal set obstype = IntFlat set hatchpos = closed set lamp_command = lamps # set stuff for BVRIZ... set lamp = ( Qz Ne Hg Ne Ne Ne Ne Ne Qz) set tint = ( 4 10 2 2 4 1 1 1 1 4) breaksw case d: case dome: set mode = dome set obstype = DmFlat set hatchpos = open set lamp_command = domelamps # set stuff for BVRIZ... set lamp = ( spec spec spec im im im im im spec) set tint = ( 10 3 1 10 10 5 5 5 5) breaksw default: printf "$usage\n\a" exit 1 endsw # check the PA... set rotatval_nominal = -30 set buf = `show -s deirot -terse rotatval` if( $status ) then printf "[$cmd] ERROR: could not read DEIMOS position angle -- aborting!\n\a" exit 1 endif set rotatval = `calc "nint($buf)"` if( $rotatval != $rotatval_nominal ) then printf "[$cmd] WARNING! The DEIMOS rotator is NOT at the nominal rotator angle \npreferred for focusing ($rotatval_nominal). If you focus here, you may not get an accurate focus.\nShould I rotate DEIMOS to the proper position? (y/n) [y]: \a" set ans = $< if ( "$ans" == "" ) then set ans = y endif if ( "$ans" == "y" ) then rotang $rotatval_nominal if ( $status ) then printf "[$cmd] ERROR attempting to set rotator angle -- aborting\n\a" exit 1 endif else printf "OK -- will run focus loop at the current rotator position\n" endif endif # configure instrument.... save_state -clobber set s = $status if ( $s != 0 ) then exit $s endif onintr abort # build a configuration file to move motors in parallel... set_state -verify < $#good_filters ) then printf "[$cmd] ERROR -- filter $filter is not valid -- skipping\n\a" continue endif # turn on lamps... $lamp_command $lamp[$filter_num] tint $tint[$filter_num] # set filter... filter $filter if ( $status != 0 ) then printf "[$cmd] ERROR selecting the $filter filter -- skipping\n\a" continue endif # cycle the shutter to prevent errors... cycle_shutter -25 if ( $status ) then printf "[$cmd] ERROR which running cycle_shutter -- abort\n\a" exit 1 endif # set object name and observation type... object Focus loop $filter $mode # acquire data... focusloop $start $nexp end # turn off lamps... abort: $lamp_command off restore_state -verify exit