Skip to content

Fix tidy3d holes and update tidy3d#567

Merged
joamatab merged 19 commits intomainfrom
fix_tidy3d_holes_and_update
Apr 12, 2025
Merged

Fix tidy3d holes and update tidy3d#567
joamatab merged 19 commits intomainfrom
fix_tidy3d_holes_and_update

Conversation

@joamatab
Copy link
Copy Markdown
Contributor

@joamatab joamatab commented Apr 12, 2025

Summary by Sourcery

Update Tidy3D component handling to improve geometry processing and visualization, and update Tidy3D dependency version

New Features:

  • Extend geometry type support in Tidy3D component from PolySlab to more generic Geometry type

Bug Fixes:

  • Modify polyslabs method to handle geometry more robustly by using Shapely buffering and converting to Tidy3D geometries

Enhancements:

  • Simplify plot_slice method to work with single geometry per layer instead of multiple vertices
  • Remove deprecated get_vertices method from base component

Build:

  • Update Tidy3D dependency to version >=2.8.2,<2.8.3 in pyproject.toml

Tests:

  • Removed an unused test function for grating coupler simulation

Chores:

  • Remove a test function that was likely no longer needed

properly removes holes from shapely shapes, such as rings

image

fixes #565

@joamatab joamatab requested a review from yaugenst April 12, 2025 01:05
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 12, 2025

Reviewer's Guide by Sourcery

The pull request updates the Tidy3D component to fix issues with geometry handling by replacing PolySlab with Geometry, simplifies the plot_slice function, removes an obsolete test, and updates the Tidy3D version in the dependencies.

Updated class diagram for Tidy3DComponent

classDiagram
    class Tidy3DComponent {
        +Literal reference_plane
        +cached_property polyslabs() dict[str, tuple[td.Geometry, ...]]
    }
    class LayeredComponentBase {
    }
    Tidy3DComponent --|> LayeredComponentBase
    note for Tidy3DComponent "Replaced PolySlab with Geometry in polyslabs method"
Loading

Updated class diagram for base_models.component

classDiagram
    class BaseComponent {
        +get_layer_center(layername: str) tuple[float, float, float]
        -get_vertices(layer_name: str, buffer: float)
    }
    note for BaseComponent "Removed get_vertices method"
Loading

File-Level Changes

Change Details Files
Refactor Tidy3DComponent to use td.Geometry instead of td.PolySlab.
  • Changed the return type of polyslabs method to use td.Geometry.
  • Replaced PolySlab creation with Geometry creation using from_shapely.
  • Updated the loop to handle single Geometry objects instead of tuples.
gplugins/tidy3d/component.py
Simplify the plot_slice function in Tidy3DComponent.
  • Removed the inner loop over polys and handled a single poly object.
  • Updated the logic to parse and plot the geometry shapes directly.
gplugins/tidy3d/component.py
Remove obsolete test for grating coupler simulation.
  • Deleted the test_plot_simulation_grating_coupler function.
gplugins/tidy3d/tests/test_plot_simulation_grating_coupler.py
Remove the get_vertices method from the base component model.
  • Deleted the get_vertices method which was used to extract polygon vertices.
gplugins/common/base_models/component.py
Update Tidy3D version in the project dependencies.
  • Updated the Tidy3D version constraint to >=2.8.2,<2.8.3.
pyproject.toml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions Bot added the bug Something isn't working label Apr 12, 2025
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.

@joamatab joamatab merged commit e87ce81 into main Apr 12, 2025
11 of 14 checks passed
@joamatab joamatab deleted the fix_tidy3d_holes_and_update branch April 12, 2025 17:23
@juanferv
Copy link
Copy Markdown

💪🎉💣

@sourcery-ai sourcery-ai Bot mentioned this pull request May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ring resonator with plugging tidy3D gdsfactory

3 participants