Commit 324405dc authored by Martin Reinecke's avatar Martin Reinecke

adjust notebook

parent 613bae17
Pipeline #25099 passed with stages
in 6 minutes and 39 seconds
......@@ -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\n",
"m_power_data = m_power.val\n",
"s_power_data = s_power.to_global_data()\n",
"m_power_data = m_power.to_global_data()\n",
"\n",
"# Get signal data and reconstruction data\n",
"s_data = HT(sh).val\n",
"m_data = HT(m).val\n",
"s_data = HT(sh).to_global_data()\n",
"m_data = HT(m).to_global_data()\n",
"\n",
"d_data = d.val"
"d_data = d.to_global_data()"
]
},
{
......@@ -450,11 +450,14 @@
"l = int(N_pixels * 0.2)\n",
"h = int(N_pixels * 0.2 * 2)\n",
"\n",
"mask = ift.Field(s_space, val=1)\n",
"mask.val[ l : h] = 0\n",
"mask = np.full(s_space.shape, 1.)\n",
"mask[l:h] = 0\n",
"mask = ift.Field.from_global_data(s_space, mask)\n",
"\n",
"R = ift.DiagonalOperator(mask)*HT\n",
"n.val[l:h] = 0\n",
"n = n.to_global_data()\n",
"n[l:h] = 0\n",
"n = ift.Field.from_global_data(s_space, n)\n",
"\n",
"d = R(sh) + n"
]
......@@ -494,7 +497,7 @@
},
"outputs": [],
"source": [
"m_mean, m_var = ift.probe_with_posterior_samples(curv, m, HT, 200)"
"m_mean, m_var = ift.probe_with_posterior_samples(curv, HT, 200)"
]
},
{
......@@ -519,11 +522,11 @@
"outputs": [],
"source": [
"# Get signal data and reconstruction data\n",
"s_data = s.val\n",
"m_data = HT(m).val\n",
"m_var_data = m_var.val\n",
"s_data = s.to_global_data()\n",
"m_data = HT(m).to_global_data()\n",
"m_var_data = m_var.to_global_data()\n",
"uncertainty = np.sqrt(m_var_data)\n",
"d_data = d.val\n",
"d_data = d.to_global_data()\n",
"\n",
"# Set lost data to NaN for proper plotting\n",
"d_data[d_data == 0] = np.nan"
......@@ -604,11 +607,14 @@
"l = int(N_pixels * 0.33)\n",
"h = int(N_pixels * 0.33 * 2)\n",
"\n",
"mask = ift.Field(s_space, val=1)\n",
"mask.val[l:h,l:h] = 0\n",
"mask = np.full(s_space.shape, 1.)\n",
"mask[l:h,l:h] = 0.\n",
"mask = ift.Field.from_global_data(s_space, mask)\n",
"\n",
"R = ift.DiagonalOperator(mask)*HT\n",
"n.val[l:h, l:h] = 0\n",
"n = n.to_global_data()\n",
"n[l:h, l:h] = 0\n",
"n = ift.Field.from_global_data(s_space, n)\n",
"curv = Curvature(R=R, N=N, Sh=Sh)\n",
"D = curv.inverse\n",
"\n",
......@@ -619,17 +625,17 @@
"m = D(j)\n",
"\n",
"# Uncertainty\n",
"m_mean, m_var = ift.probe_with_posterior_samples(curv, m, HT, 20)\n",
"m_mean, m_var = ift.probe_with_posterior_samples(curv, HT, 20)\n",
"\n",
"# Get data\n",
"s_power = ift.power_analyze(sh)\n",
"m_power = ift.power_analyze(m)\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",
"s_power_data = s_power.to_global_data()\n",
"m_power_data = m_power.to_global_data()\n",
"s_data = HT(sh).to_global_data()\n",
"m_data = HT(m).to_global_data()\n",
"m_var_data = m_var.to_global_data()\n",
"d_data = d.to_global_data()\n",
"\n",
"uncertainty = np.sqrt(np.abs(m_var_data))"
]
......@@ -678,8 +684,8 @@
"ma = np.max(s_data)\n",
"\n",
"fig, axes = plt.subplots(3, 2, figsize=(15, 22.5))\n",
"samp1 = HT(curv.draw_sample()+m).val\n",
"samp2 = HT(curv.draw_sample()+m).val\n",
"samp1 = HT(curv.draw_sample()+m).to_global_data()\n",
"samp2 = HT(curv.draw_sample()+m).to_global_data()\n",
"\n",
"data = [s_data, m_data, samp1, samp2, s_data - m_data, uncertainty]\n",
"caption = [\"Signal\", \"Reconstruction\", \"Sample 1\", \"Sample 2\", \"Residuals\", \"Uncertainty Map\"]\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