calib_focus.prg.

calib_focus.prg.

#!/bin/csh 
alias echo "echo > /dev/null"
kappa
figaro
unalias echo
gdclear
lutheat
convert
#

echo " "
echo " *** FOCUS ON ARC SPECTRUM *** "
echo " "
echo " Process a group of sequential frames taken with different "
echo " instrument/array focus setting. "
echo " Extract central row from each spectrum and fit gaussian to "
echo " the peak in each spectrum: note FWHM.  "
echo " Can then plot the widths of the profiles against UIST focus "
echo " to get best focus for grism/slit combo. "
echo " "
echo " Use QUICK_LOOK _raw frames"
echo " "


set date=20060202
echo "Date set to" $date

echo -n "Enter the number of the first frame in sequence: "
set f1="$<"
echo -n "Enter the number of the last  frame in sequence: "
set fn="$<"

  set n = $f1
  while ($n <= $fn)
    if ($n < 10) set numcal=0000${n}
    if ($n > 9 && $n < 100) set numcal=000${n}
    if ($n > 99 && $n < 1000) set numcal=00${n}
    if ($n > 999) set numcal=0${n}

#   gaiadisp u${date}_${numcal}_raw

    echo " Extract centre row, middle"

    ## LONG
    extract image=u${date}_${numcal}_raw ystart=545 yend=550 spectrum=middle
    echo " "
    echo " Assuming there is a line in range mask1 to mask2 below !"
    echo " "

    echo " "
    echo " ******************************************** "
    echo " ******************************************** "
    echo "             GAUSSIAN FITTING... "
    echo " "

    fitgauss in=middle device=xw mask1=360 mask2=400
    rm middle.sdf

    @ n = $n + 1
  end