Skip to content

Commit

Permalink
Merge pull request #125 from invrs-io/workflow
Browse files Browse the repository at this point in the history
Reduce memory requirement for bayer notebook
  • Loading branch information
mfschubert authored Jul 11, 2024
2 parents f3698dc + 312a6a8 commit 5ce81ae
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/notebooks/bayer_challenge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"source": [
"Next, create the `bayer_sorter` challenge, which enables us to simulate and evaluate a bayer sorter design.\n",
"\n",
"The default simulation parameters are chosen to balance accuracy and simulation cost. For this notebook, we'll override these with settings that yield more accurate results."
"The default simulation parameters are chosen to balance accuracy and simulation cost. For this notebook, we'll override these with settings that yield more accurate results: more terms in the Fourier basis, and more wavelengths."
]
},
{
Expand All @@ -67,7 +67,7 @@
" sim_params=dataclasses.replace(\n",
" bayer_challenge.BAYER_SIM_PARAMS,\n",
" approximate_num_terms=1200,\n",
" wavelength=jnp.arange(0.405, 0.7, 0.01)\n",
" wavelength=jnp.arange(0.405, 0.7, 0.02)\n",
" )\n",
")"
]
Expand Down Expand Up @@ -96,7 +96,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, simulate the bayer sorter. Use a high-resolution wavelength grid so that its detailed wavelength-dependent response is characterized."
"Now, simulate the bayer sorter."
]
},
{
Expand Down Expand Up @@ -130,9 +130,9 @@
"transmission_green_pixel = transmission[:, 1] + transmission[:, 2]\n",
"transmission_red_pixel = transmission[:, 3]\n",
"\n",
"plt.plot(response.wavelength, transmission_blue_pixel, \"b\", lw=3)\n",
"plt.plot(response.wavelength, transmission_green_pixel, \"g\", lw=3)\n",
"plt.plot(response.wavelength, transmission_red_pixel, \"r\", lw=3)\n",
"plt.plot(response.wavelength, transmission_blue_pixel, \"bo-\", lw=3)\n",
"plt.plot(response.wavelength, transmission_green_pixel, \"go-\", lw=3)\n",
"plt.plot(response.wavelength, transmission_red_pixel, \"ro-\", lw=3)\n",
"plt.xlabel(\"Wavelength\")\n",
"plt.ylabel(\"Sub-pixel transmission\")\n",
"_ = plt.ylim(-0.05, 0.7)"
Expand Down Expand Up @@ -223,7 +223,7 @@
"intensity = jnp.abs(ex)**2 + jnp.abs(ey)**2 + jnp.abs(ez)**2\n",
"intensity = jnp.mean(intensity, axis=-1) # Average over polarizations\n",
"\n",
"fig, axs = plt.subplots(ncols=6, nrows=5, figsize=(9, 9))\n",
"fig, axs = plt.subplots(ncols=5, nrows=3, figsize=(9, 7))\n",
"axs = axs.flatten()\n",
"for i, wavelength in enumerate(response.wavelength):\n",
" cmap = cmap_for_wavelength(wavelength)\n",
Expand Down

0 comments on commit 5ce81ae

Please sign in to comment.