#!/bin/tcsh -ef

#
# ABOUT    : NOTCam script to take data for Detector Quality Control.
#            NB! Mirror covers must be opened. The lamp must be ON. The
#            intensity of the lamp must be such that it gives ~600 adu
#            in 0.5 sec exposure (WF-camera and J-band).
#
#            Only the "ramp-sampling" readout mode is run!
#
# USAGE     : notcam.lintest-rs [-e]
#           -e      : Echo script on stdout, do not execute
#
# DEPENDS : notcam.autosave_on, notcam.autosave_off, notcam.object,
#           notcam.imtype, notcam.lens, notcam.clear, notcam.mdark,
#           notcam.mexpose, notcam.dframes, notcam.frames, notcam.dark,
#           notcam.expose, notcam.notcamfocus, 
#           notcam.filter1, notcam.filter2, notcam.stop, 
#           notcam.grism, notcam.wait_notcam_ready
#
# PROVIDES: notcam.lintest-rs
#
# TFUNCT  : about 0.5 hour
#
# AUTHOR  : Anlaug Amanda Djupvik
#
# HISTORY : 2008/05/21 (Initial release sequencer version, AAD)
#           2009/04/23 Changed notcaminst. -> notcam.
#                      Changed notcam.focus -> notcam.notcamfocus (AAD)

# If -e option is given
if ("$1" == "-e") then
  set e = "echo"
  shift
else
  set e = ""
endif

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


# Execute or Echo script

# NOTCam setup should be the following
# Lens = WF camera
# Aperture = open large 
# Filter wheel 1 = open
# Filter wheel 2 = J
# Stop = 15 mm ring
# Grism = open
# Camera focus = 5650

$e date

$e notcam.lens 1 &
$e notcam.notcamfocus 5650 &
$e notcam.aperture 4 &
$e notcam.filter1 15 &
$e notcam.filter2 13 &
$e notcam.stop 12 &
$e notcam.grism 2 &
$e notcam.wait_notcam_ready

$e notcam.autosave_on

$e notcam.clear
$e notcam.clear
$e notcam.object "mdark 0 5"
$e notcam.mdark 0 5
$e notcam.object "lin-rs 42s 1"
$e notcam.imtype FLAT
$e notcam.frames 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.object "drk-rs 42s 1"
$e notcam.imtype DARK
$e notcam.dframes 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.object "lin-rs 42s 2"
$e notcam.imtype FLAT
$e notcam.frames 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.object "drk-rs 42s 2"
$e notcam.imtype DARK
$e notcam.dframes 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.object "lin-rs 42s 3"
$e notcam.imtype FLAT
$e notcam.frames 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.object "drk-rs 42s 3"
$e notcam.imtype DARK
$e notcam.dframes 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.object "lin-rs 42s 4"
$e notcam.imtype FLAT
$e notcam.frames 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.object "drk-rs 42s 4"
$e notcam.imtype DARK
$e notcam.dframes 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.object "lin-rs 42s 5"
$e notcam.imtype FLAT
$e notcam.frames 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.object "drk-rs 42s 5"
$e notcam.imtype DARK
$e notcam.dframes 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.object "lin-rs 42s 6"
$e notcam.imtype FLAT
$e notcam.frames 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.object "drk-rs 42s 6"
$e notcam.imtype DARK
$e notcam.dframes 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.object "lin-rs 42s 7"
$e notcam.imtype FLAT
$e notcam.frames 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.object "drk-rs 42s 7"
$e notcam.imtype DARK
$e notcam.dframes 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.object "lin-rs 42s 8"
$e notcam.imtype FLAT
$e notcam.frames 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.object "drk-rs 42s 8"
$e notcam.imtype DARK
$e notcam.dframes 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.object "lin-rs 42s 9"
$e notcam.imtype FLAT
$e notcam.frames 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.clear
$e notcam.object "drk-rs 42s 9"
$e notcam.imtype DARK
$e notcam.dframes 4.2 10
$e notcam.clear
$e notcam.clear
$e notcam.object "mdark 0 5"
$e notcam.mdark 0 5
$e notcam.imtype OBJECT

$e astrowakeup

$e date

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