Commit 42068f64 authored by Philipp Arras's avatar Philipp Arras

Add OffsetOperator

parent 668ac34b
......@@ -19,7 +19,6 @@ from .field import Field
from .multi_field import MultiField
from .operators.operator import Operator
from .operators.constant_operator import ConstantOperator
from .operators.central_zero_padder import CentralZeroPadder
from .operators.diagonal_operator import DiagonalOperator
from .operators.distributors import DOFDistributor, PowerDistributor
......@@ -35,6 +34,7 @@ from .operators.inversion_enabler import InversionEnabler
from .operators.laplace_operator import LaplaceOperator
from .operators.linear_operator import LinearOperator
from .operators.mask_operator import MaskOperator
from .operators.offset_operator import OffsetOperator
from .operators.qht_operator import QHTOperator
from .operators.regridding_operator import RegriddingOperator
from .operators.sampling_enabler import SamplingEnabler
......@@ -23,8 +23,7 @@ import numpy as np
from ..compat import *
from import PowerSpace
from ..field import Field
from ..operators.constant_operator import ConstantOperator
from ..operators.operator import Operator
from ..operators.offset_operator import OffsetOperator
from ..sugar import makeOp, sqrt
......@@ -111,7 +110,7 @@ def SlopeModel(logk_space, sm, sv, im, iv):
slope = SlopeOperator(logk_space)
phi_mean = Field.from_global_data(slope.domain, phi_mean)
phi_sig = Field.from_global_data(slope.domain, phi_sig)
return slope*ConstantOperator(phi_sig) + ConstantOperator(phi_mean)
return slope(OffsetOperator(phi_mean)(makeOp(phi_sig)))
def AmplitudeModel(s_space,
......@@ -19,16 +19,14 @@
from __future__ import absolute_import, division, print_function
from ..compat import *
from ..multi_domain import MultiDomain
from .operator import Operator
class ConstantOperator(Operator):
class OffsetOperator(Operator):
def __init__(self, field):
self._field = field
self._domain = MultiDomain.make({})
self._target = field.domain
self._domain = self._target = field.domain
def apply(self, x):
return self._field
return x + self._field
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