Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add make_images method in MapMaker #1681

merged 7 commits into from Aug 12, 2018

add the method to MapMaker

  • Loading branch information...
registerrier committed Aug 8, 2018
commit 2c0931fd308e842a91d3da5898b332eeb4f97b8c
Copy path View file
@@ -116,6 +116,24 @@ def _process_obs(self, obs, selection):
data = maps_obs[name][name].unit).value
self.maps[name].fill_by_coord(coords, data)

def make_images(self, spectrum):
"""Create 2D maps by summing over energy axis.
images : dict of `~gammapy.maps.Map`
the dictionary of images
images = dict()
for name, map in self.maps.items():
if name == 'exposure':
weights =
res = Map.from_geom(map.geom.to_image())
for img, idx in map.iter_by_image(): += img*
images[name] = map.sum_over_axes()

This comment has been minimized.

Copy link

cdeil Aug 8, 2018


Move this line into an else block?

I think otherwise, you're overwriting the exposure image with just the sum image like for counts and background?

return images

class MapMakerObs(object):
"""Make maps for a single IACT observation.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.