Changeset 33 for mire


Ignore:
Timestamp:
10/28/08 17:50:04 (15 years ago)
Author:
meynadie
Message:

filtrage des données couronne

Location:
mire
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mire/moyenne_ring.py

    r32 r33  
    11#!/bin/env python 
     2# coding: utf-8 
    23 
    34import math 
     
    67import scipy 
    78 
     9# Une valeur moyenne par image 
    810for filename in glob.glob("*.ring"): 
    911    data = [] 
     
    1618            data.append(float(string.split(line)[2])) 
    1719    print filename, phase, date, scipy.mean(data) 
     20 
     21# Un fichier contenant la moyenne en fonction du PA 
     22 
     23data = [] 
     24for filename in glob.glob("*.ring"):     
     25    for line in file(filename): 
     26        if (line[0]=="#"): 
     27            line_s = string.split(line) 
     28            phase = line_s[2] 
     29            date = line_s[4] 
     30        else : 
     31            data.append([float(string.split(line)[1]), 
     32                         float(string.split(line)[2])]) 
     33 
     34# binning par pas de 10° 
     35collect = [] 
     36for i in range(36): 
     37    collect.append([]) 
     38 
     39for d in data: 
     40    collect[int(math.floor(d[0]/10.))].append(d[1]) 
     41 
     42moy = [] 
     43for c in collect: 
     44    moy.append(scipy.mean(c)) 
     45 
     46sig = [] 
     47for c in collect: 
     48    sig.append(scipy.std(c)) 
     49 
     50 
     51# Filtrage à 3sig 
     52result = [] 
     53for i in range(len(collect)): 
     54    def f(x): 
     55        return (math.fabs(x - moy[i]) < 3 * sig[i]) 
     56    collect[i] = filter(f,collect[i]) 
     57    result.append(scipy.mean(collect[i])) 
     58     
     59 
     60of = open("couronne",'w') 
     61for i in range(36): 
     62    outs = "%3d %10.7f\n" % (i*10,result[i]) 
     63    of.write(outs) 
     64 
     65of.close() 
     66     
  • mire/process.py

    r31 r33  
    349349        if (x_rel < 0): 
    350350            tmp['theta']+=math.pi 
    351         if (tmp['theta'] < 0): 
     351        # Offset de pi pour se mettre en convention "astro" 
     352        # theta = 0 -> P droit quand nord vers le haut 
     353        tmp['theta']+=math.pi 
     354        while (tmp['theta'] < 0): 
    352355            tmp['theta'] += 2*math.pi 
    353         if (tmp['theta'] >= 2*math.pi): 
     356        while (tmp['theta'] >= 2*math.pi): 
    354357            tmp['theta'] -= 2*math.pi 
    355         couronne.append(tmp) 
     358        # On n'écrit pas les valeurs aberrantes 
     359        if ((tmp['ScFact'] > 1.05) and (tmp['ScFact'] < 1.07)): 
     360            couronne.append(tmp) 
    356361 
    357362output_couronne = file(options.ring,'w') 
Note: See TracChangeset for help on using the changeset viewer.