Skip to content
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

fix tidy3d cache #534

Merged
merged 1 commit into from
Jan 11, 2025
Merged

fix tidy3d cache #534

merged 1 commit into from
Jan 11, 2025

Conversation

joamatab
Copy link
Contributor

@joamatab joamatab commented Jan 11, 2025

Fix cache

Summary

Bug Fixes:

  • Fixed a bug where tidy3d S-parameter results were not being cached correctly.

Copy link
Contributor

sourcery-ai bot commented Jan 11, 2025

Reviewer's Guide by Sourcery

This pull request fixes the tidy3d cache by ensuring that the saved file has the correct ".npz" extension and updating the default component used for testing.

Sequence diagram for tidy3d cache handling

sequenceDiagram
    participant C as Component
    participant W as write_sparameters
    participant FS as FileSystem

    C->>W: Request write parameters
    W->>FS: Check filepath suffix
    alt filepath without .npz
        W->>W: Add .npz suffix
    end
    W->>FS: Check if file exists
    alt File exists and not overwrite
        FS-->>W: Load cached data
    else File doesn't exist or overwrite
        W->>W: Run simulation
        W->>FS: Save results
    end
    W-->>C: Return results
Loading

File-Level Changes

Change Details Files
Ensure correct file extension for cached simulations
  • Added a check to ensure that the filepath for saving simulation results always has a ".npz" extension.
  • If the provided filepath does not have a ".npz" extension, it is updated to include one before saving the file.
gplugins/tidy3d/component.py
Update default component for testing
  • Changed the default component used for testing from a tapered waveguide to a straight waveguide.
  • Removed several unused parameters from the write_sparameters function call in the test.
gplugins/tidy3d/component.py
Update .gitignore
  • Updated the .gitignore file to ignore specific files or directories. The specific changes are not detailed here as they are numerous and not relevant to the core change itself.
.gitignore

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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a 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. You can also use
    this command to specify where the summary should be inserted.

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

@joamatab joamatab added the bug Something isn't working label Jan 11, 2025
Copy link
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 f9fef2f into main Jan 11, 2025
14 of 19 checks passed
@joamatab joamatab deleted the fix_tidy3d_cache branch January 11, 2025 19:07
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.

1 participant