From 61d6a207178d60331fb109b4f4f67019ebe8155e Mon Sep 17 00:00:00 2001 From: Alex Tait Date: Wed, 22 Jan 2020 18:51:54 -0700 Subject: [PATCH] updated for phidl v1.2 --- lytest/kdb_xor.py | 4 ++-- tests/phidl/test_phidl/test_1_phidldevices.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lytest/kdb_xor.py b/lytest/kdb_xor.py index deb7098..346c8bb 100644 --- a/lytest/kdb_xor.py +++ b/lytest/kdb_xor.py @@ -95,7 +95,7 @@ def xor_polygons_phidl(A, B, hash_geom=True): all_layers.update(B_layers) for layer in all_layers: if (layer in A_layers) and (layer in B_layers): - p = gdspy.fast_boolean(operandA = A_polys[layer], operandB = B_polys[layer], + p = gdspy.fast_boolean(A_polys[layer], B_polys[layer], operation = 'xor', precision=0.001, max_points=4000, layer=layer[0], datatype=layer[1]) elif (layer in A_layers): @@ -115,7 +115,7 @@ def run_xor_phidl(file1, file2, tolerance=1, verbose=False, hash_geom=True): TOPS.append(import_oas(fn)) TOP1, TOP2 = TOPS XOR = xor_polygons_phidl(TOP1, TOP2, hash_geom=True) - if len(XOR.elements) > 0: + if len(XOR.flatten().get_polygons()) > 0: raise GeometryDifference("Differences found between layouts {} and {}".format(file1, file2)) # if you have failed to import klayout.db or pya, it's going to go slower but it can be done with phidl diff --git a/tests/phidl/test_phidl/test_1_phidldevices.py b/tests/phidl/test_phidl/test_1_phidldevices.py index 22b1764..d972b35 100644 --- a/tests/phidl/test_phidl/test_1_phidldevices.py +++ b/tests/phidl/test_phidl/test_1_phidldevices.py @@ -35,10 +35,10 @@ def test_phidlXOR(): TOP_different = phidlib.box(width=100) for hash_geom in [True, False]: XOR = xor_polygons_phidl(TOP1, TOP2, hash_geom=hash_geom) - if len(XOR.elements) > 0: + if len(XOR.flatten().get_polygons()) > 0: raise GeometryDifference("Differences found between phidl Devices.") XOR_different = xor_polygons_phidl(TOP_different, TOP2, hash_geom=hash_geom) - assert len(XOR_different.elements) > 0 + assert len(XOR_different.flatten().get_polygons()) > 0 def test_OAS(): @@ -47,7 +47,7 @@ def test_OAS(): write_oas(TOP1, tempfilename) TOP2 = import_oas(tempfilename) XOR = xor_polygons_phidl(TOP1, TOP2) - if len(XOR.elements) > 0: + if len(XOR.flatten().get_polygons()) > 0: raise GeometryDifference("Differences found between phidl Devices.") os.remove(tempfilename)