Skip to content
Snippets Groups Projects
Commit 6d44c94b authored by Martin Reinecke's avatar Martin Reinecke
Browse files

allow sigma/strength of 0

parent a35319be
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -41,9 +41,8 @@ class NonlinearPowerEnergy(Energy):
self.D = D
self.d = d
self.N = N
self.sigma = sigma
self.T = SmoothnessOperator(domain=self.position.domain[0],
strength=self.sigma, logarithmic=True)
strength=sigma, logarithmic=True)
self.FFT = FFT
self.Instrument = Instrument
self.nonlinearity = nonlinearity
......@@ -63,7 +62,7 @@ class NonlinearPowerEnergy(Energy):
def at(self, position):
return self.__class__(position, self.d, self.N, self.m, self.D,
self.FFT, self.Instrument, self.nonlinearity,
self.Projection, sigma=self.sigma,
self.Projection, sigma=self.T.strength,
samples=len(self.sample_list),
sample_list=self.sample_list,
inverter=self.inverter)
......
......@@ -30,8 +30,8 @@ class SmoothnessOperator(EndomorphicOperator):
self._laplace = LaplaceOperator(domain, logarithmic=logarithmic,
space=space)
if strength <= 0:
raise ValueError("ERROR: invalid sigma.")
if strength < 0:
raise ValueError("ERROR: strength must be >=0.")
self._strength = strength
@property
......@@ -47,6 +47,8 @@ class SmoothnessOperator(EndomorphicOperator):
return False
def _times(self, x):
if self._strength == 0.:
return x.zeros_like(x)
result = self._laplace.adjoint_times(self._laplace(x))
result *= self._strength**2
return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment