Created
October 18, 2023 08:51
-
-
Save urish/ed306950fcc5374f7aeb4a881b942e84 to your computer and use it in GitHub Desktop.
Compare two GDS files using klayout scripting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# klayout -b -r compare.py -rd gds1=file1.gds -rd gds2=file2.gds | |
import sys | |
import pya | |
def compare_gds(file1, file2): | |
diff = pya.LayoutDiff() | |
# Load the layouts | |
layout1 = pya.Layout() | |
layout1.read(file1) | |
layout2 = pya.Layout() | |
layout2.read(file2) | |
# Check if the layouts are identical | |
return diff.compare(layout1, layout2) | |
if __name__ == "__main__": | |
if compare_gds(gds1, gds2): | |
print(f"{gds1} and {gds2} are identical.") | |
sys.exit(0) | |
else: | |
print(f"{gds1} and {gds2} are different.") | |
sys.exit(-1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment