Fix MapDataset.info_dict() for missing background
@@ -1357,11 +1357,12 @@ class MapDataset(Dataset):
counts = 0
background, excess, sqrt_ts = np.nan, np.nan, np.nan
+
if self.counts:
- summed_stat = self._counts_statistic[mask].sum()
- counts = summed_stat.n_on
+ counts = self.counts.data[mask].sum()
if self.background:
+ summed_stat = self._counts_statistic[mask].sum()
background = summed_stat.n_bkg
excess = summed_stat.n_sig
sqrt_ts = summed_stat.sqrt_ts
