#!/bin/tcsh -ef

# ABOUT   : NOTCam automatic script to observe the photometric standard field 
#           AS16 with the WF camera in the JHKs. Go to target included in script. 
#           Filter changes and focus offsets are done. For each filter the standard 
#           field is observed in a 5-point (dice) dither pattern.         
#
# USAGE   : notcam.as16-jhk [-e]
#           -e      : Echo script on stdout, do not execute
#
# DEPENDS : notcam.setup-ima, notcam.filter2, notcam.object, notcam.wait_notcam_ready, 
#           tcs.focus-delta, notcam.autosave_on, notcam.teloffset, notcam.frames,
#           notcam.imtype, tcs.enter-object, tcs.auto-positioning-full, tcs.guide-object,
#           notcam.setup-ima, notcam.clearobject
#
# PROVIDES: notcam.as16-jhk
#
# TFUNCT  : ((Texp + Tread + Tsave + Tdither)*5 + 30s)*3 + 60s ~ 10 min
#
# AUTHOR  : Anlaug Amanda Djupvik
#
# HISTORY : 2008/06/03 (Initial release, AAD)
#           2009/04/23 Changed notcaminst. -> notcam.  (AAD)   
#           2010/03/02 Now using notcam.setup-ima (AAD)
#           2010/03/03 Go to target + popup finding chart added. (AAD)

if ("$1" == "-e") then
  set e = "echo"
  shift
else
  set e = ""
endif

# Write to Talker
logger -p local0.debug -t "notcam.as16-jhk" "[NOTE]: as16-jhk started"

# Go to target and display finding chart
$e tcs.ag-off
$e tcs.enter-object AS16 07 24 15.4 -00 32 49 2000 0 0 11
$e tcs.auto-positioning-full 
$e tcs.guide-object AS16 
$e xv /home/softremote/obs/scripts/staff/amanda/as16.jpg &
$e notcam.imtype STD
$e notcam.autosave_on
$e notcam.rempath /data/service/calib/
$e notcam.remsave_on

# K-band images
$e notcam.setup-ima wf 207 
$e notcam.5point -nowakeup frame 3.6 3 AS16 15 2 1

# J-band images
$e notcam.setup-ima wf 201
$e notcam.5point -nowakeup frame 3.6 3 AS16 15 2 1

# H-band images
$e notcam.setup-ima wf 203
$e notcam.5point -nowakeup frame 3.6 3 AS16 15 2 1

# Finishe and notify
$e notcam.imtype OBJECT
$e notcam.clearobject
$e notcam.remsave_off
$e astrowakeup

# All done. Exit with error status 0 and write to Talker
logger -p local0.debug -t "notcam.as16-jhk" "[NOTE]: as16-jhk ended successfully"
exit 0



