Commit 5355dad3 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

make more compact

parent c79ba39c
......@@ -172,7 +172,7 @@
" inverter = ift.ConjugateGradient(controller=IC)\n",
" # WienerFilterCurvature is (R.adjoint*N.inverse*R + Sh.inverse) plus some handy\n",
" # helper methods.\n",
" return ift.library.WienerFilterCurvature(R,N,Sh,inverter)\n"
" return ift.library.WienerFilterCurvature(R,N,Sh,inverter)"
]
},
{
......@@ -296,14 +296,14 @@
"source": [
"s_power = ift.power_analyze(sh)\n",
"m_power = ift.power_analyze(m)\n",
"s_power_data = s_power.val.real\n",
"m_power_data = m_power.val.real\n",
"s_power_data = s_power.val\n",
"m_power_data = m_power.val\n",
"\n",
"# Get signal data and reconstruction data\n",
"s_data = HT(sh).val.real\n",
"m_data = HT(m).val.real\n",
"s_data = HT(sh).val\n",
"m_data = HT(m).val\n",
"\n",
"d_data = d.val.real"
"d_data = d.val"
]
},
{
......@@ -494,7 +494,7 @@
},
"outputs": [],
"source": [
"m_mean, m_var = ift.probe_with_posterior_samples(curv, m, HT, 200)\n"
"m_mean, m_var = ift.probe_with_posterior_samples(curv, m, HT, 200)"
]
},
{
......@@ -518,40 +518,17 @@
},
"outputs": [],
"source": [
"s_power = ift.power_analyze(sh)\n",
"m_power = ift.power_analyze(m)\n",
"s_power_data = s_power.val.real\n",
"m_power_data = m_power.val.real\n",
"\n",
"# Get signal data and reconstruction data\n",
"s_data = s.val.real\n",
"m_data = HT(m).val.real\n",
"m_var_data = m_var.val.real\n",
"uncertainty = np.sqrt(np.abs(m_var_data))\n",
"d_data = d.val.real\n",
"s_data = s.val\n",
"m_data = HT(m).val\n",
"m_var_data = m_var.val\n",
"uncertainty = np.sqrt(m_var_data)\n",
"d_data = d.val\n",
"\n",
"# Set lost data to NaN for proper plotting\n",
"d_data[d_data == 0] = np.nan"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"slideshow": {
"slide_type": "skip"
}
},
"outputs": [],
"source": [
"plt.figure(figsize=(15,10))\n",
"plt.plot(s_data, 'r', label=\"Signal\", linewidth=3)\n",
"plt.plot(d_data, 'k.', label=\"Data\")\n",
"plt.axvspan(l, h, facecolor='0.8', alpha=.5)\n",
"plt.title(\"Incomplete Data\")\n",
"plt.legend()"
]
},
{
"cell_type": "code",
"execution_count": null,
......@@ -590,13 +567,11 @@
"outputs": [],
"source": [
"N_pixels = 256 # Number of pixels\n",
"sigma2 = 2. # Noise variance\n",
"\n",
"sigma2 = 2. # Noise variance\n",
"\n",
"def pow_spec(k):\n",
" P0, k0, gamma = [.2, 2, 4]\n",
" return P0 * (1. + (k/k0)**2)**(- gamma / 2)\n",
"\n",
" return P0 * (1. + (k/k0)**2)**(-gamma/2)\n",
"\n",
"s_space = ift.RGSpace([N_pixels, N_pixels])"
]
......@@ -649,12 +624,12 @@
"# Get data\n",
"s_power = ift.power_analyze(sh)\n",
"m_power = ift.power_analyze(m)\n",
"s_power_data = s_power.val.real\n",
"m_power_data = m_power.val.real\n",
"s_data = HT(sh).val.real\n",
"m_data = HT(m).val.real\n",
"m_var_data = m_var.val.real\n",
"d_data = d.val.real\n",
"s_power_data = s_power.val\n",
"m_power_data = m_power.val\n",
"s_data = HT(sh).val\n",
"m_data = HT(m).val\n",
"m_var_data = m_var.val\n",
"d_data = d.val\n",
"\n",
"uncertainty = np.sqrt(np.abs(m_var_data))"
]
......
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