Skip to content

Commit

Permalink
Merge pull request #459 from gdsfactory/fix_more_tests
Browse files Browse the repository at this point in the history
Fix more tests
  • Loading branch information
joamatab authored Aug 5, 2024
2 parents 8f4be0b + 23dd65d commit e38cb9c
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 108 deletions.
52 changes: 23 additions & 29 deletions gplugins/sax/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ def __init__(self, **kwargs) -> None:
return None


def array_to_tuples(array, n):
array = [float(x) for x in array]
# Form tuples of size n
return [tuple(array[i : i + n]) for i in range(0, len(array), n)]


class LithoParameter(Parameter):
def __init__(
self,
Expand Down Expand Up @@ -167,11 +161,13 @@ def layer_dilation_erosion(self, component, dilation_value):
if hasattr(buffered_polygons, "geoms")
else [buffered_polygons]
):
for poly in np.array(buffered_polygon.exterior.coords.xy):
temp_component.add_polygon(poly, layer=layer)
coords_tuple = tuple(
map(tuple, buffered_polygon.exterior.coords)
)
temp_component.add_polygon(coords_tuple, layer=layer)
else:
for layer_polygon in layer_polygons:
temp_component.add_polygon(layer_polygon, layer=layer)
for poly in layer_polygons:
temp_component.add_polygon(poly, layer=layer)
# Transform ports
ports = []
for port in component.ports:
Expand All @@ -193,14 +189,14 @@ def layer_x_offset(self, component, offset_value):
temp_component = gf.Component()
for layer, layer_polygons in component.get_polygons_points().items():
for layer_polygon in layer_polygons:
if layer == self.layer:
if layer == self.layer.layer1.layer1.layer:
shapely_polygon = shapely.geometry.Polygon(layer_polygon)
translated_polygon = translate(
shapely_polygon, xoff=offset_value, yoff=0.0
)
temp_component.add_polygon(
translated_polygon.exterior.coords, layer=layer
)

coords_tuple = tuple(map(tuple, translated_polygon.exterior.coords))
temp_component.add_polygon(coords_tuple, layer=layer)
else:
temp_component.add_polygon(layer_polygon, layer=layer)
# Transform ports
Expand All @@ -218,14 +214,13 @@ def layer_y_offset(self, component, offset_value):
temp_component = gf.Component()
for layer, layer_polygons in component.get_polygons_points().items():
for layer_polygon in layer_polygons:
if layer == self.layer:
if layer == self.layer.layer1.layer1.layer:
shapely_polygon = shapely.geometry.Polygon(layer_polygon)
translated_polygon = translate(
shapely_polygon, xoff=0.0, yoff=offset_value
)
temp_component.add_polygon(
translated_polygon.exterior.coords, layer=layer
)
coords = tuple(map(tuple, translated_polygon.exterior.coords))
temp_component.add_polygon(coords, layer=layer)
else:
temp_component.add_polygon(layer_polygon, layer=layer)
# Transform ports
Expand All @@ -242,7 +237,7 @@ def layer_y_offset(self, component, offset_value):
def layer_round_corners(self, component, round_value):
temp_component = gf.Component()
for layer, layer_polygons in component.get_polygons_points().items():
if layer == self.layer:
if layer == self.layer.layer1.layer1.layer:
# Make sure all layer polygons are fused properly
shapely_polygons = [
shapely.geometry.Polygon(polygon) for polygon in layer_polygons
Expand All @@ -259,9 +254,8 @@ def layer_round_corners(self, component, round_value):
.buffer(-2 * round_value, join_style=1)
.buffer(round_value, join_style=1)
)
temp_component.add_polygon(
buffered_polygon.exterior.coords, layer=layer
)
coords = tuple(map(tuple, buffered_polygon.exterior.coords))
temp_component.add_polygon(coords, layer=layer)
else:
for layer_polygon in layer_polygons:
temp_component.add_polygon(layer_polygon, layer=layer)
Expand Down Expand Up @@ -337,11 +331,11 @@ def layer_round_corners(self, component, round_value):
c.add_port(name="o2", center=(3, -2), width=1, orientation=90, layer=1)
c.show()

param = LithoParameter(layername="core")
eroded_c = param.layer_dilation_erosion(c, 0.2)
eroded_c.show()

# param = LithoParameter(layername="core")
# eroded_c = param.layer_dilation_erosion(c, 0.2)
# eroded_c.show()

# param = LithoParameter(layername="core") # FIXME
# eroded_c = param.layer_dilation_erosion(c, -0.2)
# eroded_c.show()

Expand All @@ -353,6 +347,6 @@ def layer_round_corners(self, component, round_value):
# eroded_c = param.layer_y_offset(c, 0.5)
# eroded_c.show()

# param = LithoParameter(layername="core")
# eroded_c = param.layer_round_corners(c, 0.2)
# eroded_c.show()
param = LithoParameter(layername="core")
eroded_c = param.layer_round_corners(c, 0.2)
eroded_c.show()
4 changes: 4 additions & 0 deletions gplugins/sax/tests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,7 @@ def test_litho_parameters() -> None:

param = LithoParameter(layername="core")
param.layer_round_corners(c, 0.2)


if __name__ == "__main__":
test_litho_parameters()
48 changes: 24 additions & 24 deletions gplugins/vlsir/tests/resources/pads_correct.cir
Original file line number Diff line number Diff line change
Expand Up @@ -2,94 +2,94 @@
; Generated by `vlsirtools.XyceNetlister`
;

