gdsfactory.routing.route_bundle

Contents

gdsfactory.routing.route_bundle#

gdsfactory.routing.route_bundle(component, ports1, ports2, cross_section=None, layer=None, separation=3.0, bend='bend_euler', sort_ports=False, start_straight_length=0, end_straight_length=0, min_straight_taper=100, taper=None, port_type=None, collision_check_layers=None, on_collision=None, bboxes=None, allow_width_mismatch=False, radius=None, route_width=None, straight='straight', auto_taper=True, auto_taper_taper=None, waypoints=None, steps=None, start_angles=None, end_angles=None, router=None, layer_transitions=None, layer_marker=None, raise_on_error=False)[source]#

Places a bundle of routes to connect two groups of ports.

Routes connect a bundle of ports with a river router. Chooses the correct routing function depending on port angles.

Parameters:
  • component (gf.Component) – component to add the routes to.

  • ports1 (Ports) – list of starting ports.

  • ports2 (Ports) – list of end ports.

  • cross_section (CrossSectionSpec | None) – CrossSection or function that returns a cross_section.

  • layer (LayerSpec | None) – layer to use for the route.

  • separation (float) – bundle separation (center to center). Defaults to cross_section.width + cross_section.gap

  • bend (ComponentSpec) – function for the bend. Defaults to euler.

  • sort_ports (bool) – sort port coordinates.

  • start_straight_length (float) – straight length at the beginning of the route. If None, uses default value for the routing CrossSection.

  • end_straight_length (float) – end length at the beginning of the route. If None, uses default value for the routing CrossSection.

  • min_straight_taper (float) – minimum length for tapering the straight sections.

  • taper (ComponentSpec | None) – function for tapering long straight waveguides beyond min_straight_taper. Defaults to None.

  • port_type (str | None) – type of port to place. Defaults to optical.

  • collision_check_layers (LayerSpecs | None) – list of layers to check for collisions.

  • on_collision (Literal['error', 'show_error'] | None) – action to take on collision. Defaults to None (ignore).

  • bboxes (Sequence[kf.kdb.DBox] | None) – list of bounding boxes to avoid collisions.

  • allow_width_mismatch (bool) – allow different port widths.

  • radius (float | None) – bend radius. If None, defaults to cross_section.radius.

  • route_width (float | None) – width of the route. If None, defaults to cross_section.width.

  • straight (ComponentSpec) – function for the straight. Defaults to straight.

  • auto_taper (bool) – if True, auto-tapers ports to the cross-section of the route.

  • auto_taper_taper (ComponentSpec | None) – taper to use for auto-tapering. If None, uses the default taper for the cross-section.

  • waypoints (Coordinates | Sequence[gf.kdb.DPoint] | None) – list of waypoints to add to the route.

  • steps (Sequence[Step] | None) – list of steps to add to the route.

  • start_angles (float | list[float] | None) – list of start angles for the routes. Only used for electrical ports.

  • end_angles (float | list[float] | None) – list of end angles for the routes. Only used for electrical ports.

  • router (Literal['optical', 'electrical'] | None) – Set the type of router to use, either the optical one or the electrical one. If None, the router is optical unless the port_type is “electrical”.

  • layer_transitions (LayerTransitions | None) – dictionary of layer transitions to use for the routing when auto_taper=True.

  • layer_marker (LayerSpec | None) – layers to place markers on the route.

  • raise_on_error (bool) – if True, raises an exception on routing error instead of adding error markers.

Return type:

list[ManhattanRoute]

import gdsfactory as gf

dy = 200.0
xs1 = [-500, -300, -100, -90, -80, -55, -35, 200, 210, 240, 500, 650]

pitch = 10.0
N = len(xs1)
xs2 = [-20 + i * pitch for i in range(N // 2)]
xs2 += [400 + i * pitch for i in range(N // 2)]

a1 = 90
a2 = a1 + 180

ports1 = [gf.Port(name=f"top_{i}", center=(xs1[i], +0), width=0.5, orientation=a1, layer=(1,0)) for i in range(N)]
ports2 = [gf.Port(name=f"bot_{i}", center=(xs2[i], dy), width=0.5, orientation=a2, layer=(1,0)) for i in range(N)]

c = gf.Component()
gf.routing.route_bundle(component=c, ports1=ports1, ports2=ports2, cross_section='strip', separation=5)
c.plot()

(Source code)