Skip to content

Commit

Permalink
Added phasecut parameters and expscape>0 check
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuehler committed Sep 29, 2016
1 parent 7f8c3cf commit 7cb86c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions fermipy/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def make_default_dict(d):
'evclass': (None, 'Event class selection.', int),
'evtype': (None, 'Event type selection.', int),
'convtype': (None, 'Conversion type selection.', int),
'phasemin': (None, 'Minimum pulsar phase', float),
'phasemax': (None, 'Maximum pulsar phase', float),
'target': (None, 'Choose an object on which to center the ROI. '
'This option takes precendence over ra/dec or glon/glat.', str),
'ra': (None, '', float),
Expand Down
6 changes: 5 additions & 1 deletion fermipy/gtanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -4822,6 +4822,8 @@ def _select_data(self, overwrite=False):
dec=self.roi.skydir.dec.deg,
rad=self.config['selection']['radius'],
convtype=self.config['selection']['convtype'],
phasemin=self.config['selection']['phasemin'],
phasemax=self.config['selection']['phasemax'],
evtype=self.config['selection']['evtype'],
evclass=self.config['selection']['evclass'],
tmin=self.config['selection']['tmin'],
Expand Down Expand Up @@ -4909,11 +4911,13 @@ def _scale_srcmap(self, scale_map):
continue

scale = scale_map[hdu.name]
if scale<1e-20:
self.logger.warning("The expscale parameter was zero, setting it to 1e-8")
scale = 1e-8
if 'SRCMAP_SCALE' in hdu.header:
old_scale = hdu.header['SRCMAP_SCALE']
else:
old_scale = 1.0

hdu.data *= scale/old_scale
hdu.header['SRCMAP_SCALE'] = scale

Expand Down

0 comments on commit 7cb86c9

Please sign in to comment.