def writeCandidates(self,filename=None):
if filename is None: filename = self.candfile
threshold = self.config['search']['cand_threshold']
select = (self.assocs['CUT']==0)
select &= (self.assocs['TS']>threshold)
#select &= (self.assocs['ASSOC2']=='')
self.candidates = self.assocs[select]
# ADW: View as a recarray or selection doesn't work.
# Why? I don't know, and I'm slightly terrified...
hdu = pyfits.new_table(self.candidates.view(np.recarray))
logger.info("Writing %s..."%filename)
hdu.writeto(filename,clobber=True)
# DEPRECATED: ADW 2017-09-15
## Dump to txt file
#if which('fdump'):
# txtfile = filename.replace('.fits','.txt')
# columns = ['NAME','TS','GLON','GLAT','DISTANCE','MASS']
# cmd = 'fdump %(infile)s %(outfile)s columns="%(columns)s" rows="-" prhead="no" showcol="yes" clobber="yes" pagewidth="256" fldsep=" " showrow="no"'%(dict(infile=filename,outfile=txtfile,columns=','.join(columns)))
# print cmd
# subprocess.call(cmd,shell=True)
评论列表
文章目录