Skip to content

feat(fdtd)!: default to static 2D previews with smooth boundaries - #508

Merged
vvahidd merged 4 commits into
mainfrom
fix/static-2d-preview
Nov 11, 2026
Merged

vvahidd merged 4 commits into
mainfrom
fix/static-2d-preview

Conversation

@vvahidd

@vvahidd vvahidd commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Merge mesh cells and consecutive equally colored physical groups before antialiasing to remove repeated edge shading below grating teeth. Preserve holes, material priority, group filters, legends and vector material boundaries in SVG/PDF exports.

Add outline_only=True to plot_2d_static() and plot_2d() for material outlines over field plots, preserving existing field axes and colorbars without additional notebook geometry imports.

Breaking default change targeted for 0.10.0: plot_2d() returns a static Matplotlib Axes. Use plot_2d_interactive() for the previous HTML viewer, including .html and .save(). Legacy height and zoom_to_cursor calls still return the HTML viewer with a migration warning. Their removal targets 0.12.0 or later, after two feature releases and at least three months since the first released warning in 0.10.0; it moves later if those conditions are not met.

The owner approved shortening the plotting API transition to improve setup usability and customer-facing examples. AGENTS.md now specifies the normal retention window as two feature releases and roughly three months, with a documented usability exception. The 0.10.0 default change uses that exception rather than claiming the earlier retention promise has elapsed; the legacy keywords retain the updated minimum window.

Notebook and simulation changes, including the grating's silicon substrate and extended domain, are excluded and will follow separately.

Validated with 92 focused visualization tests, applicable pre-commit hooks including type checking, and an overlay on saved grating-coupler fields.

@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Nov 11, 2026
@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.20879% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.62%. Comparing base (6ef78bc) to head (7e30b6a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/gsim/fdtd/slice_viz.py 90.12% 3 Missing and 5 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #508   +/-   ##
=======================================
  Coverage   91.61%   91.62%           
=======================================
  Files         204      204           
  Lines       28179    28260   +81     
  Branches     5324     5345   +21     
=======================================
+ Hits        25816    25892   +76     
- Misses       1354     1355    +1     
- Partials     1009     1013    +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vvahidd
vvahidd marked this pull request as ready for review November 11, 2026 09:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T11:52:52.815828Z 7e30b6a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d2568983a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gsim/fdtd/visualization.py Resolved

@Alisama20 Alisama20 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The P1 inline comment on plot_2d is right. 0.9.0 announced a deprecation with two feature releases and about 12 months of retention. This PR flips the default in 0.10.0, and plot_2d(height=...) and plot_2d(zoom_to_cursor=...) now raise TypeError. AGENTS.md allows a shorter window only for a correctness or safety problem and none is stated. Please keep the alias until the window ends, or state the shorter window in the description and keep a warning path for the old keywords.
The grating notebook change is not preview-only. z_bounds goes from (-1, 1.55) to (-4, 1.55) and config.json gains a Si substrate group with shifted phys_groups, so the mesh and the cache key change and results probably do too. Please say so or split it out.
In 13 slices of the grating, a ring, a bend and a holed rectangle the new fill differs from the old only on material edges.

@vvahidd
vvahidd requested a review from Alisama20 November 11, 2026 11:25
@vvahidd

vvahidd commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

@Alisama20 Addressed both points:

  • Legacy plot_2d(height=...) and plot_2d(zoom_to_cursor=...) calls now keep returning the HTML viewer with a DeprecationWarning directing callers to plot_2d_interactive(). Added regression coverage for both options, mesh mode, forwarding and incompatible static options.
  • The owner explicitly approved the shorter 0.10.0 default transition for usability and customer-facing examples. Updated AGENTS.md to a normal two-feature-release / roughly three-month retention window and documented the usability exception, rationale and migration. The PR description explicitly identifies this as an exception to the earlier promise.
  • Removed the notebook entirely from this PR. Its substrate, domain and other simulation changes belong in the follow-up notebook PR because they alter the mesh, cache key and results.

All 92 focused visualization tests and applicable pre-commit checks pass.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 96d1042dbd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gsim/fdtd/visualization.py Resolved

@Alisama20 Alisama20 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Legacy plot_2d(height=...) and plot_2d(zoom_to_cursor=...) return the viewer with one DeprecationWarning that names plot_2d_interactive() and the 0.12.0 removal target. Mixing them with static-only options raises a TypeError before meshing. The default call returns an Axes without a warning.
The warning, docstring, migration docs, AGENTS.md and tests state the same removal condition, so the :303 finding is resolved. The grating notebook is no longer in this PR.
tests/fdtd and tests/common pass. I rendered the static previews of the grating side view and an mmi top view and they look right.
Two optional notes: the docs date the first warning to 0.10.0 though 0.9.0 already warned on plot_2d(), and AGENTS.md now lowers the general window to about 3 months while other pages still say 12.

@vvahidd
vvahidd merged commit 0bcc889 into main Nov 11, 2026
49 of 51 checks passed
@vvahidd
vvahidd deleted the fix/static-2d-preview branch November 11, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants