Last change
on this file since 27 was
15,
checked in by meynadie, 16 years ago
|
Ajout Fichiers configs
Ajout cat2reg dans les fonctions
|
File size:
877 bytes
|
Line | |
---|
1 | import numpy |
---|
2 | import math |
---|
3 | |
---|
4 | def modulus(vec): |
---|
5 | tmp = 0 |
---|
6 | for comp in vec: |
---|
7 | tmp += comp**2 |
---|
8 | return math.sqrt(tmp) |
---|
9 | |
---|
10 | import string |
---|
11 | import sys |
---|
12 | def 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
TracBrowser
for help on using the repository browser.