#!/usr/bin/env tcsh 
# Copyright 2005, 2006 University of Leiden.
#
# This file is part of MIA+EWS.
#
# MIA+EWS is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# MIA+EWS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MIA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#!/usr/bin/env tcsh 
#   Usage:
#   dispPhot Afiles (blank separated list) Bfiles maskFile  outputBaseName dSky [curveRefFile] [order]

#set default of no ref file

set ref = ""
if ( $# > 5 ) then
   set ref = "-ref $6"
endif

set order = ""
if ( $# > 6 ) then
   set order = "-order $7"
endif
echo $ref $order
#echo "   computing photometry "
$vltiCbin/oirChopPhotoImages -in "$1" -out $4.Aphotometry.fits -dSky $5 $ref $order
if (0 != $status) then
   echo " A chop photometry failed"
   exit 1
endif
$vltiCbin/oirChopPhotoImages -in "$2" -out $4.Bphotometry.fits -dSky $5 $ref $order
if (0 != $status) then
   echo " B chop photometry failed"
   exit 1
endif
$vltiCbin/oirMakePhotoSpectra -A $4.Aphotometry.fits -B $4.Bphotometry.fits -out $4.photometry.fits -mask $3 -shift 0
if (0 != $status) then
   echo " Mask photometry operation failed"
   exit 1
endif
