Changeset 15 for mire/functions.py


Ignore:
Timestamp:
06/20/08 14:25:08 (16 years ago)
Author:
meynadie
Message:

Ajout Fichiers configs
Ajout cat2reg dans les fonctions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mire/functions.py

    r14 r15  
    77        tmp += comp**2 
    88    return math.sqrt(tmp) 
    9      
     9 
     10import string 
     11import sys 
     12def cat2reg(InputFile,OutFile): 
     13    x = [] 
     14    y = [] 
     15    fwhm = [] 
     16 
     17    for line in open(InputFile,'r'): 
     18        if (line[0] != '#'): 
     19            spl_line = string.split(line) 
     20            x.append(float(spl_line[1])) 
     21            y.append(float(spl_line[2])) 
     22            fwhm.append(float(spl_line[6])) 
     23 
     24    of = open(OutputFile,'w') 
     25 
     26    of.write("# Region file format: DS9 version 4.0\n") 
     27    of.write("# Filename: check.fits\n") 
     28    of.write("global color=green font=\"helvetica 10 normal\" select=1 highlite=1edit=1 move=1 delete=1 include=1 fixed=0 source\n") 
     29    of.write("physical\n") 
     30 
     31    for i in range(len(x)): 
     32        outs = "circle(%f,%f,%f)\n" %(x[i],y[i],fwhm[i]) 
     33        of.write(outs) 
     34         
     35    of.close() 
Note: See TracChangeset for help on using the changeset viewer.