fix(rf): SCRF-714 enforce far_field_approx=True for DirectivityMonitor #2899
+49
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greptile Overview
Updated On: 2025-10-15 18:28:06 UTC
Greptile Summary
This PR fixes the
DirectivityMonitor
class to enforce that thefar_field_approx
parameter must always beTrue
. The change modifies the monitor class to useLiteral[True]
type constraint, preventing users from settingfar_field_approx=False
which would be physically incorrect for directivity calculations. Directivity measurements inherently require far-field approximations since they measure radiation patterns at distances much larger than the antenna/device size.The implementation adds a field override in
DirectivityMonitor
that constrainsfar_field_approx
to only acceptTrue
values, includes proper documentation noting this is for internal use, and maintains backward compatibility since the default was alreadyTrue
. The change integrates well with the existing monitor inheritance hierarchy and follows Tidy3D's pattern of using Pydantic field validation for enforcing physical constraints.Important Files Changed
Changed Files
far_field_approx
alwaysTrue
inDirectivityMonitor
usingLiteral[True]
constraintDirectivityMonitor
raises error whenfar_field_approx=False
is attemptedDirectivityMonitor
now forcesfar_field_approx
toTrue
Confidence score: 5/5
Sequence Diagram