Commit 75c8e777 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

small simplifications

parent 741d11a6
Pipeline #24178 failed with stage
in 4 minutes and 7 seconds
......@@ -36,13 +36,13 @@ if __name__ == "__main__":
mask[N10*5:N10*9, N10*5:N10*9] = 0.
mask = ift.Field(signal_space, ift.dobj.from_global_data(mask))
R = ift.ResponseOperator(signal_space, sigma=(response_sigma,),
exposure=(mask,))
sensitivity=(mask,))
data_domain = R.target[0]
R_harmonic = R * fft
# Setting up the noise covariance and drawing a random noise realization
ndiag = ift.Field.full(data_domain, mock_signal.var()/signal_to_noise)
N = ift.DiagonalOperator(ndiag.weight(1))
ndiag = 1e-8*ift.Field.full(data_domain, mock_signal.var()/signal_to_noise)
N = ift.DiagonalOperator(ndiag)
noise = ift.Field.from_random(
domain=data_domain, random_type='normal',
std=mock_signal.std()/np.sqrt(signal_to_noise), mean=0)
......
......@@ -47,11 +47,9 @@ class Energy_Tests(unittest.TestCase):
A = P.adjoint_times(ift.sqrt(pspec))
n = ift.Field.from_random(domain=space, random_type='normal')
s0 = xi0 * A
diag = ift.Field.ones(space) * 10
Instrument = ift.DiagonalOperator(diag)
Instrument = ift.ScalingOperator(10., space)
R = Instrument * ht
diag = ift.Field.ones(space)
N = ift.DiagonalOperator(diag)
N = ift.ScalingOperator(1., space)
d = R(s0) + n
direction = ift.Field.from_random('normal', hspace)
......@@ -60,8 +58,6 @@ class Energy_Tests(unittest.TestCase):
s1 = s0 + eps * direction
IC = ift.GradientNormController(
name='IC',
verbose=False,
iteration_limit=100,
tol_abs_gradnorm=1e-5)
inverter = ift.ConjugateGradient(IC)
......@@ -96,11 +92,9 @@ class Energy_Tests(unittest.TestCase):
n = ift.Field.from_random(domain=space, random_type='normal')
sh0 = xi0 * A
s = ht(sh0)
diag = ift.Field.ones(space) * 10
Instrument = ift.DiagonalOperator(diag)
Instrument = ift.ScalingOperator(10., space)
R = Instrument * ht
diag = ift.Field.ones(space)
N = ift.DiagonalOperator(diag)
N = ift.ScalingOperator(1., space)
d = Instrument(ift.exp(s)) + n
direction = ift.Field.from_random('normal', hspace)
......@@ -109,8 +103,6 @@ class Energy_Tests(unittest.TestCase):
sh1 = sh0 + eps * direction
IC = ift.GradientNormController(
name='IC',
verbose=False,
iteration_limit=100,
tol_abs_gradnorm=1e-5)
inverter = ift.ConjugateGradient(IC)
......@@ -146,10 +138,8 @@ class Energy_Tests(unittest.TestCase):
A = P.adjoint_times(ift.sqrt(pspec))
n = ift.Field.from_random(domain=space, random_type='normal')
s = ht(xi0 * A)
diag = ift.Field.ones(space) * 10
R = ift.DiagonalOperator(diag)
diag = ift.Field.ones(space)
N = ift.DiagonalOperator(diag)
R = ift.ScalingOperator(10., space)
N = ift.ScalingOperator(1., space)
d = R(f(s)) + n
direction = ift.Field.from_random('normal', hspace)
......@@ -188,11 +178,9 @@ class Curvature_Tests(unittest.TestCase):
A = P.adjoint_times(ift.sqrt(pspec))
n = ift.Field.from_random(domain=space, random_type='normal')
s0 = xi0 * A
diag = ift.Field.ones(space) * 10
Instrument = ift.DiagonalOperator(diag)
Instrument = ift.ScalingOperator(10., space)
R = Instrument * ht
diag = ift.Field.ones(space)
N = ift.DiagonalOperator(diag)
N = ift.ScalingOperator(1., space)
d = R(s0) + n
direction = ift.Field.from_random('normal', hspace)
......@@ -201,8 +189,6 @@ class Curvature_Tests(unittest.TestCase):
s1 = s0 + eps * direction
IC = ift.GradientNormController(
name='IC',
verbose=False,
iteration_limit=100,
tol_abs_gradnorm=1e-5)
inverter = ift.ConjugateGradient(IC)
......@@ -236,11 +222,9 @@ class Curvature_Tests(unittest.TestCase):
n = ift.Field.from_random(domain=space, random_type='normal')
sh0 = xi0 * A
s = ht(sh0)
diag = ift.Field.ones(space) * 10
Instrument = ift.DiagonalOperator(diag)
Instrument = ift.ScalingOperator(10., space)
R = Instrument * ht
diag = ift.Field.ones(space)
N = ift.DiagonalOperator(diag)
N = ift.ScalingOperator(1., space)
d = Instrument(ift.exp(s)) + n
direction = ift.Field.from_random('normal', hspace)
......@@ -249,8 +233,6 @@ class Curvature_Tests(unittest.TestCase):
sh1 = sh0 + eps * direction
IC = ift.GradientNormController(
name='IC',
verbose=False,
iteration_limit=100,
tol_abs_gradnorm=1e-5)
inverter = ift.ConjugateGradient(IC)
......@@ -287,10 +269,8 @@ class Curvature_Tests(unittest.TestCase):
A = P.adjoint_times(ift.sqrt(pspec))
n = ift.Field.from_random(domain=space, random_type='normal')
s = ht(xi0 * A)
diag = ift.Field.ones(space) * 10
R = ift.DiagonalOperator(diag)
diag = ift.Field.ones(space)
N = ift.DiagonalOperator(diag)
R = ift.ScalingOperator(10., space)
N = ift.ScalingOperator(1., space)
d = R(f(s)) + n
direction = ift.Field.from_random('normal', hspace)
......@@ -301,8 +281,6 @@ class Curvature_Tests(unittest.TestCase):
S = ift.create_power_operator(hspace, power_spectrum=lambda k: 1.)
IC = ift.GradientNormController(
name='IC',
verbose=False,
iteration_limit=500,
tol_abs_gradnorm=1e-7)
inverter = ift.ConjugateGradient(IC)
......
......@@ -52,9 +52,7 @@ class Noise_Energy_Tests(unittest.TestCase):
N = ift.DiagonalOperator(var)
eta0 = ift.log(var)
s = ht(xi * A)
diag = ift.Field.ones(space) * 10
R = ift.DiagonalOperator(diag)
diag = ift.Field.ones(space)
R = ift.ScalingOperator(10., space)
d = R(f(s)) + n
alpha = ift.Field(d.domain, val=2.)
......@@ -66,8 +64,6 @@ class Noise_Energy_Tests(unittest.TestCase):
eta1 = eta0 + eps * direction
IC = ift.GradientNormController(
name='IC',
verbose=False,
iteration_limit=100,
tol_abs_gradnorm=1e-5)
inverter = ift.ConjugateGradient(IC)
......
......@@ -41,7 +41,7 @@ class Energy_Tests(unittest.TestCase):
P = ift.PowerProjectionOperator(domain=hspace, power_space=pspace)
xi = ift.Field.from_random(domain=hspace, random_type='normal')
# TODO Power spectrum abhängig von Anzahl der Pixel
# TODO Power spectrum should depend on number of pixels
def pspec(k): return 64 / (1 + k**2)**dim
pspec = ift.PS_field(pspace, pspec)
tau0 = ift.log(pspec)
......@@ -49,8 +49,7 @@ class Energy_Tests(unittest.TestCase):
n = ift.Field.from_random(domain=space, random_type='normal', std=.01)
N = ift.DiagonalOperator(n**2)
s = xi * A
diag = ift.Field.ones(space)
Instrument = ift.DiagonalOperator(diag)
Instrument = ift.ScalingOperator(1., space)
R = Instrument * ht
d = R(s) + n
......@@ -60,8 +59,6 @@ class Energy_Tests(unittest.TestCase):
tau1 = tau0 + eps * direction
IC = ift.GradientNormController(
name='IC',
verbose=False,
iteration_limit=100,
tol_abs_gradnorm=1e-5)
inverter = ift.ConjugateGradient(IC)
......@@ -108,8 +105,7 @@ class Energy_Tests(unittest.TestCase):
A = P.adjoint_times(ift.sqrt(tau0))
n = ift.Field.from_random(domain=space, random_type='normal')
s = ht(xi * A)
diag = ift.Field.ones(space) * 10
R = ift.DiagonalOperator(diag)
R = ift.ScalingOperator(10., space)
diag = ift.Field.ones(space)
N = ift.DiagonalOperator(diag)
d = R(f(s)) + n
......@@ -120,8 +116,6 @@ class Energy_Tests(unittest.TestCase):
tau1 = tau0 + eps * direction
IC = ift.GradientNormController(
name='IC',
verbose=False,
iteration_limit=100,
tol_abs_gradnorm=1e-5)
inverter = ift.ConjugateGradient(IC)
......@@ -183,7 +177,7 @@ class Curvature_Tests(unittest.TestCase):
P = ift.PowerProjectionOperator(domain=hspace, power_space=pspace)
xi = ift.Field.from_random(domain=hspace, random_type='normal')
# TODO Power spectrum abhängig von Anzahl der Pixel
# TODO Power spectrum should depend on number of pixels
def pspec(k): return 64 / (1 + k**2)**dim
pspec = ift.PS_field(pspace, pspec)
tau0 = ift.log(pspec)
......@@ -202,8 +196,6 @@ class Curvature_Tests(unittest.TestCase):
tau1 = tau0 + eps * direction
IC = ift.GradientNormController(
name='IC',
verbose=False,
iteration_limit=100,
tol_abs_gradnorm=1e-5)
inverter = ift.ConjugateGradient(IC)
......@@ -263,8 +255,6 @@ class Curvature_Tests(unittest.TestCase):
tau1 = tau0 + eps * direction
IC = ift.GradientNormController(
name='IC',
verbose=False,
iteration_limit=100,
tol_abs_gradnorm=1e-5)
inverter = ift.ConjugateGradient(IC)
......
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