Commit 5b696445 authored by Martin Reinecke's avatar Martin Reinecke

cosmetics and fix in SamplingEnabler

parent 912892f2
Pipeline #31472 failed with stages
in 4 minutes and 50 seconds
......@@ -24,7 +24,8 @@ from ..sugar import makeOp
class NonlinearWienerFilterEnergy(Energy):
def __init__(self, position, d, Instrument, nonlinearity, ht, power, N, S,
iteration_controller=None, iteration_controller_sampling=None):
iteration_controller=None,
iteration_controller_sampling=None):
super(NonlinearWienerFilterEnergy, self).__init__(position=position)
self.d = d.lock()
self.Instrument = Instrument
......
......@@ -180,13 +180,14 @@ class MultiField(object):
if not isinstance(other, MultiField):
return False
for key, val in self._domain.items():
if not key in other._domain or other._domain[key] != val:
if key not in other._domain or other._domain[key] != val:
return False
for key, val in self._val.items():
if not val.isSubsetOf(other[key]):
return False
return True
for op in ["__add__", "__radd__", "__iadd__",
"__sub__", "__rsub__", "__isub__",
"__mul__", "__rmul__", "__imul__",
......
......@@ -66,8 +66,11 @@ class SamplingEnabler(EndomorphicOperator):
energy = QuadraticEnergy(s, self._op, sp + nj,
_grad=self._likelihood(s) - nj)
inverter = ConjugateGradient(self._ic)
energy, convergence = inverter(energy,
preconditioner=self._approximation.inverse)
if self._approximation is not None:
energy, convergence = inverter(
energy, preconditioner=self._approximation.inverse)
else:
energy, convergence = inverter(energy)
return energy.position
@property
......
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