#!/bin/csh -f #+ # calib_blue -- acquire calibrations for the all gratings on DEIMOS # when the central wavelength is bluer than 6500A. # # Purpose: # # This is a script to run arc line and internal flat lamp # calibrations for DEIMOS when observing in the blue. This # script was initially tweaked for use with the 1200B grating at # a central wavelength of 5200 Angstroms with any slit width. # The script was later on extended to all gratings with a # central wavelength shorter than 6500A and any slitwidth. # # For flat field exposures, the script acquires three images for # the red side. Because the throughput is very low near 4000 # Angstroms, the script acquires six images for the blue side. # These exposures will saturate the red side. As written, the # spec2d pipeline will not accept separate red and blue flat # field images. However, it is reasonably easy to modify the # read_planfile.pro and deimos_mask_calibrate.pro files to # accept different images. # # The script also takes an additional deep KrXe arc if the central # wavelength is shorter than 6000A. # # The script requires about 33 minutes per mask. If short on # time, then the time to warm up lamps can be reduced in some # places. # # Usage: # calib_blue slitwidth mask1 mask2 mask3 ... # # # Arguments: # maskN = mask names for which to acquire calibration images # # Exit values: # 0 = normal completion # 1 = wrong number of arguments # #- # Modification history: # 2017-Sep-14 ENK Original version # 2017-Oct-03 CAAI Adapted to any slit width and # any grating # 2018-May-03 CAAI Set different grating scaling # for blue and re flats # 2019-Jul-06 CAAI Renamed as calib_blue. Overrides # the old calib_blue. Added long integration # KrXe arc for setups with a central # wavelength shorter than a given threshold # Included 1s red arcs with NeArKrXe. # implement flags -nored, -noarcs and -noflats #----------------------------------------------------------------------- # Define defaults set nored = 0 set noarcs = 0 set noflats = 0 # Flag check while (1) # check for "nored" option... if ( "$1" == "-nored" ) then set nored = 1 shift continue endif # check optional argument... if ( "$1" == "-noarcs" ) then set noarcs = 1 shift continue endif # check optional argument... if ( "$1" == "-noflats" ) then set noflats = 1 shift continue endif break end # Parse arguments if ( $#argv < 2 ) then printf "Usage: calib_blue [-nored] [-noarcs] [-noflats] slitwidth mask1 mask2 mask3 ...\n" exit 1 endif # First argument should be a numerical slitmask if ( $argv[1] !~ [0-2].[0-9]* ) then echo "Wrong slit width. Exiting..." exit 1 endif set slwidth = $argv[1] # Nominal values for 0.7as slitwidth set nt_nearkrxe = 1 set nt_ne = 5 set nt_ar = 60 set nt_krxe = 45 set nt_krxe_blue = 200 set nt_hg = 24 set nt_qzred = 29 set nt_qzblue = 86 set wavel_blue = 5600 # Wavelength threshold to take # longer KrXe arcs. set scale = `echo "0.7 / $slwidth" | bc -l` # Determine the scaling depending on the grating set grating = `show -s deimot -terse gratenam` switch ($grating) case 1200B: set gratscl_arc = 1.0 set gratscl_qzr = 1.0 set gratscl_qzb = 1.0 breaksw case 1200G: set gratscl_arc = 1.1 set gratscl_qzr = 0.6 set gratscl_qzb = 0.8 breaksw case 900ZD: set gratscl_arc = 0.8 set gratscl_qzr = 0.5 set gratscl_qzb = 0.6 breaksw case 830G: set gratscl_arc = 0.7 set gratscl_qzr = 0.5 set gratscl_qzb = 0.6 breaksw case 600ZD: set gratscl_arc = 0.5 set gratscl_qzr = 0.3 set gratscl_qzb = 0.2 breaksw default: set gratscl_arc = 1.0 set gratscl_qzr = 1.0 set gratscl_qzb = 1.0 breaksw endsw # Determine the central wavelength set gratepos = `show -s deimot -terse gratepos` if ( $gratepos == 3 ) then set wavel_tmp = `show -s deimot -terse g3tltwav` else if ( $gratepos == 4 ) then set wavel_tmp = `show -s deimot -terse g4tltwav` else echo "ERROR: Bad grating position." exit(1) endif set wavel = `printf "%.0f\n" $wavel_tmp` echo echo "------------------------------" echo " Grating name : "$grating echo " Slider number : "$gratepos echo " Central wavelength : "$wavel echo " Wavelength threshold : "$wavel_blue echo echo " Do not take red cals : "$nored echo " Do not take arcs : "$noarcs echo " Do not take flats : "$noflats echo "------------------------------" echo # Calculate slitwidth scaled integration times (will have 20 decimals) set t_nearkrxe_slt = `echo "$nt_nearkrxe" | bc` set t_ne_slt = `echo "$nt_ne * $scale" | bc` set t_ar_slt = `echo "$nt_ar * $scale" | bc` set t_krxe_slt = `echo "$nt_krxe * $scale" | bc -l` set t_krxe_slt_blue = `echo "$nt_krxe_blue * $scale" | bc -l` set t_hg_slt = `echo "$nt_hg * $scale" | bc` set t_qzred_slt = `echo "$nt_qzred * $scale" | bc -l` set t_qzblue_slt = `echo "$nt_qzblue * $scale" | bc -l` # Calculate the grating-scaled integration times (will have 20 decimals) set t_nearkrxe_tmp = `echo "$t_nearkrxe_slt * $gratscl_arc" | bc` set t_ne_tmp = `echo "$t_ne_slt * $gratscl_arc" | bc` set t_ar_tmp = `echo "$t_ar_slt * $gratscl_arc" | bc` set t_krxe_tmp = `echo "$t_krxe_slt * $gratscl_arc" | bc -l` set t_krxe_tmp_blue = `echo "$t_krxe_slt_blue * $gratscl_arc" | bc -l` set t_hg_tmp = `echo "$t_hg_slt * $gratscl_arc" | bc` set t_qzred_tmp = `echo "$t_qzred_slt * $gratscl_qzr" | bc -l` set t_qzblue_tmp = `echo "$t_qzblue_slt * $gratscl_qzb" | bc -l` # Convert to integer exposure times set t_nearkrxe = `printf "%.0f\n" $t_nearkrxe_tmp` set t_ne = `printf "%.0f\n" $t_ne_tmp` set t_ar = `printf "%.0f\n" $t_ar_tmp` set t_krxe = `printf "%.0f\n" $t_krxe_tmp` set t_krxe_blue = `printf "%.0f\n" $t_krxe_tmp_blue` set t_hg = `printf "%.0f\n" $t_hg_tmp` set t_qzred = `printf "%.0f\n" $t_qzred_tmp` set t_qzblue = `printf "%.0f\n" $t_qzblue_tmp` # Make sure that integration time is never # shorter than 1 second. if ( $t_nearkrxe < 1 ) then set t_nearkrxe = 1 endif if ( $t_ne < 1 ) then set t_ne = 1 endif if ( $t_ar < 1 ) then set t_ar = 1 endif if ( $t_krxe < 1 ) then set t_krxe = 1 endif if ( $t_krxe_blue < 1 ) then set t_krxe_blue = 1 endif if ( $t_hg < 1 ) then set t_hg = 1 endif if ( $t_qzred < 1 ) then set t_qzred = 1 endif if ( $t_qzblue < 1 ) then set t_qzblue = 1 endif # Cycle shutter 3 times cycle_shutter 3 # Loop over desired masks foreach mask ($argv[2-]) #skip first argument because it is the #slit width in arcseconds. echo "----------------------------" echo " Slitmask : "$mask echo "----------------------------" echo if ( $noarcs == 0 ) then if ( $nored == 0 ) then slitmask $mask #change the slitmask wfi -n #wait for the current exposure, if any, to read out spectral #set CCD to spectral readout modify -s deiccd obstype="Line" set description = "NeArKrXe arc "$t_nearkrxe"s -- red" object $description tint $t_nearkrxe #set exposure time in sec lamps off #turn off lamps so FCS can track wffcs #wait for FCS to track lamps Ne Ar Kr Xe #turn on NeArKrXe lamps sleep 5 #wait for lamps to warm up goi #expose endif wfi -n #wait for the current exposure, if any, to read out spectral #set CCD to spectral readout modify -s deiccd obstype="Line" set description = "Ne arc "$t_ne"s" object $description tint $t_ne #set exposure time in sec lamps off #turn off lamps so FCS can track wffcs #wait for FCS to track lamps Ne #turn on Ne lamp sleep 5 #wait for lamp to warm up goi #expose wfi -n #wait for the current exposure, if any, to read out lamps off #turn off lamps so FCS can track set description = "Ar arc "$t_ar"s" object $description tint $t_ar #set exposure time in sec wffcs #wait for FCS to track lamps Ar #turn on Ar lamps sleep 5 #wait for lamp to warm up goi #expose wfi -n #wait for the current exposure, if any, to read out lamps off #turn off lamps so FCS can track set description = "KrXe arc "$t_krxe"s" object $description tint $t_krxe #set exposure time in sec wffcs #wait for FCS to track lamps Kr Xe #turn on KrXe lamps sleep 5 #wait for lamps to warm up goi #expose if ( $wavel <= $wavel_blue ) then wfi -n #wait for the current exposure, if any, to read out lamps off #turn off lamps so FCS can track set description = "KrXe arc "$t_krxe_blue"s -- blue" object $description tint $t_krxe_blue #set exposure time in sec wffcs #wait for FCS to track lamps Kr Xe #turn on KrXe lamps sleep 5 #wait for lamps to warm up goi #expose endif wfi -n #wait for the current exposure, if any, to read out lamps off #turn off lamps so FCS can track set description = "Hg arc "$t_hg"s" object $description tint $t_hg #set exposure time in sec wffcs #wait for FCS to track lamps Hg #turn on Hg lamp sleep 210 #wait for lamp to warm up goi #expose endif if ( $noflats == 0 ) then if ( $nored == 0 ) then wfi -n #wait for exposure to read out lamps off #turn off lamps modify -s deiccd obstype="IntFlat" set description = "Qz flat -- red" object $description tint $t_qzred #set exposure time in sec wffcs #wait for FCS to track lamps Qz #turn on Qz flat lamp sleep 30 #wait for lamp to warm up goi 3 #take 3 exposures endif if ( $nored == 1 ) then wfi -n #wait for exposure to read out lamps off #turn off lamps modify -s deiccd obstype="IntFlat" endif set description = "Qz flat -- blue" object $description tint $t_qzblue #set exposure time in sec if ( $nored == 1 ) then wffcs #wait for FCS to track lamps Qz #turn on Qz flat lamp sleep 30 #wait for lamp to warm up endif goi 6 #take 6 exposures endif lamps off #turn off lamps end exit 0