#!/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 [-analyze] [filter1 .. filterN] # # Options: # -analyze - launch analysis software when images are done # # 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 # # 3) Acquire a typical DEIMOS focusloop in the R filter and launch # analysis program: # do_focusloop -analyze dome R #- # 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 # 2010-Oct-05 GDW Restore dual-amp readout mode; # Enable multiple attempts on config # 2011-Oct-26 GDW Add -analyze option # 2012-Feb-26 GDW Change pohue to generic "remopshost" # 2012-Sep-18 JEL Change to single ampmode # 2013-Oct-03 GDW Change to dual ampmode; # add select_slider # 2014-Jul-26 GDW Change to single ampmode (amp 3A bad) #----------------------------------------------------------------------- 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 # parse flags... while ( $#argv > 0 ) # check for -no_init flag... if ( "$1" =~ \-a* ) then set analyze = 1 shift continue endif # exit flag check if no flags remain... break end # 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 cat <= $max_fail ) then printf "[$cmd] ERROR: $n_fail attempts to configure failed -- abort!\n\a" exit $s else printf "[$cmd] WARNING: $n_fail attempts to configure failed -- try again\a" endif endif end # loop over filters... foreach filter ( $filters ) # convert filter name to number... @ filter_num = 1 while ( $filter_num <= $#good_filters ) if ( $filter == $good_filters[$filter_num] ) break @ filter_num++ end if ( $filter_num > $#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 # optional analysis... if ( $?analyze ) then kixrsh remopshost xterm -e wait_wrapper do_analyze_direct_focusloop & endif # turn off lamps... abort: $lamp_command off # restore original grating... if( "$initial_grating" == "3" || "$initial_grating" == "4" ) then select_slider $initial_grating endif # restore other stages... restore_state -verify exit