279 lines
276 KiB
Plaintext
279 lines
276 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "9785abf6",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"We have:\n",
|
||
|
"$$\n",
|
||
|
"\\nabla f = (I + \\beta A) \\vec s - \\vec y\n",
|
||
|
" = \\vec s - \\vec y + \\beta A \\vec s\n",
|
||
|
"$$ \n",
|
||
|
"We can substitute in the partial derivatives:\n",
|
||
|
"$$ \n",
|
||
|
"\\left(\\begin{matrix}\n",
|
||
|
"s_0 - y_0 + \\beta (s_0 - s_1) \\\\\n",
|
||
|
"s_1 - y_1 + \\beta (2s_1 - s_0 - s_2) \\\\\n",
|
||
|
"\\vdots \\\\\n",
|
||
|
"s_N - y_N + \\beta (s_N - s_{N - 1})\n",
|
||
|
"\\end{matrix}\\right) \n",
|
||
|
"= \\vec s - \\vec y + \\beta A \\vec s\n",
|
||
|
"$$\n",
|
||
|
"\n",
|
||
|
"Adding $\\vec y - \\vec s$ to both sides and then dividing by $\\beta$ yields:\n",
|
||
|
"$$ \n",
|
||
|
"\\left(\\begin{matrix}\n",
|
||
|
"s_0 - s_1 \\\\\n",
|
||
|
"2s_1 - s_0 - s_2 \\\\\n",
|
||
|
"\\vdots \\\\\n",
|
||
|
"s_N - s_{N - 1}\n",
|
||
|
"\\end{matrix}\\right) \n",
|
||
|
"= A \\vec s\n",
|
||
|
"$$\n",
|
||
|
"\n",
|
||
|
"Solving for $A$ is trivial and yields:\n",
|
||
|
"$$ \n",
|
||
|
"A = \\left(\\begin{matrix}\n",
|
||
|
"1 & -1 & & & & & \\\\\n",
|
||
|
"-1 & 2 & -1 & & & & \\\\\n",
|
||
|
" & -1 & 2 & -1 & & & \\\\\n",
|
||
|
" & & \\ddots & \\ddots & \\ddots & & \\\\\n",
|
||
|
" & & & -1 & 2 & -1 & \\\\\n",
|
||
|
" & & & & -1 & 2 & -1\\\\\n",
|
||
|
" & & & & & -1 & 1\n",
|
||
|
"\\end{matrix}\\right) \n",
|
||
|
"$$"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 63,
|
||
|
"id": "e7d69a97",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import modules.tridiagonal as tridiagonal\n",
|
||
|
"\n",
|
||
|
"def sample_with_noise(points, vectorized_g):\n",
|
||
|
" \"\"\"\n",
|
||
|
" Sample a function at a given set of points,\n",
|
||
|
" introducing noise in the process.\n",
|
||
|
"\n",
|
||
|
" Returns a tuple of the real values of the function\n",
|
||
|
" and the values with introduced noise.\n",
|
||
|
"\n",
|
||
|
" For performance reasons, this function takes in\n",
|
||
|
" a vectorized version of `g`. If you want to pass\n",
|
||
|
" a non vectorized function use `np.vectorize`. Eg:\n",
|
||
|
" ```py\n",
|
||
|
" sample_with_noise(points, np.vectorize(g))\n",
|
||
|
" ```\n",
|
||
|
" \"\"\"\n",
|
||
|
" gs = vectorized_g(points)\n",
|
||
|
" ys = gs + 0.05 * np.random.randn(len(gs))\n",
|
||
|
"\n",
|
||
|
" return (gs, ys)\n",
|
||
|
"\n",
|
||
|
"def p(n, x):\n",
|
||
|
" \"\"\"\n",
|
||
|
" Vectorized version of the function\n",
|
||
|
" described in the pdf.\n",
|
||
|
" \"\"\"\n",
|
||
|
" result = 0\n",
|
||
|
"\n",
|
||
|
" for k in range(n + 1):\n",
|
||
|
" result += x**k\n",
|
||
|
"\n",
|
||
|
" return result/(n + 1)\n",
|
||
|
"\n",
|
||
|
"def sample_p(n, points):\n",
|
||
|
" \"\"\"\n",
|
||
|
" Samples the test function given in the pdf at\n",
|
||
|
" a given set of points, introducing noise in\n",
|
||
|
" the process.\n",
|
||
|
"\n",
|
||
|
" See `sample_with_noise` for the full return value.\n",
|
||
|
" \"\"\"\n",
|
||
|
" return sample_with_noise(points, lambda x: p(n, x))\n",
|
||
|
"\n",
|
||
|
"def smooth(data, beta):\n",
|
||
|
" \"\"\"\n",
|
||
|
" Smooth noisy data (y) by means of solving \n",
|
||
|
" a minimization problem.\n",
|
||
|
"\n",
|
||
|
" Args:\n",
|
||
|
" data (numpy.array): noisy data to be smoothed (y)\n",
|
||
|
" beta (float): parameter >= 0 that balances fit and smoothing\n",
|
||
|
"\n",
|
||
|
" Returns:\n",
|
||
|
" numpy array of smoothed data (s)\n",
|
||
|
" \"\"\"\n",
|
||
|
" x = data[0]\n",
|
||
|
" y = data[1]\n",
|
||
|
"\n",
|
||
|
" # We need to solve for s in:\n",
|
||
|
" # (I + βA)s - y = 0\n",
|
||
|
" # <=> (I + βA)s = y\n",
|
||
|
" #\n",
|
||
|
" # Because A and I are tridiagonal, I + βA\n",
|
||
|
" # is tridiagonal as well (linear combinations\n",
|
||
|
" # of tridiagonal matrices are themselves\n",
|
||
|
" # tridiagonal)\n",
|
||
|
" #\n",
|
||
|
" # This means we can use our existing implementation\n",
|
||
|
" # of tridiagonal linear equation system solving.\n",
|
||
|
" # \n",
|
||
|
" # We start by constructing \n",
|
||
|
" # iba := I + βA\n",
|
||
|
" n = len(x) - 1\n",
|
||
|
"\n",
|
||
|
" # The a component of the a-c-e tridiagonal representation of iba\n",
|
||
|
" iba_a = np.ones(n + 1) * (2 * beta + 1)\n",
|
||
|
" iba_a[0] = 1 + beta\n",
|
||
|
" iba_a[-1] = 1 + beta\n",
|
||
|
"\n",
|
||
|
" # I + βA\n",
|
||
|
" iba = (\n",
|
||
|
" iba_a,\n",
|
||
|
" -np.ones(n),\n",
|
||
|
" -np.ones(n)\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" data_smoothed = tridiagonal.solve(*iba, y)\n",
|
||
|
"\n",
|
||
|
" return data_smoothed"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 65,
|
||
|
"id": "2b9f2b79",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data":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dSpU0lLSzPZ/+XLl3nwwQdxcXHBzc2N0aNHc+DAAZNrn5/sJspNmzbx6KOP4uXlhaOjo/EYq1atonPnzjg5OeHs7Ey/fv04cuSIyT4uXLjAqFGj8Pf3x87ODh8fH3r37s3Ro0eNeTQaTZ5NS4GBgYwfPz7f8o0fP56PP/7YuI/sR3bN4I8//kjHjh3R6XQ4OjpSt25dHn300QLPWYiKSGpuhChjAwcORKvVsmPHDmNaeHg4jRo1YtSoUbi7uxMZGcknn3xC+/btCQ0NxdPTk0GDBjFv3jxefvllPv74Y2MzS7169QA4f/48nTt35rHHHkOn0xEeHs67775Lt27dOH78ODY2NvmW6fr164SEhGBjY8PixYvx8fHhu+++Y/LkybnyLl++nLFjxzJkyBCWLVuGjY0Nn332Gf369WPjxo307t3bJP/w4cMZOXIkEydO5Pjx48ycOROAr7/+GgClFEOHDmXLli3MnDmT7t27888//zB79mz27t3L3r17sbOzy7PcK1eu5KmnnuKZZ57h7bffxsrKinPnzhEaGlro55CRkcH999/PxIkTmTp1Kjt27OC///0vOp2O1157DYCkpCR69erFzZs3WbhwIfXr12fDhg2MHDmy0P3f7dFHH2XQoEF8++23JCUlYWNjw7x583jllVeYMGECr7zyCunp6bz11lt0796d/fv3G2upBg4cSFZWFm+++SZ16tQhOjqaPXv25Ar8iuPVV18lKSmJn376ib179xrT/fz82Lt3LyNHjmTkyJHMmTMHe3t7Ll68yF9//VXi4wpR7pQQokSWLFmiAHXgwIF88/j4+KgmTZrk+35mZqZKTExUTk5O6v333zem//jjjwpQW7duLbAMer1eZWRkqIsXLypA/fLLLwXmnz59utJoNOro0aMm6X369DE5XlJSknJ3d1eDBw82yZeVlaVatWqlOnToYEybPXu2AtSbb75pkvepp55S9vb2Sq/XK6WU2rBhQ575Vq1apQD1+eefG9NCQkJUSEiI8fXkyZOVm5tbgee2devWXNds3LhxClA//PCDSd6BAweqRo0aGV9//PHHClB//PGHSb4nnnhCAWrJkiUFHjv7uzB27FiT9IiICGVtba2eeeYZk/S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DOnTuXaN9ClCepuRGiDEVERPDiiy+i0+l44oknAMONTymVq9Psl19+SVZWlklazlqPbNk3z5z7uHtEVkF69erFyZMnOXbsmEn6999/b/K6a9euuLm5ERoaSnBwcJ4PW1tbs46ZLbsD8vLly03SV69eTVJSUq4OyvlxcnJiwIABzJo1i/T0dE6ePFmkcuQlJCSEhIQE/vjjD5P0lStXlmi//fr1w9ramvPnz+d7HfPSsGFDXnnlFVq0aMHhw4eN6YGBgfzzzz8mef/66y8SExMLLUt+36mceUJCQli4cCFArhFdQlR0UnMjRCk5ceKEsS9FVFQUO3fuZMmSJWi1WtauXWuspXB1daVHjx689dZbeHp6EhgYyPbt2/nqq69wc3Mz2Wfz5s0B+Pzzz3FxccHe3p6goCAaN25MvXr1mDFjBkop3N3d+e2338xqngF4/vnn+frrrxk0aBBvvPGGcbTUv//+a5LP2dmZDz/8kHHjxnHz5k0efPBBvL29uXHjBseOHePGjRt88sknRbpOffr0oV+/fkyfPp34+Hi6du1qHC3Vpk0bxowZk++2jz/+OA4ODnTt2hU/Pz+uXbvG/Pnz0el0hdb4mGPcuHG89957/Oc//+GNN96gfv36/PHHH2zcuBEAK6vi/R4MDAzk9ddfZ9asWVy4cIH+/ftTo0YNrl+/zv79+3FycmLu3Ln8888/TJ48mYceeogGDRpga2vLX3/9xT///GNSyzdmzBheffVVXnvtNUJ
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import matplotlib.pyplot as plot\n",
|
||
|
"\n",
|
||
|
"# Reusable function to plot the data\n",
|
||
|
"def plot_denoise_results(β, N, ax):\n",
|
||
|
" # Create the data\n",
|
||
|
" x = np.linspace(-1, 1, num=N+1)\n",
|
||
|
" g, y = sample_p(5, x)\n",
|
||
|
" s = smooth((x, y), β)\n",
|
||
|
"\n",
|
||
|
" ax.set_title(f\"{β=} and {N=}\")\n",
|
||
|
" ax.set_xlabel(\"x\")\n",
|
||
|
" ax.set_ylabel(\"y\")\n",
|
||
|
" ax.plot(x, y, \".\", label=\"raw data points\")\n",
|
||
|
" ax.plot(x, g, \"-\", label=\"original function\")\n",
|
||
|
" ax.plot(x, s, \"--\", label=\"denoised values\")\n",
|
||
|
" ax.legend()\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"N = 100\n",
|
||
|
"β = 10\n",
|
||
|
"\n",
|
||
|
"fig, ax = plot.subplots()\n",
|
||
|
"fig.suptitle(f\"Data denoising results\")\n",
|
||
|
"\n",
|
||
|
"# Plot the data\n",
|
||
|
"plot_denoise_results(β, N, ax)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "f2e5c860",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"We notice that finding a point where $\\nabla f(s) = 0$ is the same as finding a point where $\\frac 1 \\beta \\nabla f(s) = \\nabla \\frac 1 \\beta f(s) = 0$. We can use this to our advantage, by defining $h(s) = \\frac 1 \\beta f(s)$ and finding the points where $\\nabla h(s) = 0$ instead. When $\\beta \\to \\infty$, we have:\n",
|
||
|
"$$\n",
|
||
|
"\\lim_{\\beta \\to \\inf} h _\\beta (s) =\n",
|
||
|
"\\lim_{\\beta \\to \\inf} \n",
|
||
|
" \\frac 1 {2\\beta} \\sum_{k=0}^n (y_k - s_k)^2\n",
|
||
|
" +\\frac 1 2 \\sum_{k=1}^n (s_k - s_{k - 1})^2\n",
|
||
|
" = \\frac 1 2 \\sum_{k=1}^n (s_k - s_{k - 1})^2\n",
|
||
|
"$$\n",
|
||
|
"\n",
|
||
|
"It now becomes trivial to verify that $\\nabla f(s) = As$, which means the solution to this will simply be the zero vector."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 70,
|
||
|
"id": "d7f7dbdf",
|
||
|
"metadata": {
|
||
|
"scrolled": true
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABQsAAAPLCAYAAAD4+99NAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd3gU1dvG8e9ueiNAQgk9dJDeexEFFBFBNIoviKI/FRUVpalIsYCgiAUsqKCCigVQAUGkF+lFmigYCEIghJJAElJ25/1jycKSHpJssrk/15WL3dkzM89Oln0yZ545x2QYhoGIiIiIiIiIiIgUe2ZnByAiIiIiIiIiIiKFgzoLRUREREREREREBFBnoYiIiIiIiIiIiFyhzkIREREREREREREB1FkoIiIiIiIiIiIiV6izUERERERERERERAB1FoqIiIiIiIiIiMgV6iwUERERERERERERQJ2FIiIiIiIiIiIicoU6C0VERERERERERARQZ6GIiIiIiIiIiIhcoc5CERERSWPOnDmYTCb7j7e3N+XLl6dr165MmjSJqKioXG9706ZNjB8/ngsXLuRdwJkYP348JpOpQPaVldTjevTo0Xxdx5WldzwK+jOVV+Lj45kwYQJ169bF29uboKAg7r//fs6fP+/s0ERERKQYU2ehiIiIZGj27Nn88ccfrFixghkzZtCkSRPefPNN6tWrx++//56rbW7atIkJEyYUuY6dvNCrVy/++OMPQkJC8nWd4qYofqYMw+D+++9n+vTpPPbYY/z666+88sorzJ8/n7ffftvZ4YmIiEgx5u7sAERERKTwatCgAS1atLA/v/vuu3nuuefo0KED/fr1459//qFcuXJOjLBoKVOmDGXKlMn3dfJbfHw8vr6+zg6jSFu7di0///wz33//Pf379wewV+7GxcU5OToREREpzlRZKCIiIjlSpUoV3n77bS5evMjHH38MwOHDh3nooYeoVasWvr6+VKxYkd69e7N3716HdcePH8+IESMACA0Ntd/mvGbNmmxvIzNLliyhSZMmeHl5ERoayltvvZVuu3/++YcBAwZQtmxZvLy8qFevHjNmzEgTq8lkYv/+/dx///0EBgZSrlw5Hn74YWJiYtJsc8OGDXTr1o2AgAB8fX1p164dS5YscWiT3i20Z86c4X//+x+VK1fGy8uLMmXK0L59e3vlZnrr5DS2n376iUaNGuHl5UX16tV59913s317dmq7nTt30r9/f0qVKkWNGjWyfRyz8x4HDx5MtWrVMtx3VvFl9JnKar8Zye5nMbfbB/j+++8pVaoUffv2tS9bt24dp0+f5uabb85y/VTvvPMOixYtyrRNSkpKmmUWiyXb+xAREZHiRZWFIiIikmO33347bm5urFu3DoCTJ08SFBTE5MmTKVOmDOfOneOLL76gdevW7Nq1izp16gDwyCOPcO7cOd5//30WLFhgv7W2fv367N69O1vbyMjKlSvp06cPbdu25dtvv8VisTBlyhROnz7t0O7AgQO0a9fO3ulZvnx5li9fzrBhw4iOjmbcuHEO7e+++27CwsIYMmQIe/fuZcyYMQB8/vnn9jZr167l1ltvpVGjRnz22Wd4eXkxc+ZMevfuzTfffENYWFiGcQ8cOJCdO3fy+uuvU7t2bS5cuMDOnTs5e/Zslr+H7MS2bNky+vXrR6dOnZg/fz4pKSm89dZbaY5LVvr168d9993H448/TlxcXI6O4428x6xk9pm69957c7Xf7H6eb+R9bdq0idatW9v3t3z5ckaOHEm3bt244447sv3+t2/fzqhRo/juu++46667HF7buXMnAwYM4J9//uGWW25h3rx5XLx4kf79+7N7926aNWvG119/Ta1atbK9PxERESkGDBEREZHrzJ492wCMbdu2ZdimXLlyRr169dJ9LSUlxUhKSjJq1aplPPfccw6vTZ061QCM8PDwTGPIbBvpad26tVGhQgUjISHBviw2NtYoXbq0ce2fPD169DAqVapkxMTEOKz/1FNPGd7e3sa5c+cMwzCMcePGGYAxZcoUh3ZDhw41vL29DavVal/Wpk0bo2zZssbFixcd4m/QoIFRqVIle9vU43rte/f39zeeffbZDN9XeuvkJLaWLVsalStXNhITE+3LLl68aAQFBRnZ+VMwdV+vvPKKw/LsHsfsvMcHH3zQqFq1aob7vlZ6xyOjz1RW+82ujD6Lud1+QkKC4e7ubowbN86YOHGiARiAUaVKFeP48eM5jm3AgAGGh4eHsXDhQofXGjVqZCxbtsw4e/asERYWZvTo0cNo2bKlMWrUKOPs2bPG/Pnzjfbt2+c4fhEREXFtug1ZREREcsUwDPvjlJQU3njjDerXr4+npyfu7u54enryzz//cPDgwWxt70a2ERcXx7Zt2+jXrx/e3t725QEBAfTu3dv+/PLly6xcuZK+ffvi6+tLSkqK/ef222/n8uXLbN682WHbd955p8PzRo0acfnyZfuM0HFxcWzZsoX+/fvj7+9vb+fm5sbAgQP577//OHToUIaxt2rVijlz5vDaa6+xefNmkpOTsz5YOYht+/bt3HXXXXh6etrb+fv7OxyX7Lj77rvtj3N6HG/kPd6I3O43u5/F3G5/586dpKSk0KpVKx544AGWL1/OhAkTuHjxIp06deLSpUsAREdHO8xKnt6Pu7s7X3/9NcnJydx77732itH//vuPSpUq0aNHD0qXLs0XX3zB4cOH7RWTpUuX5t577wWw709EREQEdBuyiIiI5EJcXBxnz56lYcOGAAwfPpwZM2YwatQoOnfuTKlSpTCbzTzyyCMkJCRka5s3so3z589jtVopX758mteuXXb27FlSUlJ4//33ef/999PdVnR0tMPzoKAgh+deXl4A9pjOnz+PYRjpzlZcoUIF+34zMn/+fF577TU+/fRTxo4di7+/P3379mXKlCnpvp/cxJbeJDQ5nZjm2veX0+N4I+/xRuR2v9n9LOZ2+1u3bgVsnY3BwcFUr16d7t27U7t2be6//342b97MLbfcQkBAALNmzcryfS5btowff/yRPn362D8ThmFgNl+tC/Dy8iIkJISzZ89itVodXru2419EREREnYUiIiKSY0uWLMFisdClSxcA5s6dy6BBg3jjjTcc2kVHR1OyZMlsbfNGtlGqVClMJhOnTp1K89q1y0qVKmWv+HvyySfT3VZoaGi24r12m2azmcjIyDSvnTx5EoDg4OAM1w8ODmb69OlMnz6diIgIfv75Z0aPHk1UVBTLli3LUSzpxWYymdIdnzC9Y5WZaycayelxzOo9ent7k5iYmGYb13fc5lRuj212P4u53f7WrVupXr16hp+L1E5mLy8vHnnkkUzf45IlS1i8eDH9+/fnm2++wd3d9ud9pUqVOHbsGL/99htt27bljTfewMPDg4SEBJ5++mmmTJnC77//jsViISAgINN9iIiISPGizkIRERHJkYiICF544QUCAwN57LHHAFtHUmpVW6olS5Zw4sQJatas6bD8+uq3VDnZxvX8/Pxo1aoVCxYsYOrUqfZbkS9evMgvv/xib+fr60vXrl3ZtWsXjRo1crg1N7f8/Pxo3bo1CxYs4K233sLHxwcAq9XK3LlzqVSpErVr187WtqpUqcJTTz3FypUr2bhxY57E1qJFCxYtWsRbb71lf7+XLl1i8eLFud7ujRzH9N5jtWrViIqK4vTp0/aKx6SkJJYvX56tbWb0mcpqvxnJzWcxJ9vfunVrmkpUwzD49NNPadCgAfXr1890/WtNnTrVPpFOakdh6nuYM2cODzzwAH/99Rdt2rRhwYIFJCUlcffdd+Pv70+dOnX44Ycfsr0vERERKR7UWSgiIiIZ2rdvn30suqioKNavX8/s2bNxc3Nj4cKFlClTBoA77riDOXPmULduXRo1asSOHTuYOnUqlSpVSrPN1FuX3333XR588EE8PDyoU6dOjraRnldffZWePXty66238vzzz2OxWHjzzTfx8/Pj3Llz9nbvvvsuHTp0oGPHjjzxxBNUq1aNixcvcvjwYX755RdWrVqV4+M0adIkbr31Vrp27coLL7y
|
||
|
"text/plain": [
|
||
|
"<Figure size 1280x960 with 9 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fig, axs = plot.subplots(\n",
|
||
|
" 3,\n",
|
||
|
" 3,\n",
|
||
|
" layout=\"constrained\",\n",
|
||
|
" figsize=(12.8, 9.6)\n",
|
||
|
")\n",
|
||
|
"\n",
|
||
|
"fig.suptitle(r\"Data denoising results as $\\beta \\to \\infty$\")\n",
|
||
|
"\n",
|
||
|
"N = 100\n",
|
||
|
"\n",
|
||
|
"for i in range(len(axs.flat)):\n",
|
||
|
" ax = axs.flat[i]\n",
|
||
|
" plot_denoise_results(2**i, N, ax)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "dfc485d5",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.10.9"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 5
|
||
|
}
|