Skip to content

Commit

Permalink
Rename gds_ports -> ports, fix port centers and remove port size calc…
Browse files Browse the repository at this point in the history
…ulation from base
  • Loading branch information
yaugenst committed Oct 16, 2023
1 parent d3f237d commit 854d86e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions gplugins/common/base_models/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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()))
Expand Down

0 comments on commit 854d86e

Please sign in to comment.