Skip to content

Commit

Permalink
remove unused add ports
Browse files Browse the repository at this point in the history
  • Loading branch information
joamatab committed Apr 30, 2024
1 parent ad3ad27 commit efde015
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions ubcpdk/import_gds.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def guess_port_orientaton(position: ndarray, name: str, label: str, n: int) -> i


def remove_pins(component) -> Component:
"""Remove PINS."""
"""Remove pins."""
component.remove_layers(layers=(LAYER.DEVREC, LAYER.PORT, LAYER.PORTE))
component.paths = []
component._bb_valid = False
Expand All @@ -48,33 +48,6 @@ def remove_pins_recursive(component):
return component


def add_ports(component: Component) -> Component:
"""Add ports from labels.
guess port orientaton from port location.
"""
c = component
n = sum(bool(label.text.startswith("opt")) for label in c.get_labels())
for label in c.get_labels():
if label.text.startswith("opt"):
port_name = label.text
port = gf.Port(
name=port_name,
center=label.origin,
width=port_width,
orientation=guess_port_orientaton(
position=label.origin,
name=c.name,
label=label.text,
n=n,
),
layer=layer,
)
if port_name not in c.ports:
c.add_port(port)
return c


def add_ports_from_siepic_pins(
component: Component,
pin_layer_optical: LayerSpec = "PORT",
Expand Down Expand Up @@ -182,6 +155,7 @@ def import_gds(gdspath, **kwargs):

@cache
def import_gc(gdspath, info=None, **kwargs):
"""Import grating coupler GDS file and add ports to it."""
c = import_gds(gdspath, **kwargs)

if info is not None:
Expand Down

0 comments on commit efde015

Please sign in to comment.