-
Notifications
You must be signed in to change notification settings - Fork 0
/
getstar.py
executable file
·29 lines (22 loc) · 890 Bytes
/
getstar.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
# build a catalog using sextractor on des image
import sys,glob
sys.path.append('/usr/remote/user/sispi/jiangang/decam-fermi')
#from DECamCCD import *
if len(sys.argv) == 1:
print 'syntax: '
print 'getStarCat image.fits'
print 'The image need to be reduced'
else:
def sex(image, output, sexdir='/usr/remote/user/sispi/jiangang/des-sv/sexconfig/', check_img=None,config=None):
'''Construct a sextractor command and run it.'''
if sexdir[-1] != '/': sexdir += '/'
com = ["sex", image, "-c "+sexdir+config,"-CATALOG_NAME "+output,"-CHECKIMAGE_NAME "+check_img]
com = string.join(com)
res = os.system(com)
return res
img_name = sys.argv[1]
output=img_name[0:-5]+'_star_catalog.fits'
ckimg=img_name[0:-5]+'check.fits'
t=sex(img_name,output,check_img=ckimg,config="initial.sex")
print '----done !---'