#!/bin/csh -f #+ # twilight_zone - runs observing scripts for de Pater, de Kleer, Molter cadenced # twilight observations of planets # # Purpose: # # Make running the Twilight Zone observing program as straightforward as # possible for observers and OA's without any affiliation to the project. # Defines easy-to-use variables that run the observing scripts requested # for the project. # # Usage: # # ./twilight_zone [-timeit] [-nosetup] [-target ] [-nfilt ] [-startfilt ] # # Arguments: # # target: Name of the planet or moon you're observing (options Io, Titan, Uranus, Neptune) # nfilt: Number of filters you want to run # startfilt: Which filter should you start with? If not specified do all filters # Must be less than or equal to nfilt # timeit: Calculate time for each filter - used for testing # nosetup: Skip setup at beginning of the script. For experts only # # Output: # # Will prompt you before running script saying how much time it takes # A set of images taken following the defined filters and dithers. # If -timeit 1, output a .log file containing start and end time # # Help: # twilight_zone -h # # Examples: # # twilight_zone -timeit -target Uranus -nfilt 3 # # twilight_zone -nosetup -target Io -nfilt 9 -startfilt 7 # * this will do filters 7, 8, and 9 # # twilight_zone -target Titan -nfilt 3 -startfilt 3 # * this will do only filter 3 # # Modification history: # # 2017-07-10 Ned Molter Original version. # 2017-08-02 NM Added -startfilt flag. # 2019-07-02 Erin Redwing Modified for OSIRIS # 2020-12-28 CAAI Adapted to OSIRIS Linux upgrade. #----------------------------------------------------------------------- # set usage message set buf = $0 set cmd = $buf:t set usage = "Usage: $cmd [-target ] [-nfilt ] [-startfilt ] [-timeit]" # Set defaults... set target = 0 set nfilt = 0 set timeit = 0 set nosetup = 0 set startfilt = 1 set rottest = 269.50 set wfaotest = on #set rottest = 0.00 #set wfaotest = off modify -s osiris scriptrun = 0 modify -s osiris scriptreply = y sleep 3 if ( "$1" == "" ) then echo "No flags specified." echo "Exiting. Please use flag -h to see possible integration times, filters, and usage." exit 1 endif while (1) if ( "$1" == "-h" || "$1" == "-help" ) then echo "--------------------------" echo "--- twilight_zone help ---" echo "--------------------------" echo "PURPOSE: Run short OSIRIS observations of planets with minimal user input" echo " " echo "USAGE: twilight_zone [-target ] [-nfilt ] [-startfilt ]" echo " " echo "EXAMPLE: /twilight_zone -target Uranus -nfilt 3 -startfilt 2" echo " --note this will do just two filters, not three" echo " --You are doing up to filter 3 starting at filter 2." echo " " echo "FLAGS:" echo "-target :: Specifies which body you are observing." echo " Possible inputs: Io, Titan, Uranus, Neptune" echo "-nfilt :: A single integer specifying the number of filters you want to observe" echo "-startfilt :: A single integer specifying which filter you want to start with." echo " Must be less than or equal to specified value for -nfilt." echo " See EXAMPLE to understand how -startfilt and -nfilt work together." echo " If not specified, will start from the first filter." echo " " echo "TIMETABLE:" echo " nfilt // total time" echo "Io " echo " 1 // 4 minutes" echo " 2 // 7 minutes" echo " 3 // 10 minutes" echo " 4 // 13 minutes" echo " 5 // 16 minutes" echo " 6 // 19 minutes" echo " 7 // 22 minutes" echo " 8 // 25 minutes" echo " 9 // 28 minutes" echo "Titan " echo " 1 // 4 minutes" echo " 2 // 8 minutes" echo " 3 // 11 minutes" echo " 4 // 16 minutes" echo " 5 // 19 minutes" echo " 6 // 23 minutes" echo "Uranus " echo " 1 // 3 minutes" echo " 2 // 6 minutes" echo " 3 // 9 minutes" echo " 4 // 12 minutes" echo " 5 // 15 minutes" echo " 6 // 18 minutes" echo " 7 // 21 minutes" echo "Neptune " echo " 1 // 5 minutes" echo " 2 // 10 minutes" echo " 3 // 15 minutes" echo " 4 // 20 minutes" echo " 5 // 25 minutes" echo " 6 // 30 minutes" echo " 7 // 35 minutes" echo "--------------------------" exit 1 else if ( "$1" == "-timeit" ) then echo "Timing mode enabled. Time spent on each filter will be shown." set timeit = 1 shift continue else if ( "$1" == "-nosetup" ) then echo "Flag nosetup enabled. Skipping setup cmds." set nosetup = 1 shift continue else if ("$1" == "-nfilt") then set nfilt = {$2} shift shift continue else if ("$1" == "-target") then set target = {$2} shift shift continue else if ("$1" == "-startfilt") then set startfilt = {$2} shift shift continue # exit flag check if no flags left else if "$1" == "" then break #errant flag check else echo "Invalid flag specified: $1" echo "Exiting. Please use flag -h to see possible integration times, filters, and usage." exit 1 endif end #quick validation of -startfilt if ( $startfilt < 1 ) then echo "Invalid value for -startfilt: must be greater than or equal to 1. Please use flag -h to see possible integration times, filters, and usage." exit 1 endif if ($startfilt > $nfilt ) then echo "Invalid value for -startfilt: must be less than -nfilt. Please use flag -h to see possible integration times, filters, and usage." exit 1 endif #make log file if running timeit if ( $timeit == 1 ) then set now = `date` set outdir = `gshow -terse -s oids outdir` set datetime = `date +%y-%m-%d_%H:%M` set logfile = $outdir"/tz_$datetime.log" # where to put logfile?? echo "-----------------------------------------" > $logfile echo "-----$now-----" >> $logfile echo "-------------New Execution---------------" >> $logfile endif ################ ### Io stuff ### ################ if ( $target == io || $target == Io || $target == IO ) then ### validate inputs ### # check if that number of filters is allowed, if it is then set duration if ($nfilt == 1) then set duration = 4 else if ($nfilt == 2) then set duration = 6 else if ($nfilt == 3) then set duration = 9 else if ($nfilt == 4) then set duration = 13 else if ($nfilt == 5) then set duration = 16 else if ($nfilt == 6) then set duration = 19 else if ($nfilt == 7) then set duration = 22 else if ($nfilt == 8) then set duration = 25 else if ($nfilt == 9) then set duration = 28 else echo "Allowed number of filters for $target are 1, 2, 3, 4, 5, 6, 7, 8, 9" echo "Please set nfilt equal to one of these." exit 1 endif ### Make sure user is ok with amount of time things take. ### echo " * You chose to run $nfilt filters on object $target. This will take about $duration minutes." if ( $startfilt > 1 ) then echo " * -startfilt was specfied! You are starting from filter $startfilt." echo " * This will decrease the duration shown above." endif echo "Do you wish to continue (y/n)?" set answer = $< if ( $answer != "y" && $answer != "yes" && $answer != "Y" && $answer != "Yes" && $answer != "YES") then echo "Exiting. Please use flag -h to see possible integration times, filters, and usage." exit 1 endif ### start running ### if ( $timeit == 1 ) then echo "-------------Target: $target---------------" >> $logfile set now = `date` echo "Starting first integration. Time ::: $now" echo "Starting first integration. Time ::: $now" >> $logfile endif if ( $nosetup == 0 ) then #rerun initializations that should have been done by setup script wait4ao $wfaotest wait4dar off set rotdest = `gshow -s dcs -terse rotdest` if ( $rotdest != $rottest ) then echo "Rotdest must be equal to -42.5." exit 1 endif endif #Actually do the integrations for this target if ( $startfilt <= 1 ) then echo "Filter: Kn5" set cmd = `tz_convert Io Kn5` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 1. Time ::: $now" echo "Finished filter 1. Time ::: $now" >> $logfile endif endif if ($nfilt > 1 && $startfilt <= 2) then echo "Filter: Kn4" set cmd = `tz_convert Io Kn4` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 2. Time ::: $now" echo "Finished filter 2. Time ::: $now" >> $logfile endif endif if ($nfilt > 2 && $startfilt <= 3) then echo "Filter: BrGamma" set cmd = `tz_convert Io BrGamma` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 3. Time ::: $now" echo "Finished filter 3. Time ::: $now" >> $logfile endif endif if ($nfilt > 3 && $startfilt <= 4) then echo "Filter: HeI_B" set cmd = `tz_convert Io HeI_B` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 4. Time ::: $now" echo "Finished filter 4. Time ::: $now" >> $logfile endif endif if ($nfilt > 4 && $startfilt <= 5) then echo "Filter: Kn1" set cmd = `tz_convert Io Kn1` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 5. Time ::: $now" echo "Finished filter 5. Time ::: $now" >> $logfile endif endif if ($nfilt > 5 && $startfilt <= 6) then echo "Filter: Hn4" set cmd = `tz_convert Io Hn4` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 6. Time ::: $now" echo "Finished filter 6. Time ::: $now" >> $logfile endif endif if ($nfilt > 6 && $startfilt <= 7) then echo "Filter: Hbb" set cmd = `tz_convert Io Hbb` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 7. Time ::: $now" echo "Finished filter 7. Time ::: $now" >> $logfile endif endif if ($nfilt > 7 && $startfilt <= 8) then echo "Filter: Hcont" set cmd = `tz_convert Io Hcont` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 8. Time ::: $now" echo "Finished filter 8. Time ::: $now" >> $logfile endif endif if ($nfilt > 8 && $startfilt <= 9) then echo "Filter: Hn1" set cmd = `tz_convert Io Hn1` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 9. Time ::: $now" echo "Finished filter 9. Time ::: $now" >> $logfile endif endif echo "Script complete!" ################### ### Titan stuff ### ################### else if ( $target == titan || $target == Titan || $target == TITAN ) then ### validate inputs ### # check if that number of filters is allowed, if it is then set duratKn if ($nfilt == 1) then set duration = 4 else if ($nfilt == 2) then set duration = 8 else if ($nfilt == 3) then set duration = 11 else if ($nfilt == 4) then set duration = 16 else if ($nfilt == 5) then set duration = 19 else if ($nfilt == 6) then set duration = 23 else echo "Allowed number of filters for $target are 1, 2, 3, 4, 5, or 6." echo "Please set nfilt equal to one of these." exit 1 endif ### Make sure user is ok with amount of time things take. ### echo " * You chose to run $nfilt filters on object $target. This will take about $duration minutes." if ( $startfilt > 1 ) then echo " * -startfilt was specfied! You are starting from filter $startfilt." echo " * This will decrease the duration shown above." endif echo "Do you wish to continue (y/n)?" set answer = $< if ( $answer != "y" && $answer != "yes" && $answer != "Y" && $answer != "Yes" && $answer != "YES") then echo "Exiting. Please use flag -h to see possible integration times, filters, and usage." exit 1 endif ### start running ### if ( $timeit == 1 ) then echo "-------------Target: $target---------------" >> $logfile set now = `date` echo "Starting first integration. Time ::: $now" echo "Starting first integration. Time ::: $now" >> $logfile endif if ( $nosetup == 0 ) then #rerun initializations that should have been done by setup script wait4ao $wfaotest wait4dar off set rotdest = `gshow -s dcs -terse rotdest` if ( $rotdest != $rottest ) then echo "Rotdest must be equal to -42.5." exit 1 endif endif #Actually do the integrations for this target if ( $startfilt <= 1 ) then echo "Filter: Kp" set cmd = `tz_convert Titan Kp` echo $cmd eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 1. Time ::: $now" echo "Finished filter 1. Time ::: $now" >> $logfile endif endif if ($nfilt > 1 && $startfilt <= 2) then echo "Filter: Kn2" set cmd = `tz_convert Titan Kn2` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 2. Time ::: $now" echo "Finished filter 2. Time ::: $now" >> $logfile endif endif if ($nfilt > 2 && $startfilt <= 3) then echo "Filter: HeI_B" set cmd = `tz_convert Titan HeI_B` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 3. Time ::: $now" echo "Finished filter 3. Time ::: $now" >> $logfile endif endif if ($nfilt > 3 && $startfilt <= 4) then echo "Filter: BrGamma" set cmd = `tz_convert Titan BrGamma` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 4. Time ::: $now" echo "Finished filter 4. Time ::: $now" >> $logfile endif endif if ($nfilt > 4 && $startfilt <= 5) then echo "Filter: Hn3" set cmd = `tz_convert Titan Hn3` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 5. Time ::: $now" echo "Finished filter 5. Time ::: $now" >> $logfile endif endif if ($nfilt > 5 && $startfilt <= 6) then echo "Filter: FeII" set cmd = `tz_convert Titan FeII` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 6. Time ::: $now" echo "Finished filter 6. Time ::: $now" >> $logfile endif endif echo "Script complete!" #################### ### Uranus stuff ### #################### else if ( $target == uranus || $target == Uranus || $target == URANUS ) then ### validate inputs ### # check if that number of filters is allowed, if it is then set duration if ($nfilt == 1) then set duration = 6 else if ($nfilt == 2) then set duration = 11 else if ($nfilt == 3) then set duration = 17 else if ($nfilt == 4) then set duration = 22 else if ($nfilt == 5) then set duration = 27 else if ($nfilt == 6) then set duration = 32 else if ($nfilt == 7) then set duration = 38 else echo "Allowed number of filters for $target are 1, 2, 3, 4, 5, 6, or 7." echo "Please set nfilt equal to one of these." exit 1 endif ### Make sure user is ok with amount of time things take. ### echo " * You chose to run $nfilt filters on object $target. This will take about $duration minutes." if ( $startfilt > 1 ) then echo " * -startfilt was specfied! You are starting from filter $startfilt." echo " * This will decrease the duration shown above." endif echo "Do you wish to continue (y/n)?" set answer = $< if ( $answer != "y" && $answer != "yes" && $answer != "Y" && $answer != "Yes" && $answer != "YES") then echo "Exiting. Please use flag -h to see possible integration times, filters, and usage." exit 1 endif ### start running ### if ( $timeit == 1 ) then echo "-------------Target: $target---------------" >> $logfile set now = `date` echo "Starting first integration. Time ::: $now" echo "Starting first integration. Time ::: $now" >> $logfile endif if ( $nosetup == 0 ) then #rerun initializations that should have been done by setup script wait4ao $wfaotest wait4dar off set rotdest = `gshow -s dcs -terse rotdest` if ( $rotdest != $rottest ) then echo "Rotdest must be equal to -42.5." exit 1 endif endif #Actually do the integrations for this target if ( $startfilt <= 1 ) then echo "Filter: Hn3" set cmd = `tz_convert Uranus Hn3` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 1. Time ::: $now" echo "Finished filter 1. Time ::: $now" >> $logfile endif endif if ($nfilt > 1 && $startfilt <= 2) then echo "Filter: Kp" set cmd = `tz_convert Uranus Kp` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 2. Time ::: $now" echo "Finished filter 2. Time ::: $now" >> $logfile endif endif if ($nfilt > 2 && $startfilt <= 3) then echo "Filter: Hcont" set cmd = `tz_convert Uranus Hcont` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 3. Time ::: $now" echo "Finished filter 3. Time ::: $now" >> $logfile endif endif if ($nfilt > 3 && $startfilt <= 4) then echo "Filter: Jn3" tz_convert Uranus Jn3 if ( $timeit == 1 ) then set now = `date` echo "Finished filter 4. Time ::: $now" echo "Finished filter 4. Time ::: $now" >> $logfile endif endif if ($nfilt > 4 && $startfilt <= 5) then echo "Filter: Zn3" set cmd = `tz_convert Uranus Zn3` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 5. Time ::: $now" echo "Finished filter 5. Time ::: $now" >> $logfile endif endif if ($nfilt > 5 && $startfilt <= 6) then echo "Filter: FeII" set cmd = `tz_convert Uranus FeII` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 6. Time ::: $now" echo "Finished filter 6. Time ::: $now" >> $logfile endif endif if ($nfilt > 6 && $startfilt <= 7) then echo "Filter: Hn4" tz_convert Uranus Hn4 if ( $timeit == 1 ) then set now = `date` echo "Finished filter 7. Time ::: $now" echo "Finished filter 7. Time ::: $now" >> $logfile endif endif #ensure you end on target # if ( $nfilt == 1 || $nfilt == 3 || $nfilt == 5 || $nfilt == 7 ) then # fromsky # object Uranus # endif # Commented out following line due to Uranus rings widening. CAAI, 2019-06-19. #mov 512 512 362 512 echo "Script complete!" ##################### ### Neptune stuff ### ##################### else if ( $target == neptune || $target == Neptune || $target == NEPTUNE ) then ### validate inputs ### # check if that number of filters is allowed, if it is then set duration if ($nfilt == 1) then set duration = 6 else if ($nfilt == 2) then set duration = 11 else if ($nfilt == 3) then set duration = 16 else if ($nfilt == 4) then set duration = 21 else if ($nfilt == 5) then set duration = 26 else if ($nfilt == 6) then set duration = 31 else if ($nfilt == 7) then set duration = 36 else echo "Allowed number of filters for $target are 1, 2, 3, 4, 5, 6, or 7." echo "Please set nfilt equal to one of these." echo "Exiting. Please use flag -h to see possible integration times, filters, and usage." exit 1 endif ### Make sure user is ok with amount of time things take. ### echo " * You chose to run $nfilt filters on object $target. This will take about $duration minutes." if ( $startfilt > 1 ) then echo " * -startfilt was specfied! You are starting from filter $startfilt." echo " * This will decrease the duration shown above." endif echo "Do you wish to continue (y/n)?" set answer = $< if ( $answer != "y" && $answer != "yes" && $answer != "Y" && $answer != "Yes" && $answer != "YES") then echo "Exiting. Please use flag -h to see possible integration times, filters, and usage." exit 1 endif ### start running ### if ( $timeit == 1 ) then echo "-------------Target: $target---------------" >> $logfile set now = `date` echo "Starting first integration. Time ::: $now" echo "Starting first integration. Time ::: $now" >> $logfile endif #rerun initializations that should have been done by setup script if ( $nosetup == 0 ) then wait4ao $wfaotest wait4dar off set rotdest = `gshow -s dcs -terse rotdest` if ( $rotdest != $rottest ) then echo "Rotdest must be equal to -42.5." exit 1 endif endif #Actually do the integrations for this target if ( $startfilt <= 1 ) then echo "Filter: Hn3" set cmd = `tz_convert Neptune Hn3` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 1. Time ::: $now" echo "Finished filter 1. Time ::: $now" >> $logfile endif endif if ($nfilt > 1 && $startfilt <= 2) then echo "Filter: Kp" set cmd = `tz_convert Neptune Kp` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 2. Time ::: $now" echo "Finished filter 2. Time ::: $now" >> $logfile endif endif if ($nfilt > 2 && $startfilt <= 3) then echo "Filter: Hcont" set cmd = `tz_convert Neptune Hcont` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 3. Time ::: $now" echo "Finished filter 3. Time ::: $now" >> $logfile endif endif if ($nfilt > 3 && $startfilt <= 4) then echo "Filter: Jn3" set cmd = `tz_convert Neptune Jn3` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 4. Time ::: $now" echo "Finished filter 4. Time ::: $now" >> $logfile endif endif if ($nfilt > 4 && $startfilt <= 5) then echo "Filter: Zn3" set cmd = `tz_convert Neptune Zn3` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 5. Time ::: $now" echo "Finished filter 5. Time ::: $now" >> $logfile endif endif if ($nfilt > 5 && $startfilt <= 6) then echo "Filter: FeII" set cmd = `tz_convert Neptune FeII` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 6. Time ::: $now" echo "Finished filter 6. Time ::: $now" >> $logfile endif endif if ($nfilt > 6 && $startfilt <= 7) then echo "Filter: Hn4" set cmd = `tz_convert Neptune Hn4` eval $cmd if ( $timeit == 1 ) then set now = `date` echo "Finished filter 7. Time ::: $now" echo "Finished filter 7. Time ::: $now" >> $logfile endif endif echo "Script complete!" ### Invalid target catch ### else echo "Invalid target name. Choose from Io, Titan, Neptune, and Uranus." echo "Exiting. Please use flag -h to see possible integration times, filters, and usage." exit 1 endif if ( $timeit == 1 ) then set now = `date` echo "-------------End Execution---------------" >> $logfile echo "-----$now-----" >> $logfile echo "-----------------------------------------" >> $logfile endif exit 0