from astropy.io import fits
import os
# cmd1 = 'ls ./tmp/*589*.2acat >2acat.dat'
# cmd2 = 'ls ./tmp/*589*.xy >xy.dat'
#
# os.system(cmd1)
# os.system(cmd2)
blist = [line.rstrip()for line in open('in_gaborstar.log')]
path = './tmp/'
for j in blist:
# xyfile = path+j[-65:-5]+'.xy'
xyfile = path + j[23:83] + '.xy'
# xyfile = j[0:66]+'.xy11'
print(xyfile)
# alist = [line.rstrip()for line in open('2acat.dat')]
# for i in alist:
filesatreg = xyfile[0:-3]+'.reg'
if os.path.exists(filesatreg):
cmd3 = 'rm '+filesatreg
os.system(cmd3)
f3 = open(filesatreg, 'a')
hdul2 = fits.open(xyfile)
stardata = hdul2[1].data
f3.write('global color=red dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include =1 source=1'+'\n')
f3.write('physical'+'\n')
# for kk in range(len(objdata )) :
# f3.write('circle('+str( objdata['X'][kk] ) +','+str( objdata['Y'][kk] )+','+ str( 4 ) + ')'+'\n')
for b in range(len(stardata )) :
f3.write('circle('+str( stardata['X'][b] ) +','+str( stardata['Y'][b] )+','+ str( 4 ) + ')'+'\n')
hdul2.close()
write reg
最新推荐文章于 2022-08-22 18:57:49 发布