class kqcircuits.elements.waveguide_coplanar.WaveguideCoplanar[source]

Bases: Element

The PCell declaration for an arbitrary coplanar waveguide.

Coplanar waveguide defined by the width of the center conductor and gap. It can follow any segmented lines with predefined bending radios. It actually consists of straight and bent PCells. Termination lengths are lengths of extra ground gaps for opened transmission lines

The path parameter defines the waypoints of the waveguide. When a DPath is supplied, the waypoints can be edited in the KLayout GUI with the Partial tool. Alternatively, a list of DPoint can be supplied, in which case the guiding shape is not visible in the GUI. This is useful for code-generated (sub)cells where graphical editing is not possible or desired.


Arbitrary angle bents can have very small gaps between bends and straight segments due to precision of arithmetic. Small positive value of corner_safety_overlap can avoid these gaps.


default implementation


default implementation


default implementation


Child classes re-define this method to build the PCell.

static get_corner_data(point1, point2, point3, r)[source]

Returns data needed to create a curved waveguide at path corner.

  • point1 – point before corner

  • point2 – corner point

  • point3 – point after corner

  • r – curve radius


A tuple (v1, v2, alpha1, alpha2, corner_pos), where

  • v1: the vector (point2 - point1)

  • v2: the vector (point3 - point2)

  • alpha1: angle between v1 and positive x-axis

  • alpha2: angle between v2 and positive x-axis

  • corner_pos: position where the curved waveguide should be placed

static produce_end_termination(elem, point_1, point_2, term_len, face_index=0)[source]

Produces termination for a waveguide.

The termination consists of a rectangular polygon in the metal gap layer, and grid avoidance around it. One edge of the polygon is centered at point_2, and the polygon extends to length “term_len” in the direction of (point_2 - point_1).

  • elem – Element from which the waveguide parameters for the termination are taken

  • point_1 – DPoint before point_2, used only to determine the direction

  • point_2 – DPoint after which termination is produced

  • term_len (double) – termination length, assumed positive

  • face_index (int) – face index of the face in elem where the termination is created

static is_continuous(waveguide_cell, annotation_layer, tolerance)[source]

Returns true if the given waveguide is determined to be continuous, false otherwise.

The waveguide is considered continuous if the endpoints of its every segment (except first and last) are close enough to the endpoints of neighboring segments. The waveguide segments are not necessarily ordered correctly when iterating through the cells using begin_shapes_rec. This means we must compare the endpoints of each waveguide segment to the endpoints of all other waveguide segments.

  • waveguide_cell – Cell of the waveguide.

  • annotation_layer – unsigned int representing the annotation layer

  • tolerance – maximum allowed distance between connected waveguide segments

PCell parameters:

  • path (Shape) - TLine, default=(0,0;100,0) w=0 bx=0 ex=0 r=false

  • term1 (Double) - Termination length start, default=0, unit=μm

  • term2 (Double) - Termination length end, default=0, unit=μm

  • corner_safety_overlap (Double) - Extend straight sections near corners by this amount (μm) to ensure all sections overlap, default=0.001, unit=μm

  • add_metal (Boolean) - Add trace in base metal addition too, default=False

  • ground_grid_in_trace (Boolean) - Add ground grid also to the waveguide, default=False