qcc_kplugin.joins ================= .. py:module:: qcc_kplugin.joins .. autoapi-nested-parse:: How a route ends on another line: a hanger coupler beside it, or merged into it with a T-junction. ``merge`` splits the line at a point into two routes joined by a KQC ``WaveguideCoplanarSplitter`` (a T: ports ``a`` / ``b`` along the line, ``c`` the stem) and returns the stem port for the new route to end on. ``unmerge`` undoes it: the two halves become one route again and the stem route ends as a hanger coupler at the T's place. ``hanger_to_merge`` / ``merge_to_hanger`` convert an existing route end. The LOM model of the splitter is one conductor, so a capacitor or a resonator on the stem is galvanically on the line. Plain Python (no pya): unit-tested outside KLayout. Functions change the design dict in place and raise ``ValueError`` with a message fit for the status bar. Attributes ---------- .. autoapisummary:: qcc_kplugin.joins.TEE_ARM qcc_kplugin.joins.TEE_CELL Functions --------- .. autoapisummary:: qcc_kplugin.joins.arclength qcc_kplugin.joins.hanger_to_merge qcc_kplugin.joins.merge qcc_kplugin.joins.merge_to_hanger qcc_kplugin.joins.point_at qcc_kplugin.joins.side_normal qcc_kplugin.joins.tee_of qcc_kplugin.joins.unmerge Module Contents --------------- .. py:function:: arclength(pts, p) -> tuple[float, int, tuple] (arclength of the point of polyline ``pts`` nearest ``p``, its segment (1-based), that point). .. py:function:: hanger_to_merge(design: dict, route: str, polyline_of, r: float, tee_params: dict | None = None) -> str Route ``route`` ends as a hanger coupler: merge it into that line with a T instead. Returns the T's name. .. py:function:: merge(design: dict, host: str, polyline, point, side: str, r: float, tee_params: dict | None = None, tee: str | None = None) -> dict Split route ``host`` (built ``polyline``, bend radius ``r``) at the point nearest ``point`` with a T whose stem points to ``side`` of the line. Returns ``{"tee", "stem", "stem_pos", "stem_dir", "second"}``: the T's name, its stem port (``"T1.c"``), the stem port's position and direction, and the name of the second half. .. py:function:: merge_to_hanger(design: dict, route: str, polyline_of, coupler: float = 300.0, ground_gap: float = 6.0, end: str = 'short') -> str Route ``route`` ends on a merge T's stem: remove the T and end the route as a hanger coupler there instead. ``polyline_of(name)`` gives a built route's polyline (the sidecar). Returns the line it now hangs from. .. py:function:: point_at(pts, s: float) -> tuple The point at arclength ``s`` along polyline ``pts``. .. py:function:: side_normal(pts, segment: int, side: str) -> tuple Unit normal of segment ``segment`` (1-based) of ``pts`` on ``side`` ("left" / "right" of the travel). .. py:function:: tee_of(design: dict, route: str) -> str | None The merge T at an end of ``route`` (an instance of :data:`TEE_CELL` whose stem ``c`` the route ends on). .. py:function:: unmerge(design: dict, tee: str) -> tuple[str, tuple] Remove merge T ``tee``: its two halves become one route again (named as the first). Returns (that route, the T's position). .. py:data:: TEE_ARM :value: 11.0 .. py:data:: TEE_CELL :value: 'WaveguideCoplanarSplitter'