- Timestamp:
- 10/28/08 17:50:04 (15 years ago)
- Location:
- mire
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
mire/moyenne_ring.py
r32 r33 1 1 #!/bin/env python 2 # coding: utf-8 2 3 3 4 import math … … 6 7 import scipy 7 8 9 # Une valeur moyenne par image 8 10 for filename in glob.glob("*.ring"): 9 11 data = [] … … 16 18 data.append(float(string.split(line)[2])) 17 19 print filename, phase, date, scipy.mean(data) 20 21 # Un fichier contenant la moyenne en fonction du PA 22 23 data = [] 24 for 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° 35 collect = [] 36 for i in range(36): 37 collect.append([]) 38 39 for d in data: 40 collect[int(math.floor(d[0]/10.))].append(d[1]) 41 42 moy = [] 43 for c in collect: 44 moy.append(scipy.mean(c)) 45 46 sig = [] 47 for c in collect: 48 sig.append(scipy.std(c)) 49 50 51 # Filtrage à 3sig 52 result = [] 53 for 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 60 of = open("couronne",'w') 61 for i in range(36): 62 outs = "%3d %10.7f\n" % (i*10,result[i]) 63 of.write(outs) 64 65 of.close() 66 -
mire/process.py
r31 r33 349 349 if (x_rel < 0): 350 350 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): 352 355 tmp['theta'] += 2*math.pi 353 if(tmp['theta'] >= 2*math.pi):356 while (tmp['theta'] >= 2*math.pi): 354 357 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) 356 361 357 362 output_couronne = file(options.ring,'w')
Note: See TracChangeset
for help on using the changeset viewer.