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
Component reduce #2480
Component reduce #2480
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2480 +/- ##
==========================================
+ Coverage 72.55% 72.57% +0.01%
==========================================
Files 366 366
Lines 23367 23381 +14
Branches 3807 3807
==========================================
+ Hits 16954 16968 +14
Misses 5286 5286
Partials 1127 1127 ☔ View full report in Codecov by Sentry. |
|
||
# Component functions | ||
def serialize_gds(component): | ||
"""Saves Component as GDS + YAML metadata in temporary files with unique name.""" | ||
gds_filepath = GDSDIR_TEMP / component.name |
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.
@joamatab should this use something else than the name to guarantee there are no collisions?
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.
I think name is the best we can use :)
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.
Looks good to me, thank you Simon!
|
||
# Component functions | ||
def serialize_gds(component): | ||
"""Saves Component as GDS + YAML metadata in temporary files with unique name.""" | ||
gds_filepath = GDSDIR_TEMP / component.name |
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.
I think name is the best we can use :)
Override the "reduce" built-in method in Component to allow pickling. This is useful when integrating gdsfactory/gplugins with libraries that use pickling to move data around
@joamatab I'm not sure about this one because there's a lot going with the caching/serialization in gdsfactory. I tried using json and yaml serialization, but it didn't work as well as gds + metadata like I do now.
I don't really care how it's done, I just want to fix the "gdstk.Cell not serializable" errors we get when we try to pickle Components, and I just want a component similar in structure to be returned (I don't really care about unique IDs and such since this is for simulation, not layout)