Skip to content

Hotfix/v2.9 #2729

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

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from
Open

Hotfix/v2.9 #2729

wants to merge 16 commits into from

Conversation

daquinteroflex
Copy link
Collaborator

@daquinteroflex daquinteroflex commented Aug 9, 2025

Greptile Summary

This hotfix PR (v2.9) addresses several critical bug fixes and documentation improvements across the Tidy3D codebase. The primary changes include:

Bug Fixes:

  • Fixed percentage error calculations in autograd numerical tests by adding absolute value operations to prevent misleading results when gradients have opposite signs
  • Corrected a dimensional bug in CoaxialLumpedPort where the source size parameter was hardcoded instead of using the computed size that accounts for injection axis orientation
  • Fixed adjoint source generation in DiffractionData to properly handle negative monitor normal directions by introducing a normal factor that adjusts both amplitude and angle
  • Added validation to ModeSolver to prevent 32-bit integer overflow issues when the product of grid points and modes becomes too large
  • Improved batch operation robustness by saving batch state immediately after upload rather than during download, preventing data loss from interrupted processes
  • Fixed false positive symmetry warnings in adjoint simulations to only trigger when multiple ports are present

Documentation Enhancements:

  • Added comprehensive utilities documentation including RunTimeSpec, FreqRange, FrequencyUtils, and the pre-configured frequencies/wavelengths instances
  • Enhanced docstrings for frequency utility instances to clarify their unit systems and intended use cases
  • Reorganized API documentation structure by moving RunTimeSpec from simulation to utilities section
  • Exposed FrequencyUtils class in the public API for direct user access

Testing Improvements:

  • Added comprehensive numerical validation tests for periodic diffraction scenarios
  • Added validation tests for ModeSolver limits to ensure proper error handling
  • Added tests to verify coaxial port source sizing correctness
  • Added tests to ensure batch file persistence during upload process

These changes integrate well with the existing codebase architecture, following established patterns for validation, error handling, and documentation. The fixes address real production issues that could impact simulation accuracy and user workflows.

Important Files Changed

Click to expand file changes
Filename Score Overview
docs/api/index.rst 5/5 Added utilities module to API documentation structure
tests/test_components/test_autograd_mode_polyslab_numerical.py 5/5 Fixed percentage error calculation using absolute values
tidy3d/components/frequencies.py 5/5 Added documentation to frequency utility instances
tidy3d/plugins/smatrix/ports/coaxial_lumped.py 5/5 Fixed hardcoded source size parameter to use computed dimensions
docs/api/utilities.rst 5/5 New utilities documentation file with comprehensive API coverage
tidy3d/init.py 5/5 Exposed FrequencyUtils class in public API
CHANGELOG.md 5/5 Added hotfix entries documenting bug fixes and improvements
tidy3d/components/data/monitor_data.py 5/5 Fixed adjoint source generation for negative normal directions
tidy3d/components/mode/mode_solver.py 4/5 Added validation to prevent 32-bit integer overflow
tidy3d/web/api/container.py 4/5 Improved batch robustness by saving state immediately after upload
tidy3d/components/data/sim_data.py 5/5 Fixed symmetry warning to only trigger with multiple ports
tests/test_components/test_autograd_numerical.py 5/5 Fixed percentage error calculation in numerical tests
tests/test_web/test_webapi.py 4/5 Added test for batch file persistence after upload
tests/test_plugins/smatrix/test_terminal_component_modeler.py 5/5 Added test for coaxial port source sizing validation
tests/test_plugins/test_mode_solver.py 5/5 Added tests for ModeSolver validation limits
tests/test_components/test_autograd_periodic_numerical.py 3/5 New comprehensive periodic diffraction autograd tests
docs/api/simulation.rst 5/5 Moved RunTimeSpec to utilities section for better organization

Confidence score: 4/5

  • This hotfix addresses critical production issues with targeted fixes that are unlikely to introduce new problems
  • Score reflects well-tested bug fixes in isolated components with comprehensive test coverage additions
  • Pay close attention to the new periodic numerical test file which has different configuration settings than similar tests

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

17 files reviewed, 2 comments

Edit Code Review Bot Settings | Greptile

test_results[SAVE_FD_LOC, :] = fd_grad
test_results[SAVE_ADJ_LOC, :] = pattern_dot_adj_gradient

test_number += 1
Copy link

Choose a reason for hiding this comment

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

style: Variable test_number is incremented but the incremented value is never used since it's at the end of the function.

Context Used: Rule - Use an underscore (_) for loop variables that are intentionally unused. (link)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants