uniform call to the integrate method in map_maker
@@ -194,28 +194,16 @@ def make_map_hadron_acceptance(pointing, livetime, bkg, ref_geom, offset_max):
# TODO: properly transform FOV to sky coordinates
# For now we assume the background is radially symmetric
- # TODO: add a uniform API to the two background classes
energy_axis = ref_geom.axes[0]
# Compute offsets of all pixels
map_coord = ref_geom.get_coord()
- # Compute offset at all the pixels and energy of the Map
- offset = map_coord.skycoord.separation(pointing)
-
- if isinstance(bkg, Background3D):
- map_coord = ref_geom.get_coord()
- fov_lon = offset
- # TODO: go from SkyCoord to FOV coordinates. Here assume symmetric geometry for fov_lon, fov_lat
- fov_lat = Angle(np.zeros_like(fov_lon), fov_lon.unit)
# Retrieve energies from map coordinates
energy_reco = map_coord[energy_axis.name] * energy_axis.unit
- # Here fov_lon, fov_lat, and e_reco have the same shape and contain all the coordinates of the point on which you want
- # to evaluate the background
+ # TODO: go from SkyCoord to FOV coordinates. Here assume symmetric geometry for fov_lon, fov_lat
+ # Compute offset at all the pixels and energy of the Map
+ fov_lon = map_coord.skycoord.separation(pointing)
+ fov_lat = Angle(np.zeros_like(fov_lon), fov_lon.unit)
data = bkg.evaluate(fov_lon=fov_lon, fov_lat=fov_lat, energy_reco=energy_reco)
- else:
- # Retrieve energies from WcsNDMap
- # Note this would require a log_center from the geometry
- energy = energy_axis.center * energy_axis.unit
- data = bkg.evaluate(fov_lon=offset[0, :, :], fov_lat=0, energy=energy)
# TODO: add proper integral over energy
energy_axis = ref_geom.axes[0]
@@ -225,6 +213,7 @@ def make_map_hadron_acceptance(pointing, livetime, bkg, ref_geom, offset_max):
# Put exposure outside offset max to zero
# This might be more generaly dealt with a mask map
+ offset = np.sqrt(fov_lon ** 2 + fov_lat ** 2)
data[:, offset[0, :, :] >= offset_max] = 0
return WcsNDMap(ref_geom, data=data)
