Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce memory requirement for bayer notebook #125

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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