def __init__(self, origin, trans_in=None): ## MUST BE IMPLEMENTED ## self.connections = [] # DPoint list with possible connection points self.angle_connections = [] #list with angle of connecting elements self.connection_ptrs = [] # pointers to connected structures represented by their class instances ## MUST BE IMLPEMENTED END ## self.origin = origin self.metal_region = Region() self.empty_region = Region() self.metal_regions = {} self.empty_regions = {} self.metal_regions["default"] = self.metal_region self.empty_regions["default"] = self.empty_region self.metal_region.merged_semantics = False self.empty_region.merged_semantics = False self.DCplxTrans_init = None self.ICplxTrans_init = None if( trans_in is not None ): # if( isinstance( trans_in, ICplxTrans ) ): <==== FORBIDDEN if( isinstance( trans_in, DCplxTrans ) ): self.DCplxTrans_init = trans_in self.ICplxTrans_init = ICplxTrans().from_dtrans( trans_in ) elif( isinstance( trans_in, CplxTrans ) ): self.DCplxTrans_init = DCplxTrans().from_itrans( trans_in ) self.ICplxTrans_init = ICplxTrans().from_trans( trans_in ) elif( isinstance( trans_in, DTrans ) ): self.DCplxTrans_init = DCplxTrans( trans_in, 1 ) self.ICplxTrans_init = ICplxTrans( Trans().from_dtrans( trans_in ), 1 ) elif( isinstance( trans_in, Trans ) ): self.DCplxTrans_init = DCplxTrans( DTrans().from_itrans( trans_in ), 1 ) self.ICplxTrans_init = ICplxTrans( trans_in, 1 ) self._init_regions_trans()
def __init__(self, origin, trans_in=None, inverse=False): ## MUST BE IMPLEMENTED ## self.connections = [] # DPoint list with possible connection points self.connection_edges = [ ] # indexes of edges that are intended to connect to other polygons # indexes in "self.connection_edges" where Sonnet ports # should be placed self.sonnet_port_connections = [] self.angle_connections = [] # list with angle of connecting elements ## MUST BE IMLPEMENTED END ## self.connection_ptrs = [ ] # pointers to connected structures represented by their class instances self.origin = origin self.inverse = inverse # TODO: after Region.insert() and/or? metal_region + other_region # there is width problem that initial region has dimensions # Region().bbox() = ((-1,-1,1,1)) or something like that # Hence, if you wish to take Region.bbox() of the resulting region # You will get incorrect value due to initial region having # something "blank" at the creation moment. This may be solved # by either shrinking resulting region to shapes it contains, # or by refusing of usage of empty `Region()`s self.metal_region = Region() self.empty_region = Region() self.metal_regions = OrderedDict() self.empty_regions = OrderedDict() self.metal_regions["default"] = self.metal_region self.empty_regions["default"] = self.empty_region self.metal_region.merged_semantics = True self.empty_region.merged_semantics = True self.DCplxTrans_init = None self.ICplxTrans_init = None if (trans_in is not None): # TODO: update with Klayouts new rules. # if( isinstance( trans_in, ICplxTrans ) ): <==== FORBIDDEN if (isinstance(trans_in, DCplxTrans)): self.DCplxTrans_init = trans_in self.ICplxTrans_init = ICplxTrans().from_dtrans(trans_in) elif (isinstance(trans_in, CplxTrans)): self.DCplxTrans_init = DCplxTrans().from_itrans(trans_in) self.ICplxTrans_init = ICplxTrans().from_trans(trans_in) elif (isinstance(trans_in, DTrans)): self.DCplxTrans_init = DCplxTrans(trans_in, 1) self.ICplxTrans_init = ICplxTrans( Trans().from_dtrans(trans_in), 1) elif (isinstance(trans_in, Trans)): self.DCplxTrans_init = DCplxTrans( DTrans().from_itrans(trans_in), 1) self.ICplxTrans_init = ICplxTrans(trans_in, 1) elif (isinstance(trans_in, ICplxTrans)): # not tested 14.08.2021 self.DCplxTrans_init = DCplxTrans(trans_in) self.ICplxTrans_init = trans_in self._geometry_parameters = OrderedDict() self._init_regions_trans()
def init_regions(self): self.connections = [DPoint(0, 0), self.dr] self.start = DPoint(0, 0) self.end = self.start + self.dr alpha = atan2(self.dr.y, self.dr.x) self.angle_connections = [alpha, alpha] alpha_trans = ICplxTrans().from_dtrans( DCplxTrans(1, alpha * 180 / pi, False, self.start)) metal_poly = DSimplePolygon([ DPoint(0, -self.width / 2), DPoint(self.dr.abs(), -self.width / 2), DPoint(self.dr.abs(), self.width / 2), DPoint(0, self.width / 2) ]) self.connection_edges = [3, 1] self.metal_region.insert(pya.SimplePolygon().from_dpoly(metal_poly)) if (self.gap != 0): self.empty_region.insert( pya.Box( Point().from_dpoint(DPoint(0, self.width / 2)), Point().from_dpoint( DPoint(self.dr.abs(), self.width / 2 + self.gap)))) self.empty_region.insert( pya.Box( Point().from_dpoint(DPoint(0, -self.width / 2 - self.gap)), Point().from_dpoint(DPoint(self.dr.abs(), -self.width / 2)))) self.metal_region.transform(alpha_trans) self.empty_region.transform(alpha_trans)
def init_regions(self): self.metal_regions["photo"] = Region() self.empty_regions["photo"] = Region() self.connections = [DPoint(0, 0), self.dr] self.start = DPoint(0, 0) self.end = self.start + self.dr alpha = atan2(self.dr.y, self.dr.x) self.angle_connections = [alpha, alpha] alpha_trans = ICplxTrans().from_dtrans( DCplxTrans(1, alpha * 180 / pi, False, self.start)) self.metal_regions['photo'].insert( pya.Box(Point().from_dpoint(DPoint(0, -self.width / 2)), Point().from_dpoint(DPoint(self.dr.abs(), self.width / 2)))) self.empty_regions['photo'].insert( pya.Box( Point().from_dpoint(DPoint(0, self.width / 2)), Point().from_dpoint( DPoint(self.dr.abs(), self.width / 2 + self.gap)))) self.empty_regions['photo'].insert( pya.Box( Point().from_dpoint(DPoint(0, -self.width / 2 - self.gap)), Point().from_dpoint(DPoint(self.dr.abs(), -self.width / 2)))) self.metal_regions['photo'].transform(alpha_trans) self.empty_regions['photo'].transform(alpha_trans) self.metal_region = self.metal_regions['photo'] self.empty_region = self.empty_regions['photo']
def make_trans(self, dCplxTrans): if (dCplxTrans is not None): iCplxTrans = ICplxTrans().from_dtrans(dCplxTrans) self.metal_region.transform(iCplxTrans) self.empty_region.transform(iCplxTrans) self._update_connections(dCplxTrans) self._update_alpha(dCplxTrans)
def make_trans( self, dCplxTrans ): if( dCplxTrans is not None ): iCplxTrans = ICplxTrans().from_dtrans( dCplxTrans ) for metal_region, empty_region in zip(self.metal_regions.values(), self.empty_regions.values()): metal_region.transform( iCplxTrans ) empty_region.transform( iCplxTrans ) self._update_connections( dCplxTrans ) self._update_alpha( dCplxTrans )
def __init__(self, origin, trans_in=None, inverse=False): ## MUST BE IMPLEMENTED ## self.connections = [] # DPoint list with possible connection points self.connection_edges = [ ] # indexes of edges that are intended to connect to other polygons # indexes in "self.connection_edges" where Sonnet ports # should be placed self.sonnet_port_connections = [] self.angle_connections = [] # list with angle of connecting elements ## MUST BE IMLPEMENTED END ## self.connection_ptrs = [ ] # pointers to connected structures represented by their class instances self.origin = origin self.inverse = inverse self.metal_region = Region() self.empty_region = Region() self.metal_regions = OrderedDict() self.empty_regions = OrderedDict() self.metal_regions["default"] = self.metal_region self.empty_regions["default"] = self.empty_region self.metal_region.merged_semantics = True self.empty_region.merged_semantics = True self.DCplxTrans_init = None self.ICplxTrans_init = None if (trans_in is not None): # if( isinstance( trans_in, ICplxTrans ) ): <==== FORBIDDEN if (isinstance(trans_in, DCplxTrans)): self.DCplxTrans_init = trans_in self.ICplxTrans_init = ICplxTrans().from_dtrans(trans_in) elif (isinstance(trans_in, CplxTrans)): self.DCplxTrans_init = DCplxTrans().from_itrans(trans_in) self.ICplxTrans_init = ICplxTrans().from_trans(trans_in) elif (isinstance(trans_in, DTrans)): self.DCplxTrans_init = DCplxTrans(trans_in, 1) self.ICplxTrans_init = ICplxTrans( Trans().from_dtrans(trans_in), 1) elif (isinstance(trans_in, Trans)): self.DCplxTrans_init = DCplxTrans( DTrans().from_itrans(trans_in), 1) self.ICplxTrans_init = ICplxTrans(trans_in, 1) self._geometry_parameters = OrderedDict() self._init_regions_trans()
def make_trans(self, dCplxTrans_temp): for primitive in self.primitives.values(): primitive.make_trans(dCplxTrans_temp) for region in itertools.chain(self.metal_regions.values(), self.empty_regions.values()): iCplxTrans = ICplxTrans().from_dtrans(dCplxTrans_temp) region.transform(iCplxTrans) self._update_connections(dCplxTrans_temp) self._update_alpha(dCplxTrans_temp)
def make_trans(self, dCplxTrans): if (dCplxTrans is not None): regions = itertools.chain(self.metal_regions.values(), self.empty_regions.values()) for reg in regions: iCplxTrans = ICplxTrans().from_dtrans(dCplxTrans) reg.transform(iCplxTrans) self._update_connections(dCplxTrans) self._update_alpha(dCplxTrans)
def init_regions(self): self.metal_regions["photo"] = Region() self.empty_regions["photo"] = Region() self.metal_regions["bridges"] = Region() self.empty_regions["bridges"] = Region() self.metal_regions["bridge_patches"] = Region() self.empty_regions["bridge_patches"] = Region() self.connections = [DPoint(0, 0), self.dr] self.start = DPoint(0, 0) self.end = self.start + self.dr alpha = atan2(self.dr.y, self.dr.x) self.angle_connections = [alpha, alpha] alpha_trans = ICplxTrans().from_dtrans( DCplxTrans(1, alpha * 180 / pi, False, self.start)) self.metal_regions["photo"].insert( pya.Box(Point().from_dpoint(DPoint(0, -self.width / 2)), Point().from_dpoint(DPoint(self.dr.abs(), self.width / 2)))) self.empty_regions["photo"].insert( pya.Box( Point().from_dpoint(DPoint(0, self.width / 2)), Point().from_dpoint( DPoint(self.dr.abs(), self.width / 2 + self.gap)))) self.empty_regions["photo"].insert( pya.Box( Point().from_dpoint(DPoint(0, -self.width / 2 - self.gap)), Point().from_dpoint(DPoint(self.dr.abs(), -self.width / 2)))) self.metal_regions["photo"].transform(alpha_trans) self.empty_regions["photo"].transform(alpha_trans) if self.dr.x == 0: N_bridges = int((self.dr.y - self._bridge_interval) // self._bridge_interval + 1) for i in range(N_bridges): ab = Airbridge(self.start + DPoint( 0, (self._bridge_interval / 2 + i * self._bridge_interval) * sign(self.dr.y)), trans_in=DTrans.R90) self.metal_regions["bridges"] += ab.metal_regions["bridges"] self.metal_regions["bridges"] += ab.metal_regions[ "bridge_patches"] elif self.dr.y == 0: N_bridges = int((self.dr.x - self._bridge_interval) // self._bridge_interval + 1) print("N_bridges", N_bridges) for i in range(N_bridges): bridge_pos = self.start + DPoint( (self._bridge_interval / 2 + i * self._bridge_interval) * sign(self.dr.x), 0) ab = Airbridge(bridge_pos, trans_in=None) self.metal_regions["bridges"] += ab.metal_regions["bridges"] self.metal_regions["bridge_patches"] += ab.metal_regions[ "bridge_patches"]
def draw_test_structures(self): new_pars_squid = AsymSquidParams( pad_r=5e3, pads_distance=30e3, p_ext_width=10e3, p_ext_r=200, sq_len=15e3, sq_area=200e6, j_width_1=94, j_width_2=347, intermediate_width=500, b_ext=1e3, j_length=94, n=20, bridge=180, j_length_2=250 ) struct_centers = [DPoint(1e6, 4e6), DPoint(8.7e6, 5.7e6), DPoint(6.5e6, 2.7e6)] for struct_center in struct_centers: ## JJ test structures ## # test structure with big critical current test_struct1 = TestStructurePads(struct_center) test_struct1.place(self.region_ph) text_reg = pya.TextGenerator.default_generator().text("48.32 nA", 0.001, 50, False, 0, 0) text_bl = test_struct1.empty_rectangle.origin + DPoint( test_struct1.gnd_gap, -4 * test_struct1.gnd_gap ) text_reg.transform(ICplxTrans(1.0, 0, False, text_bl.x, text_bl.y)) self.region_ph -= text_reg test_jj = AsymSquid(test_struct1.center, new_pars_squid, side=1) self.test_squids.append(test_jj) test_jj.place(self.region_el) # test structure with low critical current test_struct2 = TestStructurePads(struct_center + DPoint(0.3e6, 0)) test_struct2.place(self.region_ph) text_reg = pya.TextGenerator.default_generator().text("9.66 nA", 0.001, 50, False, 0, 0) text_bl = test_struct2.empty_rectangle.origin + DPoint( test_struct2.gnd_gap, -4 * test_struct2.gnd_gap ) text_reg.transform(ICplxTrans(1.0, 0, False, text_bl.x, text_bl.y)) self.region_ph -= text_reg test_jj = AsymSquid(test_struct2.center, new_pars_squid, side=-1) self.test_squids.append(test_jj) test_jj.place(self.region_el) # test structure for bridge DC contact test_struct3 = TestStructurePads(struct_center + DPoint(0.6e6, 0)) test_struct3.place(self.region_ph) text_reg = pya.TextGenerator.default_generator().text("DC", 0.001, 50, False, 0, 0) text_bl = test_struct3.empty_rectangle.origin + DPoint( test_struct3.gnd_gap, -4 * test_struct3.gnd_gap ) text_reg.transform(ICplxTrans(1.0, 0, False, test_struct3.center.x, text_bl.y)) self.region_ph -= text_reg test_bridges = [] for i in range(3): bridge = Bridge1(test_struct3.center + DPoint(50e3 * (i - 1), 0), gnd_touch_dx=20e3) test_bridges.append(bridge) bridge.place(self.region_bridges1, region_name="bridges_1") bridge.place(self.region_bridges2, region_name="bridges_2") # bandages test structures test_dc_el2_centers = [ DPoint(2.5e6, 2.4e6), DPoint(4.2e6, 1.6e6), DPoint(9.0e6, 3.8e6) ] for struct_center in test_dc_el2_centers: test_struct1 = TestStructurePads(struct_center) test_struct1.place(self.region_ph) text_reg = pya.TextGenerator.default_generator().text("Bandage", 0.001, 40, False, 0, 0) text_bl = test_struct1.empty_rectangle.origin + DPoint( test_struct1.gnd_gap, -4 * test_struct1.gnd_gap ) text_reg.transform(ICplxTrans(1.0, 0, False, text_bl.x, text_bl.y)) self.region_ph -= text_reg rec_width = 10e3 rec_height = test_struct1.rectangles_gap + 2 * FABRICATION.OVERETCHING + 2 * rec_width p1 = struct_center - DVector(rec_width / 2, rec_height / 2) dc_rec = Rectangle(p1, rec_width, rec_height) dc_rec.place(self.region_el2)
def draw_test_structures(self): struct_centers = [ DPoint(1e6, 4e6), DPoint(8.7e6, 5.7e6), DPoint(6.5e6, 2.7e6) ] for struct_center in struct_centers: ## JJ test structures ## # test structure with big critical current test_struct1 = TestStructurePads(struct_center) test_struct1.place(self.region_ph) text_reg = pya.TextGenerator.default_generator().text( "48.32 nA", 0.001, 50, False, 0, 0) text_bl = test_struct1.empty_rectangle.origin + DPoint( test_struct1.gnd_gap, -4 * test_struct1.gnd_gap) text_reg.transform(ICplxTrans(1.0, 0, False, text_bl.x, text_bl.y)) self.region_ph -= text_reg test_jj = AsymSquidDCFlux(test_struct1.center, SQUID_PARAMETERS, side=1) self.test_squids.append(test_jj) test_jj.place(self.region_el) # test structure with low critical current test_struct2 = TestStructurePads(struct_center + DPoint(0.3e6, 0)) test_struct2.place(self.region_ph) text_reg = pya.TextGenerator.default_generator().text( "9.66 nA", 0.001, 50, False, 0, 0) text_bl = test_struct2.empty_rectangle.origin + DPoint( test_struct2.gnd_gap, -4 * test_struct2.gnd_gap) text_reg.transform(ICplxTrans(1.0, 0, False, text_bl.x, text_bl.y)) self.region_ph -= text_reg test_jj = AsymSquidDCFlux(test_struct2.center, SQUID_PARAMETERS, side=-1) self.test_squids.append(test_jj) test_jj.place(self.region_el) # test structure for bridge DC contact test_struct3 = TestStructurePads(struct_center + DPoint(0.6e6, 0)) test_struct3.place(self.region_ph) text_reg = pya.TextGenerator.default_generator().text( "DC", 0.001, 50, False, 0, 0) text_bl = test_struct3.empty_rectangle.origin + DPoint( test_struct3.gnd_gap, -4 * test_struct3.gnd_gap) text_reg.transform( ICplxTrans(1.0, 0, False, test_struct3.center.x, text_bl.y)) self.region_ph -= text_reg test_bridges = [] for i in range(3): bridge = Bridge1(test_struct3.center + DPoint(50e3 * (i - 1), 0), gnd_touch_dx=20e3) test_bridges.append(bridge) bridge.place(self.region_bridges1, region_name="bridges_1") bridge.place(self.region_bridges2, region_name="bridges_2") # bandages test structures test_dc_el2_centers = [ DPoint(2.5e6, 2.4e6), DPoint(4.2e6, 1.6e6), DPoint(9.0e6, 3.8e6) ] for struct_center in test_dc_el2_centers: test_struct1 = TestStructurePads(struct_center) test_struct1.place(self.region_ph) text_reg = pya.TextGenerator.default_generator().text( "Bandage", 0.001, 40, False, 0, 0) text_bl = test_struct1.empty_rectangle.origin + DPoint( test_struct1.gnd_gap, -4 * test_struct1.gnd_gap) text_reg.transform(ICplxTrans(1.0, 0, False, text_bl.x, text_bl.y)) self.region_ph -= text_reg rec_width = 10e3 rec_height = test_struct1.rectangles_gap + 2 * rec_width p1 = struct_center - DVector(rec_width / 2, rec_height / 2) dc_rec = Rectangle(p1, rec_width, rec_height) dc_rec.place(self.region_el2)
rec3 = EmptyRectangle( DPoint(start.x - (CHIP.dx + 100e3) / 2, start.y + (CHIP.dy + 100e3) / 2 - 25e3), CHIP.dx + 100e3, 50e3) rec3.place(canvas) rec4 = EmptyRectangle( DPoint(start.x - (CHIP.dx + 100e3) / 2, start.y - (CHIP.dy + 100e3) / 2 + 25e3), CHIP.dx + 100e3, 50e3) rec4.place(canvas) #Text text_reg = pya.TextGenerator.default_generator().text( "RESONATORS " + str(i), 0.00008, 20, False, -0.5, 5) p0 = Vector(start.x - CHIP.dx / 8, start.y + CHIP.dy / 2 - 500e3) text_reg.transform(ICplxTrans(1.0, 0, False, p0)) canvas -= text_reg #Marks mark1 = AlignmentMark( DPoint(start.x - CHIP.dx / 2 + 500e3, start.y - CHIP.dy / 2 + 700e3)) mark1.place(canvas, region_name="photo") mark1.place(ebeam, region_name="ebeam") mark2 = AlignmentMark( DPoint(start.x - CHIP.dx / 2 + 500e3, start.y + CHIP.dy / 2 - 700e3)) mark2.place(canvas, region_name="photo") mark2.place(ebeam, region_name="ebeam") mark3 = AlignmentMark( DPoint(start.x + CHIP.dx / 2 - 500e3, start.y + CHIP.dy / 2 - 700e3))
pass else: cell = layout.create_cell("testScript") info = pya.LayerInfo(1, 0) info2 = pya.LayerInfo(2, 0) layer_ph = layout.layer(info) layer_el = layout.layer(info2) # clear this cell and layer cell.clear() # setting layout view lv.select_cell(cell.cell_index(), 0) lv.add_missing_layers() ### DRAW SECTION START ### X_SIZE = 200e3 Y_SIZE = 200e3 # Box drwaing START # box = pya.Box(0, 0, X_SIZE, Y_SIZE) box_reg = Region(box) text_reg = pya.TextGenerator.default_generator().text( "A TEXT", 0.001, 20, False, -0.5, 5) p0 = Vector(X_SIZE / 3, Y_SIZE / 3) text_reg.transform(ICplxTrans(1.0, 45, True, p0)) box_reg -= text_reg cell.shapes(layer_ph).insert(box_reg) ### DRAW SECTION END ### lv.zoom_fit()