-
Notifications
You must be signed in to change notification settings - Fork 59
KLayout DRC integration #2586
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?
KLayout DRC integration #2586
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.
8 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile
4ed94cf
to
8974b6d
Compare
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
tidy3d/plugins/klayout/drc/drc.py
|
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.
Thanks @bzhangflex this is great! Note the plugin should also be added to the docs here: https://github.com/flexcompute/tidy3d/tree/develop/docs/api/plugins
A question on the interface: Would it make sense to provide default paths for the resultsfile
in is_drc_clean()
and the gdsfile
in run_drc()
?
Also, currently there seems to be no direct way of running DRC and getting the results in a single call. The workflow is distinctly separated into a "run DRC" step, and then you explicitly load the results of that to do further analysis. I think this is a well-structured workflow, but as a user I'd probably prefer getting the results of the DRC right away (in some well-defined data structure), so essentially have run_drc()
return something like a DRCResults
data structure. To spin that thought a bit further, I think there should be a higher-level object-oriented interface (something that derives from Tidy3dBaseModel
). Generally this would put things more in line with established conventions in the codebase but also allow us to serialize these things and e.g. run them in GUI (eventually, maybe). Note that I think this can all be implemented without changing the current functions, we'd just be wrapping them. Keeping the functional interface around is a good idea.
Thank you @yaugenst-flex for the detailed review!
Hmm I'm not sure, the user might end up loading the wrong results unknowingly or overwrite an important gds. What do you think?
Very good point, will work towards that.
Would this be something like all of the sub methods get moved into a DRC object, and run_drc() remains a standalone function but creates and calls a DRC object within it? |
Yes, but: We have a default file for simulation results too, i.e., if you don't specify a
The other way round actually: Create a class that exposes these DRC methods, but just wraps the current functions. Somewhat similar to how it's done in the autograd plugin: https://github.com/flexcompute/tidy3d/blob/develop/tidy3d/plugins/autograd/invdes/filters.py |
8974b6d
to
3a0dd3f
Compare
Thanks @yaugenst-flex, I've made quite a few changes. Now Example usage: from tidy3d.plugins.klayout.drc import run_drc
# Create a simple polygon geometry
vertices = [(-2, 0), (-1, 1), (0, 0.5), (1, 1), (2, 0), (0, -1)]
geom = td.PolySlab(vertices=vertices, slab_bounds=(0, 0.22), axis=2)
# Run DRC and get results
results = run_drc(geom, "geom.gds", "test.drc", "drc_results.lyrdb",
z=0.1, gds_layer=0, gds_dtype=0)
# Check if DRC passed
if results.is_drc_clean():
print("DRC passed!")
else:
print(results) # Prints violation summary
# Violations are indexed by category
print(results['min_width'].violations) |
Adds a new plugin that integrates KLayout's DRC.
Features
Geometry
,Structure
,Simulation
)Main functions
run_drc()
: Main function to run DRC on Tidy3D objectsis_drc_clean()
: Check if a DRC result file has no violationscount_drc_violations()
: Get a count of DRC violations by categoryUsage Example
Documentation
A README is included with detailed instructions and usage examples. More documentation can be added elsewhere as needed (perhaps we add an example notebook as well)
Greptile Summary
Adds KLayout Design Rule Check (DRC) integration plugin, enabling geometry validation for Tidy3D objects that support GDS export (Geometry, Structure, Simulation).
run_drc()
,is_drc_clean()
, andcount_drc_violations()
for DRC execution and result analysistests/test_plugins/klayout/drc/