def make_charge_line(self): """Creates the charge line if the user has charge line option to TRUE. """ # Grab option values name = 'Charge_Line' p = self.p cl_arm = draw.box(0, 0, -p.cl_width, p.cl_length) cl_cpw = draw.box(0, 0, -8 * p.cl_width, p.cl_width) cl_metal = draw.cascaded_union([cl_arm, cl_cpw]) cl_etcher = draw.buffer(cl_metal, p.cl_gap) port_line = draw.LineString([(-8 * p.cl_width, 0), (-8 * p.cl_width, p.cl_width)]) polys = [cl_metal, cl_etcher, port_line] # Move the charge line to the side user requested cl_rotate = 0 if (abs(p.cl_pocket_edge) > 135) or (abs(p.cl_pocket_edge) < 45): polys = draw.translate( polys, -(p.pocket_width / 2 + p.cl_ground_gap + p.cl_gap), p.cl_off_center) if (abs(p.cl_pocket_edge) > 135): cl_rotate = 180 else: polys = draw.translate( polys, -(p.pocket_height / 2 + p.cl_ground_gap + p.cl_gap), p.cl_off_center) cl_rotate = 90 if (p.cl_pocket_edge < 0): cl_rotate = -90 # Rotate it to the pockets orientation polys = draw.rotate(polys, p.orientation + cl_rotate, origin=(0, 0)) # Move to the final position polys = draw.translate(polys, p.pos_x, p.pos_y) [cl_metal, cl_etcher, port_line] = polys # Generating pins points = list(draw.shapely.geometry.shape(port_line).coords) self.add_pin(name, points, p.cl_width) # Adding to qgeometry table self.add_qgeometry('poly', dict(cl_metal=cl_metal)) self.add_qgeometry('poly', dict(cl_etcher=cl_etcher), subtract=True)
def make_connection_pad(self, name: str): """Makes n individual connector. Args: name (str) : Name of the connector """ # self.p allows us to directly access parsed values (string -> numbers) form the user option p = self.p pc = self.p.connection_pads[name] # parser on connector options # define commonly used variables once cpw_width = pc.cpw_width cpw_extend = pc.cpw_extend pad_width = pc.pad_width pad_height = pc.pad_height pad_cpw_shift = pc.pad_cpw_shift pocket_rise = pc.pocket_rise pocket_extent = pc.pocket_extent # Define the geometry # Connector pad connector_pad = draw.rectangle(pad_width, pad_height, -pad_width / 2, pad_height / 2) # Connector CPW wire connector_wire_path = draw.wkt.loads(f"""LINESTRING (\ 0 {pad_cpw_shift+cpw_width/2}, \ {pc.pad_cpw_extent} {pad_cpw_shift+cpw_width/2}, \ {(p.pocket_width-p.pad_width)/2-pocket_extent} {pad_cpw_shift+cpw_width/2+pocket_rise}, \ {(p.pocket_width-p.pad_width)/2+cpw_extend} {pad_cpw_shift+cpw_width/2+pocket_rise}\ )""") # for connector cludge connector_wire_CON = draw.buffer(connector_wire_path, cpw_width / 2.) # helper for the moment # Position the connector, rot and tranlate loc_W, loc_H = float(pc.loc_W), float(pc.loc_H) if float(loc_W) not in [-1., +1.] or float(loc_H) not in [-1., +1.]: self.logger.info( 'Warning: Did you mean to define a transmon wubit with loc_W and' ' loc_H that are not +1 or -1?? Are you sure you want to do this?' ) objects = [connector_pad, connector_wire_path, connector_wire_CON] objects = draw.scale(objects, loc_W, loc_H, origin=(0, 0)) objects = draw.translate( objects, loc_W * (p.pad_width) / 2., loc_H * (p.pad_height + p.pad_gap / 2 + pc.pad_gap)) objects = draw.rotate_position(objects, p.orientation, [p.pos_x, p.pos_y]) [connector_pad, connector_wire_path, connector_wire_CON] = objects self.add_qgeometry('poly', {f'{name}_connector_pad': connector_pad}) self.add_qgeometry('path', {f'{name}_wire': connector_wire_path}, width=cpw_width) self.add_qgeometry('path', {f'{name}_wire_sub': connector_wire_path}, width=cpw_width + 2 * pc.cpw_gap, subtract=True) ############################################################ # add pins points = np.array(connector_wire_path.coords) self.add_pin(name, points=points[-2:], width=cpw_width, input_as_norm=True)
def make_connection_pad(self, name: str): """Makes individual connector pad. Args: name (str) : Name of the connector pad """ # self.p allows us to directly access parsed values (string -> numbers) form the user option p = self.p cross_width = p.cross_width cross_length = p.cross_length cross_gap = p.cross_gap # access to chip name chip = p.chip pc = self.p.connection_pads[name] # parser on connector options c_g = pc.claw_gap c_l = pc.claw_length c_w = pc.claw_width g_s = pc.ground_spacing con_loc = pc.connector_location claw_cpw = draw.box(0, -c_w / 2, -4 * c_w, c_w / 2) if pc.connector_type == 0: # Claw connector t_claw_height = 2*c_g + 2 * c_w + 2*g_s + \ 2*cross_gap + cross_width # temp value claw_base = draw.box(-c_w, -(t_claw_height) / 2, c_l, t_claw_height / 2) claw_subtract = draw.box(0, -t_claw_height / 2 + c_w, c_l, t_claw_height / 2 - c_w) claw_base = claw_base.difference(claw_subtract) connector_arm = draw.shapely.ops.unary_union([claw_base, claw_cpw]) connector_etcher = draw.buffer(connector_arm, c_g) else: connector_arm = claw_cpw connector_etcher = draw.buffer(connector_arm, c_g) # Making the pin for tracking (for easy connect functions). # Done here so as to have the same translations and rotations as the connector. Could # extract from the connector later, but since allowing different connector types, # this seems more straightforward. port_line = draw.LineString([(-4 * c_w, -c_w / 2), (-4 * c_w, c_w / 2)]) claw_rotate = 0 if con_loc > 135: claw_rotate = 180 elif con_loc > 45: claw_rotate = -90 # Rotates and translates the connector polygons (and temporary port_line) polys = [connector_arm, connector_etcher, port_line] polys = draw.translate(polys, -(cross_length + cross_gap + g_s + c_g), 0) polys = draw.rotate(polys, claw_rotate, origin=(0, 0)) polys = draw.rotate(polys, p.orientation, origin=(0, 0)) polys = draw.translate(polys, p.pos_x, p.pos_y) [connector_arm, connector_etcher, port_line] = polys # Generates qgeometry for the connector pads self.add_qgeometry('poly', {f'{name}_connector_arm': connector_arm}, chip=chip) self.add_qgeometry('poly', {f'{name}_connector_etcher': connector_etcher}, subtract=True, chip=chip) self.add_pin(name, port_line.coords, c_w)