MatchLength

class ipkiss3.all.MatchLength

Settings for connector length matching. To be used in the match_path_length argument in ConnectManhattan. The length of the resulting connector will be equal to

\[length(reference) \cdot multiplication\_factor + delta\]

Length matching is achieved by shifting one flexible control point (i3.H/V with flexible set to True). The flexible control point still requires a coordinate, which is treated as an initial guess. In the likely case of multiple solutions, the one closest to the initial guess will be chosen.

Parameters:
multiplication_factor: float and int, float, integer, floating and number >= 0, optional

The optional scaling factor applied to the length of the reference connector. Default is 1.0.

delta: float, optional

The optional length difference between the connectors. Default is 0.0.

reference: ( str and String that contains only ISO/IEC 8859-1 (extended ASCII py3) or pure ASCII (py2) characters ), optional, *None allowed*

The reference connector for length matching. Does not need to be provided if multiplication_factor is zero.

See also

H
V
ConnectManhattan

Examples

"""
This example illustrates how you can use the length matching functionality.
The length of `match1` will be equal to the length of `ref`
(`delta` is 0.0 by default and `multiplication_factor` is 1.0).
The length of `match2` will be equal to length(`match1`) * 1.1 + 20.0.
"""
from ipkiss3 import all as i3
from ipkiss3.algorithms import isclose

wg = i3.Waveguide()
insts = {f"wg{i}": wg for i in range(4)}

circuit = i3.Circuit(
    insts=insts,
    specs=[
        i3.Place("wg0", (-100, 50)),
        i3.Place("wg1", (50, -25)),
        i3.Place("wg2", (300, 100)),
        i3.Place("wg3", (400, 75)),
        i3.ConnectManhattan("wg1:out", "wg2:in", connection_name="ref"),
        i3.ConnectManhattan(
            "wg0:out",
            "wg1:in",
            connection_name="match1",
            control_points=[i3.H(-50, flexible=True)],
            match_path_length=i3.MatchLength(reference="ref"),
        ),
        i3.ConnectManhattan(
            "wg2:out",
            "wg3:in",
            connection_name="match2",
            control_points=[i3.V(450, flexible=True)],
            match_path_length=i3.MatchLength(reference="match1", delta=20.0, multiplication_factor=1.1),
        ),
    ],
)

lv = circuit.get_default_view(i3.LayoutView)
ref = i3.path_length(lv, "wg1:out", "wg2:in")
match1 = i3.path_length(lv, "wg0:out", "wg1:in")
assert isclose(match1, ref)
match2 = i3.path_length(lv, "wg2:out", "wg3:in")
assert isclose(match2, match1 * 1.1 + 20.0)
lv.visualize()
../../../../_images/ipkiss3-all-MatchLength-1.png