Changeset 18


Ignore:
Timestamp:
07/15/08 17:53:43 (16 years ago)
Author:
meynadie
Message:

mises au point

Location:
mire
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • mire/mire.sh

    r17 r18  
    33# Batch pour analyse des images de mires 
    44 
    5 # usage : mire nom.fits reperes.txt timing.txt 
     5usage="mire [-s(kip sextractor)] nom.fits reperes.txt timing.txt" 
     6 
     7skip_sextractor=false; 
     8while getopts s flag ; do 
     9    case $flag in 
     10        s) skip_sextractor=true;; 
     11        \?) echo $usage; exit 1;; 
     12    esac 
     13done 
     14shift `expr "$OPTIND" - 1` 
     15 
    616 
    717echo "********** Image : $1 ****" 
     
    919PATH_TO_MIRE="/home/meynadie/svn/mire" 
    1020 
    11 echo "Détection d'objets..." 
    12 cp -f $PATH_TO_MIRE/mire.param . 
    13 sex -c $PATH_TO_MIRE/mire.sex $1 
    1421CATALOG=$(basename $1 .fits).cat 
    15 mv test.cat $CATALOG 
     22if test $skip_sextractor == false 
     23then 
     24    rm -f $CATALOG mire.param 
     25    echo "Détection d'objets..." 
     26    cp -f $PATH_TO_MIRE/mire.param . 
     27    sex -c $PATH_TO_MIRE/mire.sex $1 
     28    mv test.cat $CATALOG 
     29fi 
    1630 
    1731echo "Mesures géométriques..." 
     
    2034 
    2135 
    22 rm -f $CATALOG mire.param 
     36 
    2337 
    2438 
  • mire/mire_all.sh

    r17 r18  
    11#!/bin/sh 
    22 
    3 for file in *.fits; do 
    4     mire $file reperes.txt timing; 
    5     done; 
     3usage="mire_all [-s(kip sextractor)]" 
     4 
     5skip_sextractor=false; 
     6while getopts s flag ; do 
     7    case $flag in 
     8        s) skip_sextractor=true;; 
     9        \?) echo $usage; exit 1;; 
     10    esac 
     11done 
     12shift `expr "$OPTIND" - 1` 
     13 
    614 
    715rm -f collect 
    8 for file in *.mes; do 
    9     tail -n1 $file >> collect; 
     16for file in *.fits; do 
     17    if test $skip_sextractor == true 
     18    then 
     19        mire -s $file reperes.txt timing; 
     20    else 
     21        mire $file reperes.txt timing; 
     22    fi 
     23    tail -n1 $(basename $file .fits).mes >> collect; 
    1024    done; 
    1125 
    1226 
     27 
  • mire/process.py

    r17 r18  
    158158# Calcul de la distance moyenne entre noeuds voisins 
    159159 
    160 for i in range(1,80): 
    161     for j in range(1,80): 
     160fen = 2 
     161 
     162shift_list = [] 
     163 
     164for i in range(-fen,fen+1): 
     165    for j in range(-fen,fen+1): 
     166        if (i!=0 or j!=0): 
     167            shift_list.append([i,j]) 
     168 
     169for i in range(fen,81-fen): 
     170    for j in range(fen,81-fen): 
    162171        if (lookup_sources[i,j,0] > 0): 
    163172            knot_idx = int(lookup_sources[i,j,2]) 
     
    165174            nb_voisin = 0 
    166175            distance = 0 
     176            weights = 0 
    167177            pos_source = array([catalog[knot_idx]['X_IMAGE'], 
    168178                                catalog[knot_idx]['Y_IMAGE']]) 
    169             for shifts in [[0,1],[1,0],[-1,0],[0,-1]]: 
     179            for shifts in shift_list : 
    170180                i_voisin = i + shifts[0] 
    171181                j_voisin = j + shifts[1] 
     
    176186                                        catalog[neigh_idx]['Y_IMAGE']]) 
    177187                    distance += modulus(pos_source-pos_voisin) 
    178             if (nb_voisin !=0): 
    179                 catalog[knot_idx]['MEAN_DIST_TO_NGBRS'] = float(distance) / nb_voisin 
    180                 lookup_sources[i,j,3] = float(distance) / nb_voisin 
     188                    weights += modulus(shifts) 
     189            if (nb_voisin > 0): 
     190                catalog[knot_idx]['MEAN_DIST_TO_NGBRS'] = float(distance)/weights 
     191                lookup_sources[i,j,3] = float(distance)/weights 
    181192         
    182193cleaned_catalog = [] 
     
    266277for i in range(81): 
    267278    for j in range(81): 
    268         if (lookup_sources[i,j,0] > 0): 
     279        if (lookup_sources[i,j,0] == 1): 
    269280            tmp.append(lookup_sources[i,j,3]) 
    270281 
Note: See TracChangeset for help on using the changeset viewer.