diff --git a/gplugins/common/base_models/component.py b/gplugins/common/base_models/component.py index 558675c8..481f6e73 100644 --- a/gplugins/common/base_models/component.py +++ b/gplugins/common/base_models/component.py @@ -66,7 +66,7 @@ def gds_component(self) -> GFComponent: left=self.pad_xy_outer, right=self.pad_xy_outer, ) - c.add_ports(self.gds_ports) + c.add_ports(self.ports) c.copy_child_info(self.component) return c @@ -80,11 +80,13 @@ def _gds_bbox(self) -> tuple[tuple[float, float], tuple[float, float]]: return tuple(map(tuple, bbox)) @cached_property - def gds_ports(self) -> dict[str, gf.Port]: - return { - n: p.move_polar_copy(self.extend_ports - self.port_offset, p.orientation) - for n, p in self.component.ports.items() - } + def ports(self) -> dict[str, gf.Port]: + return tuple( + p.move_polar_copy( + self.extend_ports + self.pad_xy_inner - self.port_offset, p.orientation + ) + for p in self.component.ports.values() + ) @computed_field @cached_property @@ -173,14 +175,12 @@ def device_layers(self) -> tuple[str, ...]: ) @cached_property - def port_centers(self) -> tuple[tuple[float, float, float], ...]: - return tuple(self.get_port_center(p) for p in self.gds_ports.values()) + def port_names(self) -> tuple[str, ...]: + return tuple(p.name for p in self.ports) @cached_property - def port_sizes(self): - # TODO calculate maximum port sizes from neighbors - for name, port in self.gds_ports.items(): - print(name, self.port_center(port)) + def port_centers(self) -> tuple[tuple[float, float, float], ...]: + return tuple(self.get_port_center(p) for p in self.ports) def get_port_center(self, port: gf.Port) -> tuple[float, float, float]: layer_czs = np.array(tuple(self.layer_centers.values()))