#!/bin/csh -f source /star/etc/login >& /dev/null source /star/etc/cshrc >& /dev/null kappa >& /dev/null if (`alias kappa` == "") then echo "" echo "Fatal: Initialization error of kappa environment" echo "" exit endif if ($#argv < 1) set argv = "help" if (`printenv obsdate` == "") then echo "Error: variable obsdate not set" set argv = "help" endif if ($argv[1] =~ *"help"* || $argv[1] == "-h") then echo "" echo "Use: sp_coadd obsnr1 obsnr2 ..." echo " e.g. 'sp_coadd 10 11 13 15'" echo "" echo " set the variable obsdate to the correct obsdate of" echo " the files to coadd. E.g. 'setenv obsdate 20061025'." echo " Filenames are expected to be: ac'obsdate'_'obsnr'.sdf" echo " If the files can not be found locally, sp_coadd will." echo " try a sp_get to get and makecube the raw spectra file." echo " sp_coadd used 'wcsmosaic' for the coadd and does a" echo " sp_axis on the resulting file for a old-style spectral axis." echo "" exit else set answer = "$argv" endif # Copy spectra files and make cubes sp_get $argv # Coadd \rm -f coadd.in > /dev/null touch coadd.in foreach i (${argv}) set obsnr = `printf "%5.5d" ${i}` echo "./ac${obsdate}_${obsnr}" >> coadd.in end # Coadd files wcsmosaic in=^coadd.in out=coadd_${1} accept sp_axis coadd_${1} echo "Coadded result stored in coadd_${1}" echo ""