Commit b7934d79 authored by Martin Reinecke's avatar Martin Reinecke

more simplifications

parent 2396e6c9
Pipeline #23348 passed with stage
in 4 minutes and 34 seconds
......@@ -49,7 +49,8 @@ if __name__ == "__main__":
mask = ift.Field(s_space, val=ift.dobj.from_global_data(mask))
MaskOperator = ift.DiagonalOperator(mask)
InstrumentResponse = ift.ResponseOperator(s_space, sigma=[0.0])
InstrumentResponse = ift.ResponseOperator(s_space, sigma=[0.0],
exposure=[1.0])
MeasurementOperator = InstrumentResponse*MaskOperator
d_space = MeasurementOperator.target
......
from ..operators import EndomorphicOperator, InversionEnabler, DiagonalOperator
from ..operators import InversionEnabler, DiagonalOperator
class CriticalPowerCurvature(EndomorphicOperator):
"""The curvature of the CriticalPowerEnergy.
This operator implements the second derivative of the
CriticalPowerEnergy used in some minimization algorithms or
for error estimates of the power spectrum.
Parameters
----------
theta: Field,
The map and inverse gamma prior contribution to the curvature.
T : SmoothnessOperator,
The smoothness prior contribution to the curvature.
"""
def __init__(self, theta, T, inverter):
super(CriticalPowerCurvature, self).__init__()
theta = DiagonalOperator(theta)
self._op = InversionEnabler(T+theta, inverter, theta.inverse_times)
@property
def capability(self):
return self._op.capability
def apply(self, x, mode):
return self._op.apply(x, mode)
@property
def domain(self):
return self._op.domain
def CriticalPowerCurvature(theta, T, inverter):
theta = DiagonalOperator(theta)
return InversionEnabler(T+theta, inverter, theta.inverse_times)
from ..field import exp
from ..operators.linear_operator import LinearOperator
class LinearizedSignalResponse(LinearOperator):
def __init__(self, Instrument, nonlinearity, FFT, power, m):
super(LinearizedSignalResponse, self).__init__()
position = FFT.adjoint_times(power*m)
self._op = (Instrument * nonlinearity.derivative(position) *
FFT.adjoint * power)
def LinearizedSignalResponse(Instrument, nonlinearity, FFT, power, m):
position = FFT.adjoint_times(power*m)
return (Instrument * nonlinearity.derivative(position) *
FFT.adjoint * power)
@property
def domain(self):
return self._op.domain
@property
def target(self):
return self._op.target
@property
def capability(self):
return self._op.capability
def apply(self, x, mode):
return self._op.apply(x, mode)
class LinearizedPowerResponse(LinearOperator):
def __init__(self, Instrument, nonlinearity, FFT, Projection, t, m):
super(LinearizedPowerResponse, self).__init__()
power = exp(0.5*t)
position = FFT.adjoint_times(Projection.adjoint_times(power) * m)
linearization = nonlinearity.derivative(position)
self._op = (0.5 * Instrument * linearization * FFT.adjoint * m *
Projection.adjoint * power)
@property
def domain(self):
return self._op.domain
@property
def target(self):
return self._op.target
@property
def capability(self):
return self._op.capability
def apply(self, x, mode):
return self._op.apply(x, mode)
def LinearizedPowerResponse(Instrument, nonlinearity, FFT, Projection, t, m):
power = exp(0.5*t)
position = FFT.adjoint_times(Projection.adjoint_times(power) * m)
linearization = nonlinearity.derivative(position)
return (0.5 * Instrument * linearization * FFT.adjoint * m *
Projection.adjoint * power)
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