Commit 6437bc49 by Martin Reinecke

### tweaks

parent 759a13ce
Pipeline #24372 passed with stage
in 6 minutes and 7 seconds
 ... ... @@ -82,11 +82,11 @@ "\n", "- One-dimensional signal with power spectrum: $$P(k) = P_0\\,\\left(1+\\left(\\frac{k}{k_0}\\right)^2\\right)^{-\\gamma /2},$$\n", "with $P_0 = 0.2, k_0 = 5, \\gamma = 4$. Recall: $P(k)$ defines an isotropic and homogeneous $S$.\n", "- $N = 0.05 \\cdot \\text{id}$.\n", "- $N = 0.2 \\cdot \\mathbb{1}$.\n", "- Number of data points $N_{pix} = 512$.\n", "- reconstruction in harmonic space.\n", "- Response operator:\n", "$$R = FFT(\\text{harmonic} \\rightarrow \\text{position})$$\n" "$$R = FFT_{\\text{harmonic} \\rightarrow \\text{position}}$$\n" ] }, { ... ... @@ -238,7 +238,7 @@ "# Fields and data\n", "sh = ift.power_synthesize(ift.PS_field(p_space, pow_spec),real_signal=True)\n", "noiseless_data=R(sh)\n", "noise_amplitude = np.sqrt(0.05)\n", "noise_amplitude = np.sqrt(0.2)\n", "N = ift.ScalingOperator(noise_amplitude**2, s_space)\n", "\n", "n = ift.Field.from_random(domain=s_space, random_type='normal',\n", ... ... @@ -326,6 +326,7 @@ }, "outputs": [], "source": [ "plt.figure(figsize=(15,10))\n", "plt.plot(s_data, 'g', label=\"Signal\")\n", "plt.plot(d_data, 'k+', label=\"Data\")\n", "plt.plot(m_data, 'r', label=\"Reconstruction\")\n", ... ... @@ -344,7 +345,7 @@ }, "outputs": [], "source": [ "plt.figure()\n", "plt.figure(figsize=(15,10))\n", "plt.plot(s_data - s_data, 'g', label=\"Signal\")\n", "plt.plot(d_data - s_data, 'k+', label=\"Data\")\n", "plt.plot(m_data - s_data, 'r', label=\"Reconstruction\")\n", ... ... @@ -375,13 +376,14 @@ }, "outputs": [], "source": [ "plt.figure(figsize=(15,10))\n", "plt.loglog()\n", "plt.xlim(1, int(N_pixels/2))\n", "ymin = min(m_power_data)\n", "plt.ylim(ymin, 1)\n", "xs = np.arange(1,int(N_pixels/2),.1)\n", "plt.plot(xs, pow_spec(xs), label=\"True Power Spectrum\", linewidth=.7, color='k')\n", "plt.plot(s_power_data, 'k', label=\"Signal\", alpha=.5, linewidth=.5)\n", "plt.plot(s_power_data, 'g', label=\"Signal\")\n", "plt.plot(m_power_data, 'r', label=\"Reconstruction\")\n", "plt.axhline(noise_amplitude**2 / N_pixels, color=\"k\", linestyle='--', label=\"Noise level\", alpha=.5)\n", "plt.axhspan(noise_amplitude**2 / N_pixels, ymin, facecolor='0.9', alpha=.5)\n", ... ... @@ -551,8 +553,8 @@ }, "outputs": [], "source": [ "fig = plt.figure(figsize=(15,10))\n", "plt.plot(s_data, 'k', label=\"Signal\", alpha=.5, linewidth=1)\n", "plt.figure(figsize=(15,10))\n", "plt.plot(s_data, 'g', label=\"Signal\", linewidth=1)\n", "plt.plot(d_data, 'k+', label=\"Data\", alpha=1)\n", "plt.axvspan(l, h, facecolor='0.8', alpha=.5)\n", "plt.title(\"Incomplete Data\")\n", ... ... @@ -570,7 +572,7 @@ "outputs": [], "source": [ "fig = plt.figure(figsize=(15,10))\n", "plt.plot(s_data, 'k', label=\"Signal\", alpha=1, linewidth=1)\n", "plt.plot(s_data, 'g', label=\"Signal\", alpha=1, linewidth=1)\n", "plt.plot(d_data, 'k+', label=\"Data\", alpha=.5)\n", "plt.plot(m_data, 'r', label=\"Reconstruction\")\n", "plt.axvspan(l, h, facecolor='0.8', alpha=.5)\n", ... ... @@ -597,11 +599,11 @@ "outputs": [], "source": [ "N_pixels = 256 # Number of pixels\n", "sigma2 = 10. # Noise variance\n", "sigma2 = 2. # Noise variance\n", "\n", "\n", "def pow_spec(k):\n", " P0, k0, gamma = [.2, 5, 4]\n", " P0, k0, gamma = [.2, 2, 4]\n", " return P0 * (1. + (k/k0)**2)**(- gamma / 2)\n", "\n", "\n", ... ... @@ -635,8 +637,8 @@ "\n", "# Lose some data\n", "\n", "l = int(N_pixels * 0.2)\n", "h = int(N_pixels * 0.2 * 2)\n", "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", ... ... @@ -759,7 +761,7 @@ "precise = (np.abs(s_data-m_data) < uncertainty )\n", "print(\"Error within uncertainty map bounds: \" + str(np.sum(precise) * 100 / N_pixels**2) + \"%\")\n", "\n", "fig = plt.figure()\n", "plt.figure(figsize=(15,10))\n", "plt.imshow(precise.astype(float), cmap=\"brg\")\n", "plt.colorbar()" ] ... ... @@ -777,9 +779,7 @@ "\n", "https://gitlab.mpcdf.mpg.de/ift/NIFTy\n", "\n", "commit 1d10be4674a42945f8548f3b68688bf0f0d753fe\n", "\n", "NIFTy v3 **not (yet) stable!**" "NIFTy v4 **more or less stable!**" ] } ], ... ...
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