Add qBIC metasurface sensor notebook - #527
Conversation
Spell Check ReportQMRSMetasurface.ipynb: Checked 1 notebook(s). Found spelling errors in 1 file(s). |
|
Thanks @jungmin-flex, this looks like a very nice addition. I wonder if the simulation domain could be a bit smaller in z. Maybe just one wavelength above and bellow the structure. I couldn’t open the paper, so I couldn’t check the comparison directly. Does the notebook show good agreement with the reference results? I noticed that the notebook does not have metadata yet and is not listed in any .rst file. Are you familiar with this process? I can help with some instructions and/or share a skill that handles this. It would also be nice to add a representative schematic image to the notebook. Finally, I’m not fully sure what our current convention is for ### headers, but I think they should use title case. Maybe @tomflexcompute can confirm. |
tomflexcompute
left a comment
There was a problem hiding this comment.
@jungmin-flex thank you for the great addition.
A few additional steps we need to take:
-
Add metadata to the notebook. You can follow the instructions here https://www.notion.so/flexcompute/How-to-add-metadata-to-a-case-study-or-tutorial-notebook-696f9dd642f14964af4eb1242226451e
-
Add the notebook to the rst file. In this case I believe docs/case_studies/metamaterials_gratings_periodic.rst.
-
Create a 3D schematic thumbnail image. You can reference other thumbnail images in our example library. Typically we use Blender to create it but these days AI can make a decent image too. Feel free to try.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cdb1fec. Configure here.
| } | ||
| ], | ||
| "source": [ | ||
| "sim_base = make_sim()\n", |
There was a problem hiding this comment.
Geometry params not passed
Medium Severity
Base and convergence simulations call make_sim() without forwarding the D_A, D_B, Z_A, and Z_B values defined in the setup cell. Editing those globals changes the documented geometry but not the built Simulation, so plots and grid studies can silently use stale defaults.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit cdb1fec. Configure here.
|
Regarding @FilipeFcp ’s first comment, I tested reducing the simulation size in the z direction to approximately one wavelength. However, the long evanescent tails near resonance caused inaccuracies, particularly on the −z side. The current domain size (3λ in the −z direction and 1λ in the +z direction) appears to be close to the minimum needed to keep the reflectance, transmittance, and absorptance spectra physically reasonable between 0 and 1. I also added the metadata and schematics, and updated the .rst file accordingly. |
tomflexcompute
left a comment
There was a problem hiding this comment.
Thank you @jungmin-flex . Looks great. The schematic usually uses a transparent or white background. Could you change that?
Sure, just updated the schematic image: (1) lowered the transparency of the top layer a bit to better show the depth difference between A and B sites, (2) camera angle, (3) and transparent background as well. |
tomflexcompute
left a comment
There was a problem hiding this comment.
Great! Thanks @jungmin-flex . The last piece of the puzzle is linting. You can see now the merge is blocked since we have a linting check. You can install ruff and run ruff format on the notebook. Then should be good to go. @FilipeFcp feel free to take a final look.
|
It looks like ruff format still failed. Maybe it's due to a different version. @FilipeFcp what's the current ruff version that we use? |
Yes possibly I installed a wrong version with conda, so I reinstalled it using pip and it seems working |
|
Yes that's great. Feel free to |


Summary
pre/2.12branch.Scope
This PR adds a self-contained example notebook only.
Notes for review
Note
Low Risk
Documentation and example-only changes with no production code, auth, or data-path impact.
Overview
Adds a self-contained example notebook for a qBIC metasurface sensor (ported from
pre/2.12), covering geometry setup, symmetry-breaking parameter sweeps, absorption spectra, refractive-index sensing, and near-field plots, plus convergence checks and notes on plane-wave normalization for fields.The notebook is wired into the periodic metamaterials/gratings case-study docs via the existing
MetasurfaceBICtoctree entry—no application or library API changes.Reviewed by Cursor Bugbot for commit 6a0190c. Bugbot is set up for automated code reviews on this repo. Configure here.