def draw(self, cpw, length, length_reduction, coupler): nodes = {} # Default start position is at (0, 0) cpw_trace = CPW(**cpw, direction='+y') cpw_trace.segment(length).open(cpw_trace.total_width()) idc = qlib.InlineIDC(cpw=cpw, name='IDC', **coupler).place(cpw_trace.initial_position(), node='cpw0', rotation=-90) # Computing the locations of each node in the local reference frame. nodes['top'] = cpw_trace.current_position() - (0, cpw_trace.total_width()) nodes['bottom'] = cpw_trace.initial_position() nodes['qb_top'] = nodes['top'] - (0, length_reduction) nodes['qb_bottom'] = nodes['bottom'] + (0, length_reduction) nodes['center'] = (nodes['top'] + nodes['bottom']) / 2 self.add([cpw_trace, idc]) # This is necessary for the perforation mask to render properly self.add_cutout(cpw_trace.cutout) return nodes
def draw(self, cpw, lx, ly1, ly2, radius, meander, coupler): nodes = {} cpw_trace = CPW(**cpw, start=(-lx / 2, ly1), direction='-y') y = ly1 if not isinstance(meander['lengths'], list): meander['lengths'] = [meander['lengths']] * len(meander['ys']) for y_m, Lm in zip(meander['ys'], meander['lengths']): cpw_trace.segment(y - (y_m + 2 * radius)) \ .turn(radius, 'l') \ .meander(2, Lm, radius, turn=-1) \ .turn(radius, 'l') _, y = cpw_trace.current_position() cpw_trace.segment(y - radius) \ .turn(radius, 'l') \ .segment(lx - 2 * radius) \ .turn(radius, 'l') \ .segment(ly2 - radius) left_coupler = coupler.place(cpw_trace.initial_position(), 'cpw') right_coupler = coupler.place(cpw_trace.current_position(), 'cpw') self.add([left_coupler, right_coupler, cpw_trace]) self.add_cutout(cpw_trace.cutout) nodes['left'] = left_coupler.node('pad') nodes['right'] = right_coupler.node('pad') return nodes