.SUBCKT straight_e0091ba5
.SUBCKT straight_L392_N2_CSmetal3_W10
+ 1
; No parameters

.ENDS

.SUBCKT straight_af1bc243
.SUBCKT straight_L200_N2_CSmetal3_W10
+ 1
; No parameters

.ENDS

.SUBCKT straight_ea93caa4
.SUBCKT straight_L8_N2_CSmetal3_W10
+ 1
; No parameters

.ENDS

.SUBCKT bend_euler_cross_sectionmetal3
.SUBCKT wire_corner_CSmetal3_RNone
+ 1
; No parameters

.ENDS

.SUBCKT straight_55343d8d
.SUBCKT straight_L400_N2_CSmetal3_W10
+ 1
; No parameters

.ENDS

.SUBCKT pad
+ 1
.SUBCKT pad_S100_100_LMTOP_BLNo_fdaf576b
+ 1 2
; No parameters

.ENDS

.SUBCKT pads_correct
.SUBCKT pads_correct_Ppad_CSmetal3
; No ports
; No parameters

x1
+ tl,tr
+ pad
+ tl,tr tl
+ pad_S100_100_LMTOP_BLNo_fdaf576b
+ ; No parameters

x2
+ tl,tr
+ straight_ea93caa4
+ tl,tr tr
+ pad_S100_100_LMTOP_BLNo_fdaf576b
+ ; No parameters

x3
+ tl,tr
+ bend_euler_cross_sectionmetal3
+ bl,br br
+ pad_S100_100_LMTOP_BLNo_fdaf576b
+ ; No parameters

x4
+ tl,tr
+ straight_af1bc243
+ bl,br bl
+ pad_S100_100_LMTOP_BLNo_fdaf576b
+ ; No parameters

x5
+ tl,tr
+ bend_euler_cross_sectionmetal3
+ straight_L8_N2_CSmetal3_W10
+ ; No parameters

x6
+ tl,tr
+ pad
+ wire_corner_CSmetal3_RNone
+ ; No parameters

x7
+ tl,tr
+ straight_e0091ba5
+ straight_L200_N2_CSmetal3_W10
+ ; No parameters

x8
+ bl,br
+ pad
+ tl,tr
+ wire_corner_CSmetal3_RNone
+ ; No parameters

x9
+ bl,br
+ straight_55343d8d
+ tl,tr
+ straight_L392_N2_CSmetal3_W10
+ ; No parameters

x10
+ bl,br
+ pad
+ straight_L400_N2_CSmetal3_W10
+ ; No parameters

.ENDS
48 changes: 24 additions & 24 deletions gplugins/vlsir/tests/resources/pads_correct.scs
Original file line number Diff line number Diff line change
Expand Up @@ -2,110 +2,110 @@
// Generated by `vlsirtools.SpectreNetlister`
//

subckt straight_e0091ba5
subckt straight_L392_N2_CSmetal3_W10
+ 1
+ // No parameters


ends

subckt straight_af1bc243
subckt straight_L200_N2_CSmetal3_W10
+ 1
+ // No parameters


ends

subckt straight_ea93caa4
subckt straight_L8_N2_CSmetal3_W10
+ 1
+ // No parameters


ends

subckt bend_euler_cross_sectionmetal3
subckt wire_corner_CSmetal3_RNone
+ 1
+ // No parameters


ends

subckt straight_55343d8d
subckt straight_L400_N2_CSmetal3_W10
+ 1
+ // No parameters


ends

subckt pad
+ 1
subckt pad_S100_100_LMTOP_BLNo_fdaf576b
+ 1 2
+ // No parameters


ends

subckt pads_correct
subckt pads_correct_Ppad_CSmetal3
+ // No ports
+ // No parameters

1
+ // Ports:
+ ( tl,tr )
+ pad
+ ( tl,tr tl )
+ pad_S100_100_LMTOP_BLNo_fdaf576b
+ // No parameters

2
+ // Ports:
+ ( tl,tr )
+ straight_ea93caa4
+ ( tl,tr tr )
+ pad_S100_100_LMTOP_BLNo_fdaf576b
+ // No parameters

3
+ // Ports:
+ ( tl,tr )
+ bend_euler_cross_sectionmetal3
+ ( bl,br br )
+ pad_S100_100_LMTOP_BLNo_fdaf576b
+ // No parameters

4
+ // Ports:
+ ( tl,tr )
+ straight_af1bc243
+ ( bl,br bl )
+ pad_S100_100_LMTOP_BLNo_fdaf576b
+ // No parameters

5
+ // Ports:
+ ( tl,tr )
+ bend_euler_cross_sectionmetal3
+ straight_L8_N2_CSmetal3_W10
+ // No parameters

6
+ // Ports:
+ ( tl,tr )
+ pad
+ wire_corner_CSmetal3_RNone
+ // No parameters

7
+ // Ports:
+ ( tl,tr )
+ straight_e0091ba5
+ straight_L200_N2_CSmetal3_W10
+ // No parameters

8
+ // Ports:
+ ( bl,br )
+ pad
+ ( tl,tr )
+ wire_corner_CSmetal3_RNone
+ // No parameters

9
+ // Ports:
+ ( bl,br )
+ straight_55343d8d
+ ( tl,tr )
+ straight_L392_N2_CSmetal3_W10
+ // No parameters

10
+ // Ports:
+ ( bl,br )
+ pad
+ straight_L400_N2_CSmetal3_W10
+ // No parameters


Expand Down
Loading

0 comments on commit e38cb9c

Please sign in to comment.