Commit d3f0bf6c authored by Martin Reinecke's avatar Martin Reinecke
Browse files

cleanup

parent 9b072104
Pipeline #24381 passed with stage
in 6 minutes and 8 seconds
...@@ -166,13 +166,13 @@ ...@@ -166,13 +166,13 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"def PropagatorOperator(R, N, Sh):\n", "def Curvature(R, N, Sh):\n",
" IC = ift.GradientNormController(iteration_limit=50000,\n", " IC = ift.GradientNormController(iteration_limit=50000,\n",
" tol_abs_gradnorm=0.1)\n", " tol_abs_gradnorm=0.1)\n",
" inverter = ift.ConjugateGradient(controller=IC)\n", " inverter = ift.ConjugateGradient(controller=IC)\n",
" D = (R.adjoint*N.inverse*R + Sh.inverse).inverse\n", " # WienerFilterCurvature is (R.adjoint*N.inverse*R + Sh.inverse) plus some handy\n",
" # MR FIXME: we can/should provide a preconditioner here as well!\n", " # helper methods.\n",
" return ift.InversionEnabler(D, inverter)\n" " return ift.library.WienerFilterCurvature(R,N,Sh,inverter)\n"
] ]
}, },
{ {
...@@ -245,7 +245,8 @@ ...@@ -245,7 +245,8 @@
" std=noise_amplitude, mean=0)\n", " std=noise_amplitude, mean=0)\n",
"d = noiseless_data + n\n", "d = noiseless_data + n\n",
"j = R.adjoint_times(N.inverse_times(d))\n", "j = R.adjoint_times(N.inverse_times(d))\n",
"D = PropagatorOperator(R=R, N=N, Sh=Sh)" "curv = Curvature(R=R, N=N, Sh=Sh)\n",
"D = curv.inverse"
] ]
}, },
{ {
...@@ -468,7 +469,8 @@ ...@@ -468,7 +469,8 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"D = PropagatorOperator(R=R, N=N, Sh=Sh)\n", "curv = Curvature(R=R, N=N, Sh=Sh)\n",
"D = curv.inverse\n",
"j = R.adjoint_times(N.inverse_times(d))\n", "j = R.adjoint_times(N.inverse_times(d))\n",
"m = D(j)" "m = D(j)"
] ]
...@@ -493,12 +495,6 @@ ...@@ -493,12 +495,6 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"sc = ift.probing.utils.StatCalculator()\n", "sc = ift.probing.utils.StatCalculator()\n",
"\n",
"IC = ift.GradientNormController(iteration_limit=50000,\n",
" tol_abs_gradnorm=0.1)\n",
"inverter = ift.ConjugateGradient(controller=IC)\n",
"curv = ift.library.wiener_filter_curvature.WienerFilterCurvature(R,N,Sh,inverter)\n",
"\n",
"for i in range(200):\n", "for i in range(200):\n",
" print i\n", " print i\n",
" sc.add(HT(curv.generate_posterior_sample()))\n", " sc.add(HT(curv.generate_posterior_sample()))\n",
...@@ -627,8 +623,6 @@ ...@@ -627,8 +623,6 @@
"# Operators\n", "# Operators\n",
"Sh = ift.create_power_operator(h_space, power_spectrum=pow_spec)\n", "Sh = ift.create_power_operator(h_space, power_spectrum=pow_spec)\n",
"N = ift.ScalingOperator(sigma2,s_space)\n", "N = ift.ScalingOperator(sigma2,s_space)\n",
"R = ift.FFTSmoothingOperator(s_space, sigma=.01)\n",
"#D = PropagatorOperator(R=R, N=N, Sh=Sh)\n",
"\n", "\n",
"# Fields and data\n", "# Fields and data\n",
"sh = ift.power_synthesize(ift.PS_field(p_space,pow_spec),real_signal=True)\n", "sh = ift.power_synthesize(ift.PS_field(p_space,pow_spec),real_signal=True)\n",
...@@ -645,7 +639,8 @@ ...@@ -645,7 +639,8 @@
"\n", "\n",
"R = ift.DiagonalOperator(mask)*HT\n", "R = ift.DiagonalOperator(mask)*HT\n",
"n.val[l:h, l:h] = 0\n", "n.val[l:h, l:h] = 0\n",
"D = PropagatorOperator(R=R, N=N, Sh=Sh)\n", "curv = Curvature(R=R, N=N, Sh=Sh)\n",
"D = curv.inverse\n",
"\n", "\n",
"d = R(sh) + n\n", "d = R(sh) + n\n",
"j = R.adjoint_times(N.inverse_times(d))\n", "j = R.adjoint_times(N.inverse_times(d))\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