Commit d6341dcb authored by Theo Steininger's avatar Theo Steininger

Fixes in the import structure.

parent d3fe4057
Pipeline #14551 passed with stage
in 6 minutes and 44 seconds
from nifty.operators import EndomorphicOperator,\ from nifty.operators.endomorphic_operator import EndomorphicOperator
InvertibleOperatorMixin,\ from nifty.operators.invertible_operator_mixin import InvertibleOperatorMixin
DiagonalOperator from nifty.operators.diagonal_operator import DiagonalOperator
class CriticalPowerCurvature(InvertibleOperatorMixin, EndomorphicOperator): class CriticalPowerCurvature(InvertibleOperatorMixin, EndomorphicOperator):
...@@ -18,6 +18,9 @@ class CriticalPowerCurvature(InvertibleOperatorMixin, EndomorphicOperator): ...@@ -18,6 +18,9 @@ class CriticalPowerCurvature(InvertibleOperatorMixin, EndomorphicOperator):
T : SmoothnessOperator, T : SmoothnessOperator,
The smoothness prior contribution to the curvature. The smoothness prior contribution to the curvature.
""" """
# ---Overwritten properties and methods---
def __init__(self, theta, T, inverter=None, preconditioner=None): def __init__(self, theta, T, inverter=None, preconditioner=None):
self.theta = DiagonalOperator(theta.domain, diagonal=theta) self.theta = DiagonalOperator(theta.domain, diagonal=theta)
...@@ -25,8 +28,15 @@ class CriticalPowerCurvature(InvertibleOperatorMixin, EndomorphicOperator): ...@@ -25,8 +28,15 @@ class CriticalPowerCurvature(InvertibleOperatorMixin, EndomorphicOperator):
if preconditioner is None: if preconditioner is None:
preconditioner = self.theta.inverse_times preconditioner = self.theta.inverse_times
self._domain = self.theta.domain self._domain = self.theta.domain
super(CriticalPowerCurvature, self).__init__(inverter=inverter, super(CriticalPowerCurvature, self).__init__(
inverter=inverter,
preconditioner=preconditioner) preconditioner=preconditioner)
def _times(self, x, spaces):
return self.T(x) + self.theta(x)
# ---Mandatory properties and methods---
@property @property
def domain(self): def domain(self):
return self._domain return self._domain
...@@ -38,8 +48,3 @@ class CriticalPowerCurvature(InvertibleOperatorMixin, EndomorphicOperator): ...@@ -38,8 +48,3 @@ class CriticalPowerCurvature(InvertibleOperatorMixin, EndomorphicOperator):
@property @property
def unitary(self): def unitary(self):
return False return False
# ---Added properties and methods---
def _times(self, x, spaces):
return self.T(x) + self.theta(x)
from nifty.energies.energy import Energy from nifty.energies.energy import Energy
from nifty.library.operator_library import CriticalPowerCurvature,\ from nifty.operators.smoothness_operator import SmoothnessOperator
SmoothnessOperator from nifty.library.critical_filter import CriticalPowerCurvature
from nifty.sugar import generate_posterior_sample from nifty.sugar import generate_posterior_sample
from nifty import Field, exp from nifty import Field, exp
......
from nifty.energies.energy import Energy from nifty.energies.energy import Energy
from nifty.energies.memoization import memo from nifty.energies.memoization import memo
from nifty.library.operator_library import WienerFilterCurvature from nifty.library.wiener_filter import WienerFilterCurvature
class WienerFilterEnergy(Energy): class WienerFilterEnergy(Energy):
......
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