#!/bin/csh -f #+ # mosaic -- acquire mosaiced image sequence # # Purpose: # Acquire DEIMOS images across a grid of points, # centered on the current position, moving in INSTRUMENT # coordinates. The default behavior is to take one image at each # location using the current instrument settings (filter, # ttime). Command line argument can be used to acquire data in # multiple filter, acquire multiple images for various filters, to # change the integration time for each filter. # # Usage: # mosaic [-debug] [-dither] [-notify] [-pause] [-filter ] # [-ttime ] # [-nexp ] # # Arguments: # nx = number of images to take in x # ny = number of images to take in y # dx = separation of adjacent images (arcsec in detector X direction) # dy = separation of adjacent images (arcsec in detector Y direction) # # Switches: # -debug = only print actions to be taken; make no telescope # moves and do not take images # -dither = enable "x" dithering between images in order to prevent alignment # of the CCD gaps in consecutive frames # -pause = pause execuition after each telescope move to allow # resumption of guiding # -notify = use audio and popup message to announce completion # -filter = specify a comma-separated list of dewar filters to expose # [default is to use the current filter] # -ttime = specify a comma-separated list of exposure times, one per filter # [default is to use the current exposure time] # -nexp = specify a comma-separated list of exposures, one per filter # [default is to take one exposure per filter] # # Output: # Transcript written to STDOUT # # Restrictions: # The grid is laid out in the INSTRUMENT coordinate system; observer # must align the detector (rather than the slit!) with the celestial # axes in order to make moves purely in (N/S) # # Side effects: # - Base coordinates will be reset # # Exit values: # 0 = normal completion # 1 = wrong number of arguments # 2 = non-numeric argument received # 3 = number of array elements do not match # 4 = aborted by user request # # Example: # 1) Acquire a 5x5 mosaic with separation of 15 arsec: # mosaic 5 5 15 15 # # 2) Acquire same mosaic in BVRI filters with 3xB, 2xV, 1xR, 1x1: # mosaic -filter B,V,R,I -nexp 3,2,1,1 5 5 15 15 # # 2) Acquire same mosaic in BVRI filters with exposure times of # 300, 200, 100, and 100 sec # mosaic -filter B,V,R,I -ttime 300,200,100,100 \ # 5 5 15 15 #- # Modification history: # Date unknown RWG Original version # 2000-Jul-05 GDW Added documentation # 2002-Jun-06 GDW Adapted for DEIMOS # 2002-Aug-12 GDW Added support for -dither, -filter, -focus, -ttime, -nexp # Added checks for TODISK and PONAME # 2002-Dec-30 GDW Added -debug and -pause switches #----------------------------------------------------------------------- set debug = 0 set buf = $0 set cmd = $buf:t set usage = "Usage: $cmd [-dither] [-notify] [-filter ]\n\t[-ttime ] [-nexp ] nx ny dx dy" # set defaults... set do_dither = 0 # dithering is turned off by default set do_notify = 0 # notification is turned off by default set do_pause = 0 # no pausing by default set dither = 25 # dither amount is 25 arcsec set filters = ( `filter` ) # default is to use current filter # check for flags... while (1) # check for debug flag... if ( "$1" == "-debug" ) then set debug = 1 printf "DEBUG MODE --- no moves will be sent.\n" shift continue endif # check for dither flag... if ( "$1" == "-dither" ) then set do_dither = 1 shift continue endif # check for pause flag... if ( "$1" == "-pause" ) then set do_pause = 1 shift continue endif # check for dither flag... if ( "$1" == "-notify" ) then set do_notify = 1 shift continue endif # check for filter list... if ( "$1" == "-filter" ) then if ( $#argv < 2 ) then printf "$usage\n" exit 1 endif set list = `echo $2 | sed "s/,/ /g"` set filters = ( $list ) shift shift continue endif # check for nexp list... if ( "$1" == "-nexp" ) then if ( $#argv < 2 ) then printf "$usage\n" exit 1 endif set list = `echo $2 | sed "s/,/ /g"` set nexp = ( $list ) shift shift continue endif # check for ttime list... if ( "$1" == "-ttime" ) then if ( $#argv < 2 ) then printf "$usage\n" exit 1 endif set list = `echo $2 | sed "s/,/ /g"` set ttimes = ( $list ) shift shift continue endif break end if ( $debug ) then set foo = "echo" # set to "echo" for testing purposes else set foo = "" # set to "echo" for testing purposes endif # verify args... if ( $#argv != 4 ) then printf "$usage\n" exit 1 endif # grab arguments... set nx = $1 set ny = $2 set dx = $3 set dy = $4 # verify float-ation... is_float $nx $ny > /dev/null if ( $status ) then echo "ERROR -- nx and ny must be valid numbers" exit 2 endif is_float $dx $dy > /dev/null if ( $status ) then echo "ERROR -- dx and dy must be valid numbers" exit 2 endif if ( ! $?nexp ) then set nexp = () foreach i ( $filters ) set nexp = ( $nexp 1) end endif if ( ! $?ttimes ) then set tint = `tint` set ttimes = () foreach i ( $filters ) set ttimes = ( $ttimes $tint) end endif # verify that the number of elements in all arrays in the same... if ( $#nexp != $#filters ) then printf "ERROR: number of exposures and filters do not match\n" exit 3 endif if ( $#ttimes != $#filters ) then printf "ERROR: number of ttimes and filters do not match\n" exit 3 endif # verify disk-write status... set todisk = `show -s deiccd -terse todisk` if ( "$todisk" != "true" ) then beep 3 printf "WARNING! Disk write is disabled. Continue anyway? (y/n) [n]: " set ans = "$<" if ( "$ans" != "y" ) then printf "Aborting!\n" exit 4 endif endif # verify pointing origin... set poname = `poname` set poname = `tolower $poname` if ( "$poname" != "deimos" ) then beep 3 printf "WARNING! Pointing origin is not 'DEIMOS'. Continue anyway? (y/n) [n]: " set ans = "$<" if ( "$ans" != "y" ) then printf "Aborting!\n" exit 4 endif endif # define the center position... set xc = `calc "($nx+1)/2"` set yc = `calc "($ny+1)/2"` # save starting location... $foo markbase onintr last @ ix = 0 while ($ix < $nx) @ ix++ @ iy = 0 while ($iy < $ny) @ iy++ # compute new position... set xx = `calc "($ix-$xc)*$dx"` set yy = `calc "($iy-$yc)*$dy"` # adjust x position ("dither") at even-numbered y locations # to compensate for DEIMOS CCD gap obstructions... if ( $do_dither ) then @ iy2 = ( $iy / 2 ) * 2 if ( $iy2 == $iy ) then set xx = `calc $xx + $dither` endif endif # move to appropriate location ins absolute coordinate system... $foo mxy -abs $xx $yy # print message... printf "----------------------------------------\n" printf "Position ($ix,$iy) at (%.1f,%.1f)\n" $xx $yy printf "----------------------------------------\n" if ( $do_pause ) then beep pause Begin guiding and press ENTER to expose endif # acquire a set of images... @ j = 1 while ( $j <= $#filters ) set filter = $filters[$j] set ttime = $ttimes[$j] $foo filter $filter $foo tint $ttime $foo object "Mosaic position ($ix,$iy) filter $filter" $foo goi $nexp[$j] @ j++ end end end last: $foo gotobase printf "Done!\n" if ( $do_notify ) then $foo script_done else beep 3 endif