You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug description
The mask_safe is applied in the MapDataset and SpectrumDataset by multiplying the different maps (counts, background, etc.) with the mask_safe. This method fails when, for instance, there are nan values present in the background model map (which might occur when the background model is interpolated onto the used geometry). This is because nan * False = nan, which results in the corresponding pixels not being properly masked.
Expected behavior
All pixels outside the mask_safe should be properly masked. This could be achieved by using a scheme like dataset.background_model.map[~dataset.mask_safe.data] = 0 instead of the multiplication.
The text was updated successfully, but these errors were encountered:
@lmohrmann I checked once again what the status here is and to apply the mask we consistently use Map.stack( weights=). The weights argument however is meant to be more generic and not strictly for boolean types. So I think we cannot apply the proposed solution and have to fix replace NaN values beforehand instead. A method for this has been added in #3219
PR #3416 adds a method "bkg-clip" to the SafeMaskMaker in order create a mask from aberrant values in the background map (not finite and eventually very large values). It also offers the possibility to clip the aberrant values to zero in the background map. This should solve the issue.
Gammapy version
0.17
Bug description
The
mask_safe
is applied in theMapDataset
andSpectrumDataset
by multiplying the different maps (counts, background, etc.) with themask_safe
. This method fails when, for instance, there arenan
values present in the background model map (which might occur when the background model is interpolated onto the used geometry). This is becausenan * False = nan
, which results in the corresponding pixels not being properly masked.Expected behavior
All pixels outside the
mask_safe
should be properly masked. This could be achieved by using a scheme likedataset.background_model.map[~dataset.mask_safe.data] = 0
instead of the multiplication.The text was updated successfully, but these errors were encountered: