modfied according to comments
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
-#import astropy.units as u
from astropy.coordinates import SkyCoord, Angle
from astropy.nddata import Cutout2D
from astropy.nddata.utils import PartialOverlapError
@@ -158,7 +157,7 @@ def make_map_exposure_true_energy(pointing, livetime, aeff, ref_geom, offset_max
# We check if exposure is a 3D array in case there is a single bin in energy
# TODO: call np.atleast_3d ?
if len(exposure.shape) < 3:
- exposure = np.expand_dims(exposure, 0) * exposure.unit
+ exposure = np.expand_dims(exposure.value, 0) * exposure.unit
# Put exposure outside offset max to zero
# This might be more generaly dealt with a mask map
@@ -416,5 +415,5 @@ class MapMaker(object):
def _add_cutouts(self, cutout_slices, count_obs_map, expo_obs_map, acceptance_obs_map):
"""Add current cutout to global maps."""
self.count_map.data[cutout_slices] += count_obs_map.data
- self.exposure_map.data[cutout_slices] += (expo_obs_map.data * expo_obs_map.unit).to("m2 s").value
+ self.exposure_map.data[cutout_slices] += expo_obs_map.quantity.to(self.exposure_map.unit).value
self.background_map.data[cutout_slices] += acceptance_obs_map.data
