Scheduled maintenance on Monday 2019-06-24 between 10:00-11:00 CEST

Commit 157402e6 authored by Martin Reinecke's avatar Martin Reinecke

Merge branch 'fixing_nan' into 'NIFTy_5'

Fixing NaNs in PoissonEnergy

See merge request !321
parents fb34b7ce dafe2922
Pipeline #47817 passed with stages
in 18 minutes and 49 seconds
......@@ -191,7 +191,12 @@ class PoissonianEnergy(EnergyOperator):
def apply(self, x):
self._check_input(x)
res = x.sum() - x.log().vdot(self._d)
res = x.sum()
tmp = res.val.local_data if isinstance(res, Linearization) else res
# if we have no infinity here, we can continue with the calculation;
# otherwise we know that the result must also be infinity
if not np.isinf(tmp):
res = res - x.log().vdot(self._d)
if not isinstance(x, Linearization):
return Field.scalar(res)
if not x.want_metric:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment