def make(self): """This is executed by the user to generate the qgeometry for the component.""" p = self.p trace_width = p.trace_width trace_width_half = trace_width / 2 lead_length = p.lead_length trace_gap = p.trace_gap ######################################################### # Geometry of main launch structure launch_pad = draw.Polygon([(0, trace_width_half), (-.122, trace_width_half + .035), (-.202, trace_width_half + .035), (-.202, -trace_width_half - .035), (-.122, -trace_width_half - .035), (0, -trace_width_half), (lead_length, -trace_width_half), (lead_length, +trace_width_half), (0, trace_width_half)]) # Geometry pocket (gap) pocket = draw.Polygon([(0, trace_width_half + trace_gap), (-.122, trace_width_half + trace_gap + .087), (-.25, trace_width_half + trace_gap + .087), (-.25, -trace_width_half - trace_gap - .087), (-.122, -trace_width_half - trace_gap - .087), (0, -trace_width_half - trace_gap), (lead_length, -trace_width_half - trace_gap), (lead_length, +trace_width_half + trace_gap), (0, trace_width_half + trace_gap)]) # These variables are used to graphically locate the pin locations main_pin_line = draw.LineString([(lead_length, trace_width_half), (lead_length, -trace_width_half)]) # Create polygon object list polys1 = [main_pin_line, launch_pad, pocket] # Rotates and translates all the objects as requested. Uses package functions in # 'draw_utility' for easy rotation/translation polys1 = draw.rotate(polys1, p.orientation, origin=(0, 0)) polys1 = draw.translate(polys1, xoff=p.pos_x, yoff=p.pos_y) [main_pin_line, launch_pad, pocket] = polys1 # Adds the object to the qgeometry table self.add_qgeometry('poly', dict(launch_pad=launch_pad), layer=p.layer) # Subtracts out ground plane on the layer its on self.add_qgeometry('poly', dict(pocket=pocket), subtract=True, layer=p.layer) # Generates the pins self.add_pin('tie', main_pin_line.coords, trace_width)
def make(self): """The make function implements the logic that creates the geoemtry (poly, path, etc.) from the qcomponent.options dictionary of parameters, and the adds them to the design, using qcomponent.add_qgeometry(...), adding in extra needed information, such as layer, subtract, etc.""" p = self.p # p for parsed parameters. Access to the parsed options. n = int(p.n) # Create the geometry # Generates a list of points n_polygon = [(p.radius * np.cos(2 * np.pi * x / n), p.radius * np.sin(2 * np.pi * x / n)) for x in range(n)] # Converts said list into a shapely polygon n_polygon = draw.Polygon(n_polygon) n_polygon = draw.rotate(n_polygon, p.rotation, origin=(0, 0)) n_polygon = draw.translate(n_polygon, p.pos_x, p.pos_y) ############################################## # add qgeometry self.add_qgeometry('poly', {'n_polygon': n_polygon}, subtract=p.subtract, helper=p.helper, layer=p.layer, chip=p.chip)
def make(self): """ The make function implements the logic that creates the geoemtry (poly, path, etc.) from the qcomponent.options dictionary of parameters, and the adds them to the design, using qcomponent.add_qgeometry(...), adding in extra needed information, such as layer, subtract, etc. """ p = self.p # p for parsed parameters. Access to the parsed options. # create the geometry caterpillar = [ draw.Point(p.pos_x - p.radius * i * p.distance, p.pos_y).buffer( p.radius, resolution=int(p.resolution), cap_style=getattr(CAP_STYLE, p.cap_style), #join_style = getattr(JOIN_STYLE, p.join_style) ) for i in range(int(p.segments)) ] caterpillar = draw.union(caterpillar) poly = draw.Polygon([(0, 0), (0.5, 0), (0.25, 0.5)]) poly = draw.translate(poly, p.pos_x, p.pos_y) poly = draw.rotate(poly, angle=65) caterpillar = draw.subtract(caterpillar, poly) # rect = draw.rectangle(p.radius*0.75, p.radius*0.23, # xoff=p.pos_x+p.radius*0.3, # yoff=p.pos_y+p.radius*0.4) #caterpillar = draw.subtract(caterpillar, rect) # print(caterpillar) # add qgeometry #self.add_qgeometry('poly', {'mount': rect}) self.add_qgeometry('poly', {'caterpillar': caterpillar})
def make_inner_star(self): """This function creates the coordinates for the pins """ p = self.p # Extracting coordinated from the user input values coords = self.make_coordinates_trap() coords1 = self.make_resonator_coordinates() trap_0 = draw.Polygon(coords) traps = self.make_rotation(trap_0, 5) # Define the final structure based on use input if (p.number_of_connectors) == 0: traps = traps[2] elif (p.number_of_connectors) == 1: traps = draw.union(traps[0], traps[2]) elif (p.number_of_connectors) == 2: traps = draw.union(traps[0], traps[1], traps[2]) elif (p.number_of_connectors) == 3: traps = draw.union(traps[0], traps[1], traps[2], traps[3]) elif (p.number_of_connectors) == 4: traps = draw.union(traps[0], traps[1], traps[2], traps[3], traps[4]) # Subtract from circle circle = self.make_circle() total1 = draw.subtract(circle, traps) # create rectangular connectors to junction pockets = self.make_pockets() rect1 = draw.rectangle(pockets[2], pockets[3]) rect1 = draw.translate(rect1, xoff=coords1[0][0] * 1.1, yoff=p.radius) rect1 = draw.rotate(rect1, p.rotation_cpl1, origin=(0, 0)) rect2 = draw.rectangle(pockets[2], pockets[3]) rect2 = draw.translate(rect2, xoff=coords1[1][0] * 1.1, yoff=p.radius) rect2 = draw.rotate(rect2, p.rotation_cpl1, origin=(0, 0)) #junction jjunction = draw.LineString([[0, 0], [0, coords[1][0]]]) jjunction = draw.translate(jjunction, yoff=(1.15 * (p.radius))) jjunction = draw.rotate(jjunction, p.rotation_cpl1, origin=(0, 0)) # Add connection to the junction total = draw.union(total1, rect1, rect2) objects = [total, jjunction] objects = draw.rotate(objects, p.orientation, origin=(0, 0)) objects = draw.translate(objects, p.pos_x, p.pos_y) [total, jjunction] = objects self.add_qgeometry('poly', {'circle_inner': total}, subtract=p.subtract, helper=p.helper, layer=p.layer, chip=p.chip) self.add_qgeometry('junction', {'poly': jjunction}, subtract=p.subtract, helper=p.helper, layer=p.layer, chip=p.chip, width=p.junc_h)
def make_readout_resonator(self): """This function draws the readout resonator. Adds pins. And adds the drawn geometry to qgeomtery table. """ p = self.p coords_readout = self.make_readout_coordinates() circle = self.make_circle() pockets = self.make_pockets() coords = self.make_coordinates_trap() # Make the readout resonator with the pocket contact_rdout = draw.Polygon(coords_readout) contact_rdout = draw.subtract(circle, contact_rdout) contact_rdout = self.make_rotation(contact_rdout, 1) # Define contacts pocket0 = draw.rectangle(pockets[0], pockets[1]) pocket0 = draw.translate(pocket0, xoff=0, yoff=(coords[3][1])) pocket0 = self.make_rotation(pocket0, 1) # Join the coupler and contact contact_rdout = draw.union(contact_rdout[0], pocket0[0]) pins = self.make_pin_coordinates() pins_rdout = self.make_rotation(pins, 2) objects = [contact_rdout, pins_rdout] objects = draw.rotate(objects, p.orientation, origin=(0, 0)) objects = draw.translate(objects, p.pos_x, p.pos_y) [contact_rdout, pins_rdout] = objects ################################################################## # Add geometry and Qpin connections self.add_qgeometry('poly', {'contact_rdout': contact_rdout}, subtract=p.subtract, helper=p.helper, layer=p.layer, chip=p.chip) self.add_pin('pin_rdout', pins_rdout[0].coords, width=p.cpw_width, input_as_norm=True)
def make_coupling_resonators(self, num): """This function draws the coulping resonators. Adds pins. And adds the drawn geometry to qgeomtery table. """ p = self.p # rotate these trapezoids to form the contacts coords = self.make_coordinates_trap() coords1 = self.make_resonator_coordinates() trap_z = draw.Polygon(coords1) traps_connection = self.make_rotation(trap_z, 4) # Define contacts pockets = self.make_pockets() pocket0 = draw.rectangle(pockets[0], pockets[1]) pocket0 = draw.translate(pocket0, xoff=0, yoff=(coords[3][1])) pockets = self.make_rotation(pocket0, 4) # Define the connectors circle = self.make_circle() contacts = [0] * num for i in range(num): contacts[i] = draw.subtract(circle, traps_connection[i]) contacts[i] = draw.union(contacts[i], pockets[i]) pins = self.make_pin_coordinates() pins_cpl = self.make_rotation(pins, 3) objects = [contacts, pins_cpl] objects = draw.rotate(objects, p.orientation, origin=(0, 0)) objects = draw.translate(objects, p.pos_x, p.pos_y) [contacts, pins_cpl] = objects ################################################################## # Add geometry and Qpin connections if (p.number_of_connectors) >= 1: self.add_qgeometry('poly', {'contact_cpl1': contacts[0]}, subtract=p.subtract, helper=p.helper, layer=p.layer, chip=p.chip) # Add pin connections self.add_pin('pin_cpl1', pins_cpl[0].coords, width=p.cpw_width, input_as_norm=True) if (p.number_of_connectors) >= 2: self.add_qgeometry('poly', {'contact_cpl2': contacts[1]}, subtract=p.subtract, helper=p.helper, layer=p.layer, chip=p.chip) # Add pin connections self.add_pin('pin_cpl2', pins_cpl[1].coords, width=p.cpw_width, input_as_norm=True) if (p.number_of_connectors) >= 3: self.add_qgeometry('poly', {'contact_cpl3': contacts[2]}, subtract=p.subtract, helper=p.helper, layer=p.layer, chip=p.chip) # Add pin connections self.add_pin('pin_cpl3', pins_cpl[2].coords, width=p.cpw_width, input_as_norm=True) if (p.number_of_connectors) >= 4: self.add_qgeometry('poly', {'contact_cpl4': contacts[3]}, subtract=p.subtract, helper=p.helper, layer=p.layer, chip=p.chip) # Add pin connections self.add_pin('pin_cpl4', pins_cpl[3].coords, width=p.cpw_width, input_as_norm=True)
def make_ro(self): ''' Create the head of the readout resonator. Contains: the circular patch for coupling, the 45 deg line, the 45 deg arc, a short straight segment (of length w) for smooth subtraction ''' # access to parsed values from the user option p = self.p # access to chip name chip = p.chip # local variables r = p.readout_radius w = p.readout_cpw_width g = p.readout_cpw_gap turnradius = p.readout_cpw_turnradius l_1 = p.readout_l1 l_2 = p.readout_l2 l_3 = p.readout_l3 l_4 = p.readout_l4 l_5 = p.readout_l5 # create the coupling patch in term of a circle cppatch = draw.Point(0, 0).buffer(r) # create the extended arm ## useful coordinates x_1, y_1 = l_1 * np.cos(np.pi / 4), -l_1 * np.sin(np.pi / 4) x_2, y_2 = x_1 + turnradius * ( 1 - np.cos(np.pi / 4)), y_1 - turnradius * np.sin(np.pi / 4) coord_init = draw.Point(x_1, y_1) coord_center = draw.Point(x_1 - turnradius * np.cos(np.pi / 4), y_1 - turnradius * np.sin(np.pi / 4)) x_3, y_3 = x_2, y_2 x_4, y_4 = x_3, y_3 - l_2 x_5, y_5 = x_4 + turnradius, y_4 coord_init1 = draw.Point(x_4, y_4) coord_center1 = draw.Point(x_5, y_5) x_6, y_6 = x_5, y_5 - turnradius x_7, y_7 = x_5 + l_3, y_6 x_8, y_8 = x_7, y_7 + turnradius coord_init2 = draw.Point((x_7, y_7)) coord_center2 = draw.Point((x_8, y_8)) x_9, y_9 = x_8, y_8 + turnradius x_10, y_10 = x_8 - l_4, y_9 x_11, y_11 = x_10, y_10 + turnradius coord_init3 = draw.Point((x_10, y_10)) coord_center3 = draw.Point((x_11, y_11)) arc3 = self.arc(coord_init3, coord_center3, -np.pi) x_12, y_12 = x_11, y_11 + turnradius x_13, y_13 = x_12 + l_5, y_12 line12 = draw.LineString([(x_12, y_12), (x_13, y_13)]) x_14, y_14 = x_13, y_13 + turnradius coord_init4 = draw.Point((x_13, y_13)) coord_center4 = draw.Point((x_14, y_14)) arc4 = self.arc(coord_init4, coord_center4, np.pi) ## line containing the 45deg line, 45 deg arc, ## and a short straight segment for smooth subtraction cparm_line = draw.shapely.ops.unary_union([ draw.LineString([(0, 0), coord_init]), self.arc(coord_init, coord_center, -np.pi / 4), draw.LineString([(x_3, y_3), (x_4, y_4)]), self.arc(coord_init1, coord_center1, np.pi / 2), draw.LineString([(x_6, y_6), (x_7, y_7)]), self.arc(coord_init2, coord_center2, np.pi), draw.LineString([(x_9, y_9), (x_10, y_10)]), arc3, line12, arc4, draw.translate(line12, 0, 2 * turnradius), draw.translate(arc3, 0, 4 * turnradius), draw.translate(line12, 0, 4 * turnradius), draw.translate(arc4, 0, 4 * turnradius), draw.translate(line12, 0, 6 * turnradius), draw.translate(arc3, 0, 8 * turnradius), draw.translate(line12, 0, 8 * turnradius) ]) cparm = cparm_line.buffer(w / 2, cap_style=2, join_style=1) ## fix the gap resulting from buffer eps = 1e-3 cparm = draw.Polygon(cparm.exterior) cparm = cparm.buffer(eps, join_style=2).buffer(-eps, join_style=2) # create combined objects for the signal line and the etch ro = draw.shapely.ops.unary_union([cppatch, cparm]) ro_etch = ro.buffer(g, cap_style=2, join_style=2) x_15, y_15 = x_14, y_14 + 7 * turnradius x_16, y_16 = x_15 + g / 2, y_15 port_line = draw.LineString([(x_15, y_15 + w / 2), (x_15, y_15 - w / 2)]) subtract_patch = draw.LineString([(x_16, y_16 - w / 2 - g - eps), (x_16, y_16 + w / 2 + g + eps) ]).buffer(g / 2, cap_style=2) ro_etch = ro_etch.difference(subtract_patch) # rotate and translate polys = [ro, ro_etch, port_line] polys = draw.rotate(polys, p.orientation, origin=(0, 0)) polys = draw.translate(polys, p.pos_x, p.pos_y) # update each object [ro, ro_etch, port_line] = polys # generate QGeometry self.add_qgeometry('poly', dict(ro=ro), chip=chip, layer=p.layer) self.add_qgeometry('poly', dict(ro_etch=ro_etch), chip=chip, layer=p.layer_subtract, subtract=p.subtract) # generate pins self.add_pin('readout', port_line.coords, width=w, gap=g, chip=chip)
def make(self): """This is executed by the user to generate the qgeometry for the component.""" p = self.p pad_width = p.pad_width pad_height = p.pad_height pad_gap = p.pad_gap trace_width = p.trace_width trace_width_half = trace_width / 2. pad_width_half = pad_width / 2. lead_length = p.lead_length taper_height = p.taper_height trace_gap = p.trace_gap pad_gap = p.pad_gap ######################################################### # Geometry of main launch structure # The shape is a polygon and we prepare this point as orientation is 0 degree launch_pad = draw.Polygon([ (0, trace_width_half), (-taper_height, pad_width_half), (-(pad_height + taper_height), pad_width_half), (-(pad_height + taper_height), -pad_width_half), (-taper_height, -pad_width_half), (0, -trace_width_half), (lead_length, -trace_width_half), (lead_length, trace_width_half), (0, trace_width_half) ]) # Geometry pocket (gap) # Same way applied for pocket pocket = draw.Polygon([(0, trace_width_half + trace_gap), (-taper_height, pad_width_half + pad_gap), (-(pad_height + taper_height + pad_gap), pad_width_half + pad_gap), (-(pad_height + taper_height + pad_gap), -(pad_width_half + pad_gap)), (-taper_height, -(pad_width_half + pad_gap)), (0, -(trace_width_half + trace_gap)), (lead_length, -(trace_width_half + trace_gap)), (lead_length, trace_width_half + trace_gap), (0, trace_width_half + trace_gap)]) # These variables are used to graphically locate the pin locations main_pin_line = draw.LineString([(lead_length, trace_width_half), (lead_length, -trace_width_half)]) driven_pin_line = draw.LineString([ (-(pad_height + taper_height + pad_gap), pad_width_half), (-(pad_height + taper_height + pad_gap), -pad_width_half) ]) # Create polygon object list polys1 = [main_pin_line, driven_pin_line, launch_pad, pocket] # Rotates and translates all the objects as requested. Uses package functions in # 'draw_utility' for easy rotation/translation polys1 = draw.rotate(polys1, p.orientation, origin=(0, 0)) polys1 = draw.translate(polys1, xoff=p.pos_x, yoff=p.pos_y) [main_pin_line, driven_pin_line, launch_pad, pocket] = polys1 # Adds the object to the qgeometry table self.add_qgeometry('poly', dict(launch_pad=launch_pad), layer=p.layer) # Subtracts out ground plane on the layer its on self.add_qgeometry('poly', dict(pocket=pocket), subtract=True, layer=p.layer) # Generates the pins self.add_pin('tie', main_pin_line.coords, trace_width) self.add_pin('in', driven_pin_line.coords, pad_width, gap=pad_gap)
def make(self): """This is executed by the user to generate the qgeometry for the component.""" p = self.p lead_length = p.lead_length trace_width = p.trace_width trace_width_half = trace_width / 2 trace_gap = p.trace_gap inner_finger_width = .001 inner_finger_width_half = inner_finger_width / 2 inner_finger_offset = .015 finger_side_gap = .002 outer_finger_tip_gap = .0075 inner_finger_tip_gap = .05 + inner_finger_offset outer_finger_width = (trace_width - inner_finger_width - 2 * finger_side_gap) / 2 coupler_length = p.coupler_length lead_offset = coupler_length + outer_finger_tip_gap ######################################################### # Geometry of main launch structure launch_pad = draw.Polygon([ (0, trace_width_half), (-.122, trace_width_half + .035), (-.202, trace_width_half + .035), (-.202, -trace_width_half - .035), (-.122, -trace_width_half - .035), (0, -trace_width_half), (coupler_length, -trace_width_half), (coupler_length, -trace_width_half + outer_finger_width), (-inner_finger_tip_gap + inner_finger_offset, -trace_width_half + outer_finger_width), (-inner_finger_tip_gap + inner_finger_offset, trace_width_half - outer_finger_width), (coupler_length, trace_width_half - outer_finger_width), (coupler_length, trace_width_half), (0, trace_width / 2) ]) # Geometry of coupling structure ind_stub = draw.Polygon([ (inner_finger_offset, -inner_finger_width_half), (lead_offset, -inner_finger_width_half), (lead_offset, -trace_width_half), (lead_offset + lead_length, -trace_width_half), (lead_offset + lead_length, trace_width_half), (lead_offset, trace_width_half), (lead_offset, +inner_finger_width_half), (inner_finger_offset, +inner_finger_width_half), (inner_finger_offset, -inner_finger_width_half) ]) # Geometry pocket (gap) pocket = draw.Polygon([ (0, trace_width_half + trace_gap), (-.122, trace_width_half + trace_gap + .087), (-.25, trace_width_half + trace_gap + .087), (-.25, -trace_width_half - trace_gap - .087), (-.122, -trace_width_half - trace_gap - .087), (0, -trace_width_half - trace_gap), (lead_offset + lead_length, -trace_width_half - trace_gap), (lead_offset + lead_length, +trace_width_half + trace_gap), (0, trace_width_half + trace_gap) ]) # These variables are used to graphically locate the pin locations main_pin_line = draw.LineString([ (lead_offset + lead_length, trace_width_half), (lead_offset + lead_length, -trace_width_half) ]) # Create polygon object list polys1 = [main_pin_line, launch_pad, ind_stub, pocket] # Rotates and translates all the objects as requested. Uses package functions # in 'draw_utility' for easy rotation/translation polys1 = draw.rotate(polys1, p.orientation, origin=(0, 0)) polys1 = draw.translate(polys1, xoff=p.pos_x, yoff=p.pos_y) [main_pin_line, launch_pad, ind_stub, pocket] = polys1 # Adds the object to the qgeometry table self.add_qgeometry('poly', dict(launch_pad=launch_pad, ind_stub=ind_stub), layer=p.layer) # Subtracts out ground plane on the layer its on self.add_qgeometry('poly', dict(pocket=pocket), subtract=True, layer=p.layer) # Generates the pins self.add_pin('tie', main_pin_line.coords, trace_width)