aboutsummaryrefslogtreecommitdiff
path: root/scripts/calfuse.wavecal
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-03-05 12:53:09 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-03-05 12:53:09 -0500
commit832b4b34ff8ce84a13751883c0822c16c152fe48 (patch)
treeedb4d7050c37ade55bc543de80e76e58c4486908 /scripts/calfuse.wavecal
parent8f848043369b49e861942ce132181fed2c53c2d3 (diff)
downloadcalfuse-832b4b34ff8ce84a13751883c0822c16c152fe48.tar.gz
Massive rework
Diffstat (limited to 'scripts/calfuse.wavecal')
-rwxr-xr-xscripts/calfuse.wavecal130
1 files changed, 130 insertions, 0 deletions
diff --git a/scripts/calfuse.wavecal b/scripts/calfuse.wavecal
new file mode 100755
index 0000000..eae4653
--- /dev/null
+++ b/scripts/calfuse.wavecal
@@ -0,0 +1,130 @@
+#!/usr/local/bin/tcsh -f
+#******************************************************************************
+#* Johns Hopkins University
+#* Center For Astrophysical Sciences
+#* FUSE
+#******************************************************************************
+#*
+#* Synopsis: calfuse.wavecal file_name
+#*
+#* Description: Shell script for processing FUSE Ver 3.0 time-tagged exposures.
+#* All messages are written to stdout or stderr.
+#*
+#* WARNING: THIS VERSION IS OPTIMIZED FOR PROCESSING WAVELENGTH
+#* CALIBRATION DATA!!!
+#*
+#* Arguments: char file_name File name to process is 1st command-
+#* line argument
+#*
+#* Returns: Exit codes:
+#* 0 Successful execution
+#*
+#*
+#* Environment variables: CF_CALDIR Path to directory which contains the
+#* calibration files.
+#* CF_IDLDIR Path to CalFUSE IDL directory
+#* CF_PIPELINE Flag to determine if CALFUSE
+#* is running as part of the JHU
+#* pipeline.
+#*
+#* History: 02/26/03 1.1 peb Begin work on V3.0
+#* 03/19/03 1.2 wvd Add IDL plots
+#* 03/31/03 1.3 peb Add cf_ttag_countmap/gainmap programs
+#* and changed the timestamp format to be
+#* similar to cf_timestamp
+#* 05/16/03 1.4 wvd Distinguish between TTAG and HIST files.
+#* Changed name to calfuse.csh
+#* 05/22/03 1.5 wvd Direct STDERR to trailer file.
+#* 06/03/03 1.6 rdr Incorporated bad pixel map
+#* 06/09/03 1.7 rdr Do not screen on timing flags for HIST
+#* data processed behind the firewall
+#* 07/31/03 1.8 wvd Check error status before exiting.
+#* 09/15/03 1.9 wvd Write BEGIN and END stmts to logfile.
+#* 12/08/03 1.10 wvd For HIST data, always call
+#* cf_extract_spectra and cf_bad_pixels
+#* with -s option.
+#* 12/21/03 1.13 wvd Remove underscore from idf and bpm
+#* filenames.
+#* 04/22/04 1.12 wvd Change name of trailer file to
+#* {$froot}.trl
+#* 05/12/04 1.13 wvd Remove cf_ttag_countmap and
+#* cf_ttag_gainmap from pipeline.
+#* 06/01/04 1.14 wvd For HIST data, no longer need to call
+#* cf_extract_spectra with -s option.
+#* 06/03/04 1.15 wvd Screening step now follows "Convert
+#* to FARF."
+#*
+#*****************************************************************************/
+
+set idf = ${1:s/raw/idf/}
+set froot = ${1:s/raw.fit//}
+set logfile = {$froot}.trl
+set ttag = `echo $froot | grep -c ttag`
+
+# Put a time stamp in the log file (the OPUS trailer file).
+if $ttag then
+ echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Begin TTAG file $1"
+ echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Begin TTAG file $1" >>& $logfile
+else
+ echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Begin HIST file $1"
+ echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Begin HIST file $1" >>& $logfile
+endif
+
+set cfstat=0
+
+# Step 1 -- Generate Intermediate Data File
+if $ttag then
+ cf_ttag_init $1 $idf >>& $logfile
+ set cfstat=$status
+else
+ cf_hist_init $1 $idf >>& $logfile
+ set cfstat=$status
+endif
+
+# Step 2 -- Convert to FARF
+if ! $cfstat then
+ cf_convert_to_farf $idf >>& $logfile
+ set cfstat=$status
+endif
+
+# Step 3 -- Screen photons
+if ! $cfstat then
+ cf_screen_photons $idf >>& $logfile
+ set cfstat=$status
+endif
+
+# Step 4 -- Remove motions
+if ! $cfstat then
+ cf_remove_motions $idf >>& $logfile
+ set cfstat=$status
+endif
+
+# Step 5 -- Assign wavelength - SAVE ASTIG-CORRECTED X ARRAY
+if ! $cfstat then
+ cf_assign_wavelength -w $idf >>& $logfile
+ set cfstat=$status
+endif
+
+if ! $cfstat then
+ if ($?CF_IDLDIR) then
+ idlplot_rate.pl {$froot} >>& $logfile
+ idlplot_spex.pl {$froot} >>& $logfile
+ endif
+endif
+
+# Step 6 -- Flux calibrate
+if ! $cfstat then
+ cf_flux_calibrate $idf >>& $logfile
+ set cfstat=$status
+endif
+
+if ! $cfstat then
+ echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Finish data file $1"
+ echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Finish data file $1" >>& $logfile
+else
+ echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Error processing $1"
+ echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Error processing $1" >>& $logfile
+endif
+exit($cfstat)
+
+#******************************************************************************