gdsfactory.routing.get_bundle#
- gdsfactory.routing.get_bundle(ports1: list[Port], ports2: list[Port], separation: float = 3.0, extension_length: float = 0.0, straight: ComponentSpec = <function straight>, bend: ComponentSpec = <function bend_euler>, with_sbend: bool = False, sort_ports: bool = True, cross_section: None | CrossSectionSpec | MultiCrossSectionAngleSpec = 'xs_sc', start_straight_length: float | None = None, end_straight_length: 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, steps: list[Step] | None = None, waypoints: Coordinates | None = None, auto_widen: bool = False, auto_widen_minimum_length: float = 100, taper_length: float = 10, width_wide: float = 2, **kwargs) list[Route] [source]#
Returns list 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:
ports1 – list of starting ports.
ports2 – list of end ports.
separation – bundle separation (center to center). Defaults to cross_section.width + cross_section.gap
extension_length – adds straight extension.
bend – function for the bend. Defaults to euler.
with_sbend – use s_bend routing when there is no space for manhattan routing.
sort_ports – sort port coordinates.
cross_section – CrossSection or function that returns a cross_section.
start_straight_length – straight length at the beginning of the route. If None, uses default value for the routing CrossSection.
end_straight_length – end length at the beginning of the route. If None, uses default value for the routing CrossSection.
path_length_match_loops – Integer number of loops to add to bundle for path length matching. Path-length matching won’t be attempted if this is set to None.
path_length_match_extra_length – Extra length to add to path length matching loops (requires path_length_match_loops != None).
path_length_match_modify_segment_i – Index of straight segment to add path length matching loops to (requires path_length_match_loops != None).
enforce_port_ordering – If True, enforce that the ports are connected in the specific order.
steps – specify waypoint steps to route using get_bundle_from_steps.
waypoints – specify waypoints to route using get_bundle_from_steps.
- Keyword Arguments:
width – main layer waveguide width (um).
layer – main layer for waveguide.
width_wide – wide waveguides width (um) for low loss routing.
auto_widen – taper to wide waveguides for low loss routing.
auto_widen_minimum_length – minimum straight length for auto_widen.
taper_length – taper_length for auto_widen.
bbox_layers – list of layers for rectangular bounding box.
bbox_offsets – list of bounding box offsets.
cladding_layers – list of layers to extrude.
cladding_offsets – list of offset from main Section edge.
radius – bend radius (um).
sections – list of Sections(width, offset, layer, ports).
port_names – for input and output (‘o1’, ‘o2’).
port_types – for input and output: electrical, optical, vertical_te …
min_length – defaults to 1nm = 10e-3um for routing.
snap_to_grid – can snap points to grid when extruding the path.
import gdsfactory as gf @gf.cell def test_north_to_south(): 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(f"top_{i}", center=(xs1[i], +0), width=0.5, orientation=a1, layer=(1,0)) for i in range(N)] ports2 = [gf.Port(f"bot_{i}", center=(xs2[i], dy), width=0.5, orientation=a2, layer=(1,0)) for i in range(N)] c = gf.Component() routes = gf.routing.get_bundle(ports1, ports2) for route in routes: c.add(route.references) return c gf.config.set_plot_options(show_subports=False) c = test_north_to_south() c.plot()
(
Source code
,png
,hires.png
,pdf
)