Commit 9021e88f authored by Martin Reinecke's avatar Martin Reinecke

Distribution -> Distributor

parent 1314c2ac
Pipeline #25217 passed with stages
in 5 minutes and 54 seconds
......@@ -106,7 +106,7 @@ if __name__ == "__main__":
power0_energy = ift.library.NonlinearPowerEnergy(
position=t0, d=d, N=N, xi=m0, D=D0, ht=HT,
Instrument=MeasurementOperator, nonlinearity=nonlinearity,
Distribution=Distributor, sigma=1., samples=2, inverter=inverter)
Distributor=Distributor, sigma=1., samples=2, inverter=inverter)
power0_energy = minimizer(power0_energy)[0]
......
......@@ -100,7 +100,7 @@ if __name__ == "__main__":
power0_energy = ift.library.NonlinearPowerEnergy(
position=t0, d=d, N=N, xi=m0, D=D0, ht=HT,
Instrument=MeasurementOperator, nonlinearity=nonlinearity,
Distribution=Distributor, sigma=1., samples=2, inverter=inverter)
Distributor=Distributor, sigma=1., samples=2, inverter=inverter)
power0_energy = minimizer(power0_energy)[0]
......
......@@ -25,7 +25,7 @@ from ..minimization.energy import Energy
class NoiseEnergy(Energy):
def __init__(self, position, d, xi, D, t, ht, Instrument,
nonlinearity, alpha, q, Distribution, samples=3,
nonlinearity, alpha, q, Distributor, samples=3,
xi_sample_list=None, inverter=None):
super(NoiseEnergy, self).__init__(position=position)
self.xi = xi
......@@ -40,8 +40,8 @@ class NoiseEnergy(Energy):
self.alpha = alpha
self.q = q
self.Distribution = Distribution
self.power = self.Distribution(exp(0.5 * self.t))
self.Distributor = Distributor
self.power = self.Distributor(exp(0.5 * self.t))
if xi_sample_list is None:
if samples is None or samples == 0:
xi_sample_list = [xi]
......@@ -51,7 +51,7 @@ class NoiseEnergy(Energy):
self.xi_sample_list = xi_sample_list
self.inverter = inverter
A = Distribution(exp(.5*self.t))
A = Distributor(exp(.5*self.t))
self._gradient = None
for sample in self.xi_sample_list:
......@@ -81,7 +81,7 @@ class NoiseEnergy(Energy):
return self.__class__(
position, self.d, self.xi, self.D, self.t, self.ht,
self.Instrument, self.nonlinearity, self.alpha, self.q,
self.Distribution, xi_sample_list=self.xi_sample_list,
self.Distributor, xi_sample_list=self.xi_sample_list,
samples=self.samples, inverter=self.inverter)
@property
......
......@@ -20,12 +20,12 @@ from ..operators.inversion_enabler import InversionEnabler
from .response_operators import LinearizedPowerResponse
def NonlinearPowerCurvature(tau, ht, Instrument, nonlinearity, Distribution, N,
def NonlinearPowerCurvature(tau, ht, Instrument, nonlinearity, Distributor, N,
T, xi_sample_list, inverter):
result = None
for xi_sample in xi_sample_list:
LinearizedResponse = LinearizedPowerResponse(
Instrument, nonlinearity, ht, Distribution, tau, xi_sample)
Instrument, nonlinearity, ht, Distributor, tau, xi_sample)
op = LinearizedResponse.adjoint*N.inverse*LinearizedResponse
result = op if result is None else result + op
result = result*(1./len(xi_sample_list)) + T
......
......@@ -52,7 +52,7 @@ class NonlinearPowerEnergy(Energy):
"""
# MR FIXME: docstring incomplete and outdated
def __init__(self, position, d, N, xi, D, ht, Instrument, nonlinearity,
Distribution, sigma=0., samples=3, xi_sample_list=None,
Distributor, sigma=0., samples=3, xi_sample_list=None,
inverter=None):
super(NonlinearPowerEnergy, self).__init__(position)
self.xi = xi
......@@ -64,7 +64,7 @@ class NonlinearPowerEnergy(Energy):
self.ht = ht
self.Instrument = Instrument
self.nonlinearity = nonlinearity
self.Distribution = Distribution
self.Distributor = Distributor
self.sigma = sigma
if xi_sample_list is None:
if samples is None or samples == 0:
......@@ -75,7 +75,7 @@ class NonlinearPowerEnergy(Energy):
self.xi_sample_list = xi_sample_list
self.inverter = inverter
A = Distribution(exp(.5 * position))
A = Distributor(exp(.5 * position))
map_s = self.ht(A * xi)
Tpos = self.T(position)
......@@ -83,7 +83,7 @@ class NonlinearPowerEnergy(Energy):
for xi_sample in self.xi_sample_list:
map_s = self.ht(A * xi_sample)
LinR = LinearizedPowerResponse(
self.Instrument, self.nonlinearity, self.ht, self.Distribution,
self.Instrument, self.nonlinearity, self.ht, self.Distributor,
self.position, xi_sample)
residual = self.d - \
......@@ -107,7 +107,7 @@ class NonlinearPowerEnergy(Energy):
def at(self, position):
return self.__class__(position, self.d, self.N, self.xi, self.D,
self.ht, self.Instrument, self.nonlinearity,
self.Distribution, sigma=self.sigma,
self.Distributor, sigma=self.sigma,
samples=len(self.xi_sample_list),
xi_sample_list=self.xi_sample_list,
inverter=self.inverter)
......@@ -125,5 +125,5 @@ class NonlinearPowerEnergy(Energy):
def curvature(self):
return NonlinearPowerCurvature(
self.position, self.ht, self.Instrument, self.nonlinearity,
self.Distribution, self.N, self.T, self.xi_sample_list,
self.Distributor, self.N, self.T, self.xi_sample_list,
self.inverter)
......@@ -23,9 +23,9 @@ def LinearizedSignalResponse(Instrument, nonlinearity, ht, power, m):
return Instrument * nonlinearity.derivative(m) * ht * power
def LinearizedPowerResponse(Instrument, nonlinearity, ht, Distribution, tau,
def LinearizedPowerResponse(Instrument, nonlinearity, ht, Distributor, tau,
xi):
power = exp(0.5*tau)
position = ht(Distribution(power)*xi)
position = ht(Distributor(power)*xi)
linearization = nonlinearity.derivative(position)
return 0.5*Instrument*linearization*ht*xi*Distribution*power
return 0.5*Instrument*linearization*ht*xi*Distributor*power
......@@ -86,7 +86,7 @@ class Noise_Energy_Tests(unittest.TestCase):
energy0 = ift.library.NoiseEnergy(
position=eta0, d=d, xi=xi, D=D, t=tau, Instrument=R,
alpha=alpha, q=q, Distribution=Dist, nonlinearity=f,
alpha=alpha, q=q, Distributor=Dist, nonlinearity=f,
ht=ht, samples=10)
energy1 = energy0.at(eta1)
......
......@@ -82,7 +82,7 @@ class Energy_Tests(unittest.TestCase):
xi=xi,
D=D,
Instrument=R,
Distribution=Dist,
Distributor=Dist,
nonlinearity=f,
ht=ht,
N=N,
......
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