-
Notifications
You must be signed in to change notification settings - Fork 34
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 grating couplers in tidy3d #522
Conversation
Reviewer's Guide by SourceryThis pull request fixes an issue with grating coupler simulations in tidy3d where derived layers were missing from the simulation. This was achieved by refactoring the Class diagram for grating coupler simulation componentsclassDiagram
class Component {
+get_polygons_points()
+ports
+layers
}
class LayerStack {
+layers
+get_component_with_derived_layers()
+get_layer_to_thickness()
+get_layer_to_material()
}
class Layer {
+layer
+zmin
+thickness
}
class LogicalLayer {
+layer
}
class DerivedLayer {
+layer
}
Layer <|-- LogicalLayer
Layer <|-- DerivedLayer
LayerStack *-- Layer
Component --> LayerStack: uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
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.
get_index, | ||
get_medium, | ||
) | ||
from gplugins.tidy3d.materials import get_medium | ||
|
||
|
||
def get_simulation_grating_coupler( |
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.
issue (code-quality): We've found these issues:
- Extract code out into function (
extract-method
) - Low code quality found in get_simulation_grating_coupler - 3% (
low-code-quality
)
Explanation
The quality score for this function is below the quality threshold of 25%.
This score is a combination of the method length, cognitive complexity and working memory.
How can you solve this?
It might be worth refactoring this function to make it shorter and more readable.
- Reduce the function length by extracting pieces of functionality out into
their own functions. This is the most important thing you can do - ideally a
function should be less than 10 lines. - Reduce nesting, perhaps by introducing guard clauses to return early.
- Ensure that variables are tightly scoped, so that code using related concepts
sits together within the function rather than being scattered.
Fixes grating couplers simulations in tidy3d
Before, as seen in this picture, the derived layers were missing from the simulatoin
@yaugenst
Summary by Sourcery
Fix derived layers in tidy3d simulations for grating couplers.
Bug Fixes:
Enhancements: