diff --git a/src/graphnet/models/detector/icecube.py b/src/graphnet/models/detector/icecube.py index 877a0bf65..57870421e 100644 --- a/src/graphnet/models/detector/icecube.py +++ b/src/graphnet/models/detector/icecube.py @@ -39,7 +39,8 @@ def _dom_time(self, x: torch.tensor) -> torch.tensor: return (x - 1.0e04) / 3.0e4 def _charge(self, x: torch.tensor) -> torch.tensor: - return torch.log10(x) + # catch negative charges arising from input perturbation/noise + return torch.log10(1 + torch.clamp(x, min=0.0)) def _rde(self, x: torch.tensor) -> torch.tensor: return (x - 1.25) / 0.25 diff --git a/src/graphnet/models/detector/nubench.py b/src/graphnet/models/detector/nubench.py index 64844a230..18253aced 100644 --- a/src/graphnet/models/detector/nubench.py +++ b/src/graphnet/models/detector/nubench.py @@ -38,7 +38,8 @@ def _t(self, x: torch.tensor) -> torch.tensor: return x / 10e5 def _charge(self, x: torch.tensor) -> torch.tensor: - return torch.log10(1 + x) + # catch negative charges arising from input perturbation/noise + return torch.log10(1 + torch.clamp(x, min=0.0)) class FlowerS(NuBenchDetector):