gdsfactory.routing.get_bundle_path_length_match#
- gdsfactory.routing.get_bundle_path_length_match(ports1: list[Port], ports2: list[Port], separation: float = 30.0, end_straight_length: float | None = None, extra_length: float = 0.0, nb_loops: int = 1, modify_segment_i: int = -2, bend: ComponentSpec = <function bend_euler>, straight: ComponentSpec = <function straight>, taper: ComponentSpec | None = <function taper>, start_straight_length: float = 0.0, route_filter: Callable = <function get_route_from_waypoints>, sort_ports: bool = True, cross_section: CrossSectionSpec | MultiCrossSectionAngleSpec = functools.partial(<function cross_section>, radius=10, radius_min=5), enforce_port_ordering: bool = True, **kwargs) list[Route] [source]#
Returns list of routes that are path length matched.
- Parameters:
ports1 – list of ports.
ports2 – list of ports.
separation – between the loops.
end_straight_length – if None tries to determine it.
extra_length – distance added to all path length compensation. Useful is we want to add space for extra taper on all branches.
nb_loops – number of extra loops added in the path.
modify_segment_i – index of the segment that accommodates the new turns default is next to last segment.
bend – for bends.
straight – for straights.
taper – spec.
start_straight_length – in um.
route_filter – get_route_from_waypoints.
sort_ports – sorts ports before routing.
cross_section – factory.
kwargs – cross_section settings.
Tips:
If path length matches the wrong segments, change modify_segment_i arguments.
Adjust nb_loops to avoid too short or too long segments
Adjust separation and end_straight_offset to avoid compensation collisions
import gdsfactory as gf c = gf.Component("path_length_match_sample") dy = 2000.0 xs1 = [-500, -300, -100, -90, -80, -55, -35, 200, 210, 240, 500, 650] pitch = 100.0 N = len(xs1) xs2 = [-20 + i * pitch for i in range(N)] a1 = 90 a2 = a1 + 180 ports1 = [gf.Port(name=f"top_{i}", center=(xs1[i], +0), width=0.5, orientation=a1, layer="WG") for i in range(N)] ports2 = [gf.Port(name=f"bot_{i}", center=(xs2[i], dy), width=0.5, orientation=a2, layer="WG") for i in range(N)] routes = gf.routing.get_bundle_path_length_match(ports1, ports2, extra_length=44) for route in routes: c.add(route.references) gf.config.set_plot_options(show_subports=False) c.plot()
(
Source code
,png
,hires.png
,pdf
)