#!/bin/sh

usage="mire_all [-s(kip sextractor)]"

skip_sextractor=false;
while getopts s flag ; do
    case $flag in
	s) skip_sextractor=true;;
	\?) echo $usage; exit 1;;
    esac
done
shift `expr "$OPTIND" - 1`


rm -f collect
rm -f *.mes
for file in *_0.fits; do
    if test $skip_sextractor == true
    then
	mire -s $file reperes.txt timing_cycle;
    else
	mire $file reperes.txt timing_cycle;
    fi
    tail -n1 $(basename $file .fits).mes >> collect;
    done;

moyenne_ring.py > moyenne_ring
carre.py > carre