Skip to content

Commit

Permalink
Merge pull request #1362 from cdeil/squeeze
Browse files Browse the repository at this point in the history
Change np.squeeze calls to pass a tuple of int
  • Loading branch information
cdeil committed Apr 10, 2018
2 parents 3f1441a + b86124c commit e5acaf5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions gammapy/maps/hpxnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,8 @@ def sum_over_axes(self):
vals = self.get_by_idx(self.geom.get_idx(flat=True))
map_out.fill_by_coord(self.geom.get_coord(flat=True)[:2], vals)
else:
axes = np.arange(self.data.ndim - 1).tolist()
data = np.apply_over_axes(np.sum, self.data, axes=axes)
map_out.data = np.squeeze(data, axis=axes)
axis = tuple(range(self.data.ndim - 1))
map_out.data = np.sum(self.data, axis=axis)

return map_out

Expand Down
2 changes: 1 addition & 1 deletion gammapy/maps/wcsnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def sum_over_axes(self):
vals = self.get_by_idx(self.geom.get_idx())
map_out.fill_by_coord(self.geom.get_coord()[:2], vals)
else:
axis = tuple(np.arange(self.data.ndim - 2).tolist())
axis = tuple(range(self.data.ndim - 2))
map_out.data = np.sum(self.data, axis=axis)

return map_out
Expand Down

0 comments on commit e5acaf5

Please sign in to comment.