Move obs processing to separate method in MapMaker
@@ -74,6 +74,11 @@ class MapMaker(object):
selection = _check_selection(selection)
for obs in ProgressBar(obs_list):
+ self._process_obs(obs, selection)
+
+ return self.maps
+
+ def _process_obs(self, obs, selection):
# First make cutout of the global image
try:
# TODO: this is a hack. We should make cutout better.
@@ -86,7 +91,7 @@ class MapMaker(object):
except PartialOverlapError:
# TODO: can we silently do the right thing here? Discuss
log.warning("Observation {} not fully contained in target image. Skipping it.".format(obs.obs_id))
- continue
+ return
log.info('Processing observation {}'.format(obs.obs_id))
@@ -102,13 +107,12 @@ class MapMaker(object):
)
# Make maps for this observation
- map_maker_obs = MapMakerObs(
+ maps_obs = MapMakerObs(
obs=obs,
geom=cutout_map.geom,
fov_mask=fov_mask,
exclusion_mask=exclusion_mask,
- )
- maps_obs = map_maker_obs.run(selection)
+ ).run(selection)
# Stack observation maps to total
if 'counts' in selection:
@@ -127,8 +131,6 @@ class MapMaker(object):
self.maps['background'] = Map.from_geom(self.geom)
self.maps['background'].data[cutout_slices] += maps_obs['background'].data
- return self.maps
-
class MapMakerObs(object):
"""Make maps for a single IACT observation.
