-
Notifications
You must be signed in to change notification settings - Fork 66
feat(microwave): tidy3d_microwave and BroadbandPulse feature #2883
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
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6 files reviewed, 4 comments
fd3c06b
to
84a91a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6 files reviewed, 3 comments
def test_tidy3d_microwave(): | ||
import importlib | ||
|
||
has_tidy3d_microwave = importlib.util.find_spec("tidy3d_microwave") is not None | ||
print(f"has_tidy3d_microwave = {has_tidy3d_microwave}") | ||
|
||
if has_tidy3d_microwave: | ||
|
||
@supports_microwave | ||
def get_pulse(): | ||
assert tidy3d_microwave["mod"] is not None | ||
pulse = tidy3d_microwave["mod"].BroadbandPulse(fmin=0.1, fmax=10) | ||
_ = pulse.frequency_range(2) | ||
|
||
get_pulse() | ||
else: | ||
assert tidy3d_microwave["mod"] is None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Test only covers the success path. Consider adding a test case that verifies Tidy3dImportError
is raised when @supports_microwave
decorated functions are called without the package installed, similar to other tests in this file.
Context Used: Rule from dashboard
- Add tests for all public constructors and methods to confirm expected behavior, including effects on... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/test_components/test_packaging.py
Line: 95:111
Comment:
**style:** Test only covers the success path. Consider adding a test case that verifies `Tidy3dImportError` is raised when `@supports_microwave` decorated functions are called without the package installed, similar to other tests in this file.
**Context Used:** Rule from `dashboard` - Add tests for all public constructors and methods to confirm expected behavior, including effects on... ([source](https://app.greptile.com/review/custom-context?memory=40c78813-75a7-47ea-a080-1509e6e686a9))
How can I resolve this? If you propose a fix, please make it concise.
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
tidy3d/components/source/time.py
tidy3d/packaging.py
|
Greptile Overview
Updated On: 2025-10-09 23:26:28 UTC
Greptile Summary
This PR introduces support for the
tidy3d-microwave
plugin and adds a newBroadbandPulse
source time class for microwave simulations. The changes implement a modular architecture that allows Tidy3D to conditionally support microwave-specific functionality through an optional external package.The implementation follows the established pattern used for other optional dependencies like
tidy3d-extras
. Key components include: packaging infrastructure with a@supports_microwave
decorator that handles import validation and version checking; aBroadbandPulse
class that acts as a bridge between Tidy3D's source time interface and the microwave package's implementation; build configuration updates inpyproject.toml
; API documentation additions; and basic integration tests.The
BroadbandPulse
class enables users to create broadband excitation sources with guaranteed amplitude levels across specified frequency ranges, particularly useful for microwave simulation applications. The modular design ensures users can access this functionality by installing the optionaltidy3d[microwave]
package while keeping the core Tidy3D package lightweight.PR Description Notes:
Important Files Changed
Changed Files
CHANGELOG.md
tidy3d/packaging.py
docs/api/sources.rst
tidy3d/components/source/time.py
tests/test_components/test_packaging.py
pyproject.toml
Confidence score: 3/5
Sequence Diagram
Context used (3)
dashboard
- Avoid hardcoding values ("magic numbers") that can be programmatically derived from data; use named ... (source)dashboard
- In changelogs, enclose code identifiers (class, function names) in backticks and use specific names ... (source)dashboard
- Require a changelog entry for any PR that is not purely an internal refactor. (source)