def exposure(self, gamma=None):
"""
Compute exposure on source src, to add a flux column for the photometric light curve.
Warning: the input file is modified in place, with an additional exposure column added to the file !
"""
if self.daily:
infile = self.workDir + '/' + str(self.src) + '_daily_lc.fits'
srcmdl = self.workDir + '/' + str(self.src) + '_daily.xml'
else:
infile = self.workDir + '/' + str(self.src) + '_lc.fits'
srcmdl = self.workDir + '/' + str(self.src) + '.xml'
# If infile already contains an EXPOSURE column, we don't do anything
hdu = fits.open(infile)
if hdu[1].header.get('TTYPE5') == 'EXPOSURE':
return True
scfile = self.spacecraft
irfs = 'P8R2_SOURCE_V6'
rad = str(self.roi)
options = 'infile=' + infile + ' scfile=' + scfile + ' irfs=' + irfs + ' rad=' + rad
if self.fglName is not None:
target = self.fglName.replace('3FGLJ', '3FGL J')
logging.debug('exposure: target=%s', target)
options += ' srcmdl=' + srcmdl + ' target="' + target + '"'
else:
options += ' srcmdl="none" specin=' + str(gamma)
cmd = 'time -p ' + self.fermiDir + '/bin/gtexposure ' + options
logging.info('Running gtexposure')
os.system(cmd)
评论列表
文章目录