Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions fermipy/psmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,28 @@ def psmap(self, prefix='', **kwargs):

mydatcounts = o['datcounts']

ps_map = WcsNDMap(map_geom, o['psmap'])
ps_map = WcsNDMap(map_geom, o['psmap'])
pssigma_map = WcsNDMap(map_geom, o['psmapsigma'])

o['name'] = 'PSmap'
o['ps_map']= ps_map
o['pssigma_map']=pssigma_map
o['config']=kwargs
o['name'] = utils.join_strings([prefix, 'PSmap'])
o['ps_map'] = ps_map
o['pssigma_map'] = pssigma_map
o['config'] = kwargs

outfile = config.get('outfile', None)
if outfile != '':
o['name'] = os.path.splitext(outfile)[0]
outfile = config.get('outfile', '')
if outfile == '':
outfile = utils.format_filename(self.workdir, 'PSmap',
prefix=[prefix])
else:
outfile = os.path.join(self.workdir,
os.path.splitext(outfile)[0])

o['file'] = None
if config['write_fits']:
if outfile=='':
outfile = utils.format_filename(self.workdir, 'PSmap')
else:
outfile = os.path.join(self.workdir,
os.path.splitext(outfile)[0])
o['file'] = os.path.basename(outfile) + '.fits'
gtpsmap.make_psmap_fits(o,outfile + '.fits')
self.logger.log(config['loglevel'], 'Writing output file %s.',outfile + '.fits')
self.logger.log(config['loglevel'], 'Writing output file %s.',
outfile + '.fits')

if config['make_plots']:

Expand Down
5 changes: 3 additions & 2 deletions fermipy/tests/test_gtanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,15 @@ def test_gtanalysis_tsmap(create_diffuse_dir, create_draco_analysis):
gta.load_roi('fit1')
gta.tsmap(model={}, make_plots=True)


def test_gtanalysis_psmap(create_diffuse_dir, create_draco_analysis):
gta = create_draco_analysis
gta.load_roi('fit1')
gta.write_model_map(model_name="model01")
mycmap = os.path.join(gta.workdir, 'ccube_00.fits')
mymmap = os.path.join(gta.workdir, 'mcube_model01_00.fits')
print('cmap and mmap %s %s' %(mycmap,mymmap))
gta.psmap(cmap=mycmap,mmap=mymmap,make_plots=True,emin=1000,emax=10000,nbinloge=4,outfile='testpsmap',chatter=3)
print('cmap and mmap %s %s' %(mycmap, mymmap))
gta.psmap(cmap=mycmap, mmap=mymmap, make_plots=True, emin=1000, emax=10000, nbinloge=4, outfile='test_psmap', chatter=3, prefix='test_img')


#@requires_git_version('99-00-01')
Expand Down
Loading