From efde0155c169fef0a5e6aa57f20a433198ac229f Mon Sep 17 00:00:00 2001 From: Joaquin Matres <4514346+joamatab@users.noreply.github.com> Date: Tue, 30 Apr 2024 09:28:15 -0700 Subject: [PATCH] remove unused add ports --- ubcpdk/import_gds.py | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/ubcpdk/import_gds.py b/ubcpdk/import_gds.py index f5905dde..a9ae8d6f 100644 --- a/ubcpdk/import_gds.py +++ b/ubcpdk/import_gds.py @@ -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 @@ -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", @@ -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: