Index: mire/mire.sh
===================================================================
--- mire/mire.sh	(revision 16)
+++ mire/mire.sh	(revision 17)
@@ -3,15 +3,13 @@
 # Batch pour analyse des images de mires
 
+# usage : mire nom.fits reperes.txt timing.txt
+
+echo "********** Image : $1 ****"
+
 PATH_TO_MIRE="/home/meynadie/svn/mire"
-
-echo "Pretraitement du fichier..."
-
-IMAGE_0=$(basename $1 .fits)_0.fits
-
-pre $1 $IMAGE_0
 
 echo "DÃ©tection d'objets..."
 cp -f $PATH_TO_MIRE/mire.param .
-sex -c $PATH_TO_MIRE/mire.sex $IMAGE_0
+sex -c $PATH_TO_MIRE/mire.sex $1
 CATALOG=$(basename $1 .fits).cat
 mv test.cat $CATALOG
@@ -19,8 +17,9 @@
 echo "Mesures gÃ©omÃ©triques..."
 OUTPUT_FILENAME=$(basename $1 .fits).mes
-python $PATH_TO_MIRE/process.py -c $CATALOG -r $2 -o test.fits > $OUTPUT_FILENAME
+python $PATH_TO_MIRE/process.py -c $CATALOG -r $2 -o test.fits -m $OUTPUT_FILENAME -t $3
 
 
-rm -f $IMAGE_0 $CATALOG mire.param
+rm -f $CATALOG mire.param
+
 
 exit 0
Index: mire/mire_all.sh
===================================================================
--- mire/mire_all.sh	(revision 17)
+++ mire/mire_all.sh	(revision 17)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+for file in *.fits; do
+    mire $file reperes.txt timing;
+    done;
+
+rm -f collect
+for file in *.mes; do
+    tail -n1 $file >> collect;
+    done;
+
+
Index: mire/process.py
===================================================================
--- mire/process.py	(revision 16)
+++ mire/process.py	(revision 17)
@@ -8,4 +8,7 @@
 
 from functions import *
+
+from datetime import *
+
 
 from optparse import OptionParser
@@ -18,7 +21,44 @@
                   default="output.fits",
                   help="Name of the output fits file")
+parser.add_option("-m","--measurement",dest="measurement",
+                  default="output.mes",
+                  help="Name of the output measurement file")
+parser.add_option("-t","--timing",dest="timing",
+                  help="Name of the input timing file")
 
 
 (options, args) = parser.parse_args ()
+
+# Recherche de la date dans un fichier des timings
+# (gÃ©nÃ©rÃ© par recup_date, soit :
+# ls -l $1| awk '{print$8 "\t" $7 "\t" $6}' | sort -k2 | sed -e 's/*//'
+# oÃ¹ $1 est le rÃ©pertoire contenant les .dat non modifiÃ©s.)
+
+is_ref=1
+refdt=datetime(1970,1,1,0,0)
+dt = refdt
+delta_t = dt - refdt
+for line in file(options.timing):
+    line_s = string.split(line)
+    if (len(line_s) > 2):
+        nom = line_s[0] [:-4]
+        if (is_ref==1):
+            [heure,minute] = string.split(line_s[1],":")
+            [annee,mois,jour] = string.split(line_s[2],"-")
+            refdt =  datetime(int(annee),
+                              int(mois),
+                              int(jour),
+                              int(heure),
+                              int(minute))
+            is_ref=0
+        if (nom == options.catalogfile[:-6]):
+            [heure,minute] = string.split(line_s[1],":")
+            [annee,mois,jour] = string.split(line_s[2],"-")            
+            dt = datetime(int(annee),
+                          int(mois),
+                          int(jour),
+                          int(heure),
+                          int(minute))
+            delta_dt = dt-refdt
 
 # Donner les coordonnÃ©es approximatives des 4 repÃšres
@@ -137,6 +177,6 @@
                     distance += modulus(pos_source-pos_voisin)
             if (nb_voisin !=0):
-                catalog[knot_idx]['MEAN_DIST_TO_NGBRS'] = distance / nb_voisin
-                lookup_sources[i,j,3] = distance / nb_voisin
+                catalog[knot_idx]['MEAN_DIST_TO_NGBRS'] = float(distance) / nb_voisin
+                lookup_sources[i,j,3] = float(distance) / nb_voisin
         
 cleaned_catalog = []
@@ -229,6 +269,15 @@
             tmp.append(lookup_sources[i,j,3])
 
-print "#Moyenne des mesures /  Module vec_i /  Module vec_j",
-
-print sum(tmp)/len(tmp),modulus(vec_i),modulus(vec_j)
-
+
+meas = open(options.measurement,'w')
+
+meas.write("# Moyenne des mesures /  Module vec_i /  Module vec_j / deltaT (min) / date\n")
+outs = "%7.4f %7.4f %7.4f %7.3f %s\n" % (sum(tmp)/len(tmp),
+                                         modulus(vec_i),
+                                         modulus(vec_j),
+                                         delta_dt.seconds/60.,
+                                         dt.isoformat())
+meas.write(outs)
+
+meas.close()
+
