add topOpt-based contour finetuning notebook#515
Conversation
7551b68 to
fcc6fac
Compare
groberts-flex
left a comment
There was a problem hiding this comment.
Thanks @marcorudolphflex, this is a really cool notebook! I ended up organizing feedback in a markdown doc to try and make it easy to align with the different sections. I've attached it here!
edf2d94 to
6fec69d
Compare
|
Spell check passed successfully for 1 notebook(s). |
|
thanks for making all of those changes and I like that visualization style. With regard to "One thing I am still a bit skeptical about is the rough corners in the zoom point. Should we revisit the curvature penalty here?", it looks like the rough corners are more present in the red rather than the gray. Is the red the final state? |
groberts-flex
left a comment
There was a problem hiding this comment.
thanks for all of the changes! everything look great overall, just a few minor comments below!
- In the section Defining the Transmission Metric: "The final transmission metric is the smooth minimum of the four channel scores, which makes the weakest channel control the comparison and the later contour update." -> maybe change the wording of weakest channel "control the comparison" to something like "control the loss function" or "primarily control the loss function"
- Same section as 1, is there a reason to specify at this point things are not in dB? "The metric itself is computed from linear power, not in dB." -> could point that out later in the plots or just say the metric is computed in linear power.
- Maybe expand the "Export to GDS and Load It Back" section with a little more markdown text to explain more what's going on at that point. Or clarify that the function there is being set up for being used later to test the gds round trip.
- maybe for the cell that starts with
num_freqs_measure = 151 # dense wavelength samples for the port resolved flux and power plots, we could add a little markdown before it to explain and/or docstrings to the functions there. - for this line: "This notebook therefore assumes that misc/wdm_contour_only_pixel_density.npy is available locally as the starting point for the following conversion and contour optimization comparisons." do want to say that it should have been bundled with the download?
- one quick question, in "Defining Objective Function", in this line "The main optical term is the transmission metric measured from the four output waveguides." -> is it the same transmission based metric from before? if so would be good to clarify that or explain why it changed.
- more a question than a comment on the notebook. in this part of the contour optimization explanation "vertices on the outer frame are frozen so the design stays attached to the original device boundary, " -> is there a reason we need to keep the ones on the boundary attached to the boundary? it makes sense why they would be prevented from leaving the design region, but wouldn't it be ok if they were moved inside the region further?
- in the "Structure Evolution" section, this line "before the local zoom panels isolate the ring segments that move most." -> past tense for move most to read "isolate the ring segments that moved the most"
- In the section "Field Analysis", we can probably remove this sentence: "A 2x2 layout gives each wavelength map a bit more space."
Yes it is, should put a legend to it. |
Sounds good! yeah, it could the penalty function form. It is optimizing and reducing the penalty function over the optimization so it's interesting it looks less smooth when zoomed in. So maybe the penalty is as it is currently written isn't sensitive to these smaller abrupt changes and is looking at curvature on a larger scale? |
|
One thing you could try is having control points and then having the actual control be a smooth spline through the control points. Or have a base set of vertices and then pass them through a smoothing filter each time. The tricky part of this might be the self intersection free update part though since you wouldn't be directly dealing with the vertices that define the polyslab. |
Actually I prepared some branch for this https://github.com/flexcompute/compute/pull/4896 but - as you already suspected - this was not super easy to handle and at one point I was not sure if this is needed (looks smooth when you zoom out). May revisit later |
Weirdly, this did improve by just removing the penalty, something is odd here (see slack). Would ignore this for now and just drop the penalty. |
|
addressed your comments!
|
|
looks great thanks for the updates! |

Summary
Add a new autograd notebook that starts from a saved topology optimized WDM pixel design, converts it to contour geometry, compares the conversion loss, and recovers performance with contour optimization.
Changes
Autograd32WDMContourOptimization.ipynbimg/adjoint_32.pngmisc/wdm_contour_only_pixel_density.npydocs/features/autograd.rstmiscasset inmisc/import_file_mapping.jsonValidation
uvx ruff format Autograd32WDMContourOptimization.ipynbuvx ruff check Autograd32WDMContourOptimization.ipynbuv run --no-project python scripts/validate_notebook_metadata.py Autograd32WDMContourOptimization.ipynbuv run --no-project python scripts/check_notebook_private_paths.py Autograd32WDMContourOptimization.ipynbpython3 misc/check_misc_references.pyuv run spellcheck.py Autograd32WDMContourOptimization.ipynbpre-commit run --files Autograd32WDMContourOptimization.ipynb docs/features/autograd.rst misc/import_file_mapping.jsonNotes
spellcheck.pypasses for the new notebook, but the command still prints legacy schema warnings from unrelated reference notebooks in this branch while building its reference dictionary.Note
Low Risk
Example notebook and doc/asset wiring only; no changes to library APIs or runtime behavior.
Overview
Adds
Autograd32WDMTopologyToContourFinetuning.ipynb, an inverse-design example that loads a saved topology-optimized WDM pixel density, thresholds it, builds smoothed contour geometry viaPolySlabSet, measures the conversion loss against the pixel baseline, and fine-tunes contour vertices with autograd adjoint optimization (including GDS round-trip checks).Supporting assets:
misc/wdm_contour_only_pixel_density.npy, placeholder thumbnailimg/adjoint_32.png, plus registration indocs/features/autograd.rstandmisc/import_file_mapping.json. The notebook is cleaned for publish (repo-relative paths, required metadata, no secrets or local-only setup).Reviewed by Cursor Bugbot for commit f860f2b. Bugbot is set up for automated code reviews on this repo. Configure here.