gdsfactory.routing.get_bundle_from_steps

gdsfactory.routing.get_bundle_from_steps#

gdsfactory.routing.get_bundle_from_steps(ports1: list[Port], ports2: list[Port], steps: Iterable[dict[str, float]] | None = None, bend: ComponentSpec = <function bend_euler>, straight: ComponentSpec = <function straight>, taper: ComponentSpec | None = <function taper>, cross_section: CrossSectionSpec | MultiCrossSectionAngleSpec = 'xs_sc', sort_ports: bool = True, separation: float | None = None, path_length_match_loops: int | None = None, path_length_match_extra_length: float = 0.0, path_length_match_modify_segment_i: int = -2, enforce_port_ordering: bool = True, auto_widen: bool = False, taper_length: float = 10, width_wide: float = 2, **kwargs) list[Route][source]#

Returns a list of routes formed by the given waypoints steps.

Can add bends instead of corners and optionally tapers in straight sections. Tapering to wider straights reduces the optical loss and phase errors. get_bundle_from_steps is a manual version of get_bundle and a more convenient version of get_bundle_from_waypoints.

Parameters:
  • port1 – start ports (list or dict).

  • port2 – end ports (list or dict).

  • steps – that define the route (x, y, dx, dy) [{‘dx’: 5}, {‘dy’: 10}].

  • bend – function that returns bends.

  • straight – function that returns straight waveguides.

  • taper – function that returns tapers.

  • cross_section – for routes.

  • sort_ports – if True sort ports.

  • separation – center to center, defaults to ports1 separation.

  • path_length_match_loops – number of loops to match path length.

  • path_length_match_extra_length – extra length to add to the path length.

  • path_length_match_modify_segment_i – modify the segment i to match path length.

  • enforce_port_ordering – if True enforce port ordering.

  • auto_widen – if True, auto widen the cross_section.

  • taper_length – length of the taper.

  • width_wide – width of the wider straight section.

  • kwargs – cross_section settings.

from functools import partial
import gdsfactory as gf

c = gf.Component("get_route_from_steps_sample")
w = gf.components.array(
    partial(gf.components.straight, layer=(2, 0)),
    rows=3,
    columns=1,
    spacing=(0, 50),
)

left = c << w
right = c << w
right.move((200, 100))
p1 = left.get_ports_list(orientation=0)
p2 = right.get_ports_list(orientation=180)

routes = gf.routing.get_bundle_from_steps(
    p1,
    p2,
    steps=[{"x": 150}],
)

for route in routes:
    c.add(route.references)
c.plot()
c.show(show_ports=True)

(Source code, png, hires.png, pdf)

../_images/gdsfactory-routing-get_bundle_from_steps-1.png