示例#1
0
    def init_primitives(self):

        R_index = 0
        L_index = 0
        origin = DPoint(0,0)
        
        prev_primitive_end = origin
        prev_primitive_end_angle = 0
        
        for i, symbol in enumerate(self._shape_string):
                              
            if( symbol == 'R' ):
                if( self._turn_angles[R_index] > 0 ):
                    turn_radius = self._turn_radiuses[R_index]
                else:
                    turn_radius =-self._turn_radiuses[R_index]
                                        
                cpw_arc = CPW_arc(self._cpw_parameters[i], prev_primitive_end, 
                          turn_radius, self._turn_angles[R_index], 
                            trans_in = DCplxTrans(1, prev_primitive_end_angle*180/pi, False, 0, 0))
                
                self.primitives["arc_"+str(R_index)] = cpw_arc
                R_index += 1    
                
            elif symbol == 'L':
            
                # Turns are reducing segments' lengths so as if there were no roundings at all
                
                # next 'R' segment if exists
                if( i+1 < self._N_elements
                    and self._shape_string[i+1] == 'R' 
                    and abs(self._turn_angles[R_index]) < pi ):
                            coeff = abs(tan(self._turn_angles[R_index]/2))
                            self._segment_lengths[L_index] -= self._turn_radiuses[R_index]*coeff
                # previous 'R' segment if exists
                if( i-1 > 0
                    and self._shape_string[i-1] == 'R' 
                    and abs(self._turn_angles[R_index-1]) < pi ):    
                        coeff = abs(tan(self._turn_angles[R_index-1]/2))
                        self._segment_lengths[L_index] -= self._turn_radiuses[R_index-1]*coeff
                        
                #if( self._segment_lengths[L_index] < 0 ):
                #    print(self._segment_lengths[L_index])
                #    print("CPW_RL_Path warning: segment length is less than zero")
                #    print("L_index = {}".format(L_index))

                    
                cpw = CPW(self._cpw_parameters[i].width, self._cpw_parameters[i].gap,
                        prev_primitive_end, prev_primitive_end + DPoint(self._segment_lengths[L_index], 0),
                            trans_in=DCplxTrans(1, prev_primitive_end_angle*180/pi, False, 0, 0))
                            
                self.primitives["cpw_"+str(L_index)] = cpw
                L_index += 1 
            
            primitive = list(self.primitives.values())[i]
            prev_primitive_end = primitive.end
            prev_primitive_end_angle = primitive.alpha_end
                
        self.connections = [origin, list(self.primitives.values())[-1].end]
        self.angle_connections = [0, list(self.primitives.values())[-1].alpha_end]
示例#2
0
    def _init_primitives_trans(self):
        self.init_primitives()  # must be implemented in every subclass
        dr_origin = DSimplePolygon([DPoint(0, 0)])
        if (self.DCplxTrans_init is not None):
            # constructor trans displacement
            dCplxTrans_temp = DCplxTrans(1, 0, False,
                                         self.DCplxTrans_init.disp)
            for element in self.primitives.values():
                element.make_trans(dCplxTrans_temp)
            dr_origin.transform(dCplxTrans_temp)
            self._update_connections(dCplxTrans_temp)
            self._update_alpha(dCplxTrans_temp)

            # rest of the constructor trans functions
            dCplxTrans_temp = self.DCplxTrans_init.dup()
            dCplxTrans_temp.disp = DPoint(0, 0)
            for element in self.primitives.values():
                element.make_trans(dCplxTrans_temp)
            dr_origin.transform(dCplxTrans_temp)
            self._update_connections(dCplxTrans_temp)
            self._update_alpha(dCplxTrans_temp)

        dCplxTrans_temp = DCplxTrans(1, 0, False, self.origin)
        for element in self.primitives.values():
            element.make_trans(dCplxTrans_temp)  # move to the origin
        self._update_connections(dCplxTrans_temp)
        self._update_alpha(dCplxTrans_temp)
        self.origin += dr_origin.point(0)

        # FOLLOWING CYCLE GIVES WRONG INFO ABOUT FILLED AND ERASED AREAS
        for element in self.primitives.values():
            self.metal_region += element.metal_region
            self.empty_region += element.empty_region
	def init_primitives(self):
		origin = DPoint(0, 0)
		transition_end = origin + DPoint(self.transition_length, 0)
		alpha = self.z0_cpw.angle_connections[1]

		self.transition_cpw2cpw = CPW2CPW(
			self.z0_cpw, self.z1_params, origin, transition_end,
			trans_in=DCplxTrans(1, degrees(alpha), False, 0, 0)
		)
		self.primitives["transition_cpw2cpw"] = self.transition_cpw2cpw

		z1_cpw_end = self.transition_cpw2cpw.end + DPoint(self.z1_length, 0)
		self.z1_cpw = CPW(cpw_params=self.z1_params,
						  start=self.transition_cpw2cpw.end, end=z1_cpw_end,
						  trans_in=DCplxTrans(1, degrees(alpha), False, 0, 0))
		self.primitives["z1_cpw"] = self.z1_cpw

		# open-ended
		self.z1_cpw_open_end = CPW(
			0, gap=self.z1_params.b / 2,
			start=self.z1_cpw.end, end=self.z1_cpw.end + DPoint(self.z1_params.b / 2, 0),
			trans_in=DCplxTrans(1, degrees(alpha), False, 0, 0)
		)
		self.primitives["z1_cpw_open_end"] = self.z1_cpw_open_end

		self.connections = [self.transition_cpw2cpw.start, self.z1_cpw.end]
示例#4
0
    def init_primitives(self):
        R_index = 0
        L_index = 0
        origin = DPoint(0, 0)
        # placing the first element
        symbol_0 = self.RL_str[0]
        if (symbol_0 == 'R'):
            self.primitives["arc_0"] = CPW_arc(self.Z_list[0], origin,
                                               self.R_list[0],
                                               self.delta_alpha_list[0])
            R_index += 1
        elif (symbol_0 == 'L'):
            self.primitives["cpw_0"] = CPW(
                self.Z_list[0].width, self.Z_list[0].gap, self.start,
                self.start + DPoint(self.L_list[0], 0))
            L_index += 1

        for i, symbol in enumerate(self.RL_str):
            if (i == 0):
                continue

            prev_primitive = list(self.primitives.values())[i - 1]

            if (symbol == 'R'):
                if (self.delta_alpha_list[R_index] > 0):
                    sgn = 1
                else:
                    sgn = -1

                R = self.R_list[R_index] * sgn
                delta_alpha = self.delta_alpha_list[R_index]

                cpw_arc = CPW_arc(self.Z_list[i],
                                  prev_primitive.end,
                                  R,
                                  delta_alpha,
                                  trans_in=DCplxTrans(
                                      1, prev_primitive.alpha_end * 180 / pi,
                                      False, 0, 0))
                self.primitives["arc_" + str(R_index)] = cpw_arc
                R_index += 1

            elif (symbol == 'L'):
                cpw = CPW(self.Z_list[i].width,
                          self.Z_list[i].gap,
                          prev_primitive.end,
                          prev_primitive.end + DPoint(self.L_list[L_index], 0),
                          trans_in=DCplxTrans(
                              1, prev_primitive.alpha_end * 180 / pi, False, 0,
                              0))
                self.primitives["cpw_" + str(L_index)] = cpw
                L_index += 1
示例#5
0
    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()
示例#6
0
    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)
示例#7
0
    def init_primitives(self):
        origin = DPoint(0, 0)

        # square box that clears out the area of the mark
        self.primitives["empty_box"] = Rectangle(DPoint(
            -self.leaf_outer, -self.leaf_outer),
                                                 2 * self.leaf_outer,
                                                 2 * self.leaf_outer,
                                                 inverse=True)

        self.primitives["cross"] = Cross(
            DPoint(-self.cross_out_a / 2, -self.cross_out_a / 2),
            self.cross_in_a, self.cross_out_a)

        Z = CPWParameters(self.leaf_outer - self.leaf_inner, 0)

        for i in range(self.leafs_N):
            start_angle = i * (self.leaf_angle +
                               self.empty_leaf_angle) - self.leaf_angle / 2
            trans = DCplxTrans(1, start_angle + 90, False, 0, -self.avg_r)
            self.primitives["leaf_" + str(i)] = CPW_arc(Z,
                                                        origin,
                                                        self.avg_r,
                                                        self.leaf_angle * pi /
                                                        180,
                                                        trans_in=trans)

        Z_empty = CPWParameters(0, self.empty_rings_width / 2)
        for i in range(1, self.empty_rings_N + 1):
            r = self.leaf_inner + (self.leaf_outer - self.leaf_inner) / (
                self.empty_rings_N + 1) * i
            self.primitives["empty_ring_" + str(i)] = CPW_arc(
                Z_empty, DVector(0, -r), r, 2 * pi)
示例#8
0
    def __init__(self,
                 Z0,
                 start,
                 L_coupling,
                 L1,
                 r,
                 L2,
                 N,
                 gnd_width,
                 trans_in=None):
        self.Z0 = Z0
        self.gnd_width = gnd_width
        self.L_coupling = L_coupling
        self.L1 = L1
        self.r = r
        self.L2 = L2

        self.N = N
        self.primitives_gnd = {}
        super(EMResonator_TL2Qbit_worm, self).__init__(start, trans_in)
        self.init_primitives_gnd_trans()
        self.gnd_reg = Region()
        for elem in self.primitives_gnd.values():
            self.gnd_reg = self.gnd_reg + elem.metal_region
        for i in range(self.N):
            for elem in self.primitives["coil" +
                                        str(i + 1)].primitives_gnd.values():
                elem.make_trans(self.DCplxTrans_init)
                elem.make_trans(DCplxTrans(1, 0, False, self.origin))
                self.gnd_reg = self.gnd_reg + elem.metal_region
        self.start = self.connections[0]
        self.end = self.connections[-1]
        self.dr = self.end - self.start
        self.alpha_start = self.angle_connections[0]
        self.alpha_end = self.angle_connections[1]
示例#9
0
    def init_regions(self):
        self.connections = [DPoint(0, 0), DPoint(self.dr.abs(), 0)]
        self.angle_connections = [0, 0]
        alpha = atan2(self.dr.y, self.dr.x)
        self.angle_connections = [alpha, alpha]
        alpha_trans = DCplxTrans(1, alpha * 180 / pi, False, 0, 0)

        m_poly = DSimplePolygon([
            DPoint(0, -self.Z0.width / 2),
            DPoint(self.dr.abs(), -self.Z1.width / 2),
            DPoint(self.dr.abs(), self.Z1.width / 2),
            DPoint(0, self.Z0.width / 2)
        ])
        e_poly1 = DSimplePolygon([
            DPoint(0, -self.Z0.b / 2),
            DPoint(self.dr.abs(), -self.Z1.b / 2),
            DPoint(self.dr.abs(), -self.Z1.width / 2),
            DPoint(0, -self.Z0.width / 2)
        ])
        e_poly2 = DSimplePolygon([
            DPoint(0, self.Z0.b / 2),
            DPoint(self.dr.abs(), self.Z1.b / 2),
            DPoint(self.dr.abs(), self.Z1.width / 2),
            DPoint(0, self.Z0.width / 2)
        ])

        m_poly.transform(alpha_trans)
        e_poly1.transform(alpha_trans)
        e_poly2.transform(alpha_trans)

        self.metal_region.insert(SimplePolygon.from_dpoly(m_poly))
        self.empty_region.insert(SimplePolygon.from_dpoly(e_poly1))
        self.empty_region.insert(SimplePolygon.from_dpoly(e_poly2))
示例#10
0
    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']
示例#11
0
    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 _init_regions_trans( self ):
     self.init_regions()         # must be implemented in every subclass
     dr_origin = DSimplePolygon( [DPoint(0,0)] )
     if( self.DCplxTrans_init is not None ):
         # constructor trans displacement
         dCplxTrans_temp = DCplxTrans( 1,0,False, self.DCplxTrans_init.disp )
         self.make_trans( dCplxTrans_temp )
         dr_origin.transform( dCplxTrans_temp )
         
         # rest of the constructor trans functions
         dCplxTrans_temp = self.DCplxTrans_init.dup()
         dCplxTrans_temp.disp = DPoint(0,0)
         self.make_trans( dCplxTrans_temp )
         dr_origin.transform( dCplxTrans_temp )                  
         
     # translation to the old origin (self.connections are alredy contain proper values)
     self.make_trans( DCplxTrans( 1,0,False, self.origin ) ) # move to the origin
     self.origin += dr_origin.point( 0 )
示例#13
0
 def init_primitives( self ):
     self.arc1 = CPW_arc( self.Z0, DPoint(0,0), self.R1, pi/4 )
     self.cop1 = CPW( self.Z0.width, self.Z0.gap, self.arc1.end, self.arc1.end + DPoint( sin(pi/4), sin(pi/4) )*self.L1 )
     self.arc2 = CPW_arc( self.Z0, self.cop1.end, self.R2, pi/4, trans_in=DCplxTrans( 1,45,False,0,0 ) )
     self.cop2 = CPW( self.Z0.width, self.Z0.gap,  self.arc2.end, self.arc2.end + DPoint( 0,self.L2 ) )
     
     self.connections = [self.arc1.start,self.cop2.end]
     self.angle_connections = [self.arc1.alpha_start, self.cop2.alpha_end]
     
     self.primitives = {"arc1":self.arc1, "cop1":self.cop1, "arc2":self.arc2, "cop2":self.cop2}
示例#14
0
 def init_primitives_gnd_trans( self ):
     dr_origin = DSimplePolygon( [DPoint(0,0)] )
     if( self.DCplxTrans_init is not None ):
         # constructor trans displacement
         dCplxTrans_temp = DCplxTrans( 1,0,False, self.DCplxTrans_init.disp )
         for element in self.primitives_gnd.values():
             element.make_trans( dCplxTrans_temp )
         dr_origin.transform( dCplxTrans_temp )
         
         # rest of the constructor trans functions
         dCplxTrans_temp = self.DCplxTrans_init.dup()
         dCplxTrans_temp.disp = DPoint(0,0)
         for element in self.primitives_gnd.values():
             element.make_trans( dCplxTrans_temp )
         dr_origin.transform( dCplxTrans_temp )
     
     dCplxTrans_temp = DCplxTrans( 1,0,False, self.origin )
     for element in self.primitives_gnd.values():    
         element.make_trans( dCplxTrans_temp ) # move to the origin
示例#15
0
    def init_primitives(self):

        origin = DPoint(0, 0)

        self.c_wave = CWave(origin,
                            self.r_out,
                            self.dr,
                            self.n_semiwaves,
                            self.s,
                            self.alpha,
                            self.r_curve,
                            n_pts=self.n_pts_cwave)
        self.primitives["c_wave"] = self.c_wave

        Z1_start = origin + DPoint(0, self.r_in + self.gap1 + self.width1 / 2)
        Z1_end = Z1_start + DPoint(0, -self.gap1 - self.width1 / 2 + self.dr)
        self.cpw1 = CPW(self.Z1.width, self.Z1.gap, Z1_start, Z1_end)
        self.primitives["cpw1"] = self.cpw1

        Z2_start = origin - DPoint(0, self.r_in + self.gap2 + self.width2 / 2)
        Z2_end = Z2_start - DPoint(0, -self.gap2 - self.width2 / 2 + self.dr)
        self.cpw2 = CPW(self.Z2.width, self.Z2.gap, Z2_start, Z2_end)
        self.primitives["cpw2"] = self.cpw2

        self.c_wave_2_cpw_adapter = CWave2CPW(self.c_wave,
                                              self.params[7:15],
                                              n_pts=self.n_pts_arcs)
        self.primitives["c_wave_2_cpw_adapter"] = self.c_wave_2_cpw_adapter

        p_squid = None
        squid_trans_in = None

        if (self.c_wave.n_segments % 2 == 1):
            squid_trans_in = DCplxTrans(1, self.c_wave.alpha * 180 / pi, False,
                                        0, 0)
            p_squid = origin
        else:
            squid_trans_in = None

            second_parity = self.c_wave.n_segments / 2
            y_shift = self.c_wave.L0 * sin(
                self.c_wave.alpha) - self.c_wave.r_curve * (
                    1 / cos(self.c_wave.alpha) - 1)
            if (second_parity % 2 == 0):
                p_squid = origin + DPoint(0, y_shift)
            else:
                p_squid = origin + DPoint(0, -y_shift)

        self.squid = Squid(p_squid, self.squid_params, trans_in=squid_trans_in)
        self.primitives["qubit"] = self.squid

        self.connections = [Z1_end, Z2_end]
        self.angle_connections = [pi / 2, 3 / 2 * pi]
示例#16
0
    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, DPoint(0, self.R)]
        self.angle_connections = [self.alpha_start, self.alpha_end]
        self.start = DPoint(0, 0)
        self.end = self.dr
        self.center = DPoint(0, self.R)

        n_inner = 10
        n_outer = 10

        metal_arc = self._get_solid_arc(self.center, self.R, self.width,
                                        self.alpha_start - pi / 2,
                                        self.alpha_end - pi / 2, n_inner,
                                        n_outer)

        empty_arc1 = self._get_solid_arc(self.center,
                                         self.R - (self.width + self.gap) / 2,
                                         self.gap, self.alpha_start - pi / 2,
                                         self.alpha_end - pi / 2, n_inner,
                                         n_outer)

        empty_arc2 = self._get_solid_arc(self.center,
                                         self.R + (self.width + self.gap) / 2,
                                         self.gap, self.alpha_start - pi / 2,
                                         self.alpha_end - pi / 2, n_inner,
                                         n_outer)

        self.metal_regions["photo"].insert(
            SimplePolygon().from_dpoly(metal_arc))
        self.empty_regions["photo"].insert(
            SimplePolygon().from_dpoly(empty_arc1))
        self.empty_regions["photo"].insert(
            SimplePolygon().from_dpoly(empty_arc2))

        bridge_pos = self.center + DPoint(sin(self.delta_alpha / 2),
                                          -cos(self.delta_alpha / 2)) * self.R

        ab = Airbridge(bridge_pos,
                       trans_in=DCplxTrans(1, self.delta_alpha / 2 * 180 / pi,
                                           False, 0, 0))
        self.metal_regions["bridges"] += ab.metal_regions["bridges"]
        self.metal_regions["bridge_patches"] += ab.metal_regions[
            "bridge_patches"]
 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()
示例#18
0
    def init_primitives(self):
        center = DPoint(0, 0)

        self.empty_circle = Circle(center, self.ring1_outer_r + self.ring1_thickness, inverse=True)
        self.primitives["empty_circle"] = self.empty_circle

        # outer ring
        self.ring1 = Ring(center, self.ring1_outer_r, self.ring1_thickness)
        self.primitives["ring1"] = self.ring1

        # inner ring
        self.ring2 = Ring(center, self.ring2_outer_r, self.ring2_thickness)
        self.primitives["ring2"] = self.ring2

        ## four aim lines ##
        center_shift = self.aim_lines_width/3
        line_length = self.ring1_outer_r - self.ring1_thickness/2 - center_shift
        # left horizontal line
        p1 = center + DPoint(-center_shift, 0)
        p2 = p1 + DPoint(-line_length, 0)
        self.left_aim_line = CPW(self.aim_lines_width, 0, p1, p2)
        self.primitives["left_aim_line"] = self.left_aim_line

        # bottom vertical line
        p1 = center + DPoint(0, -center_shift)
        p2 = p1 + DPoint(0, -line_length)
        self.bottom_aim_line = CPW(self.aim_lines_width, 0, p1, p2)
        self.primitives["bottom_aim_line"] = self.bottom_aim_line

        # right horizontal line
        p1 = center + DPoint(center_shift, 0)
        p2 = p1 + DPoint(line_length, 0)
        self.right_aim_line = CPW(self.aim_lines_width, 0, p1, p2)
        self.primitives["right_aim_line"] = self.right_aim_line

        # top vertical line
        p1 = center + DPoint(0, center_shift)
        p2 = p1 + DPoint(0, line_length)
        self.top_aim_line = CPW(self.aim_lines_width, 0, p1, p2)
        self.primitives["top_aim_line"] = self.top_aim_line

        # center romb for better aiming
        self.center_romb = Rectangle(
            center,
            self.aim_lines_width, self.aim_lines_width,
            trans_in=DCplxTrans(1, 45, False, -self.aim_lines_width/2, -self.aim_lines_width/2),
            inverse=True
        )
        self.primitives["center_romb"] = self.center_romb

        self.connections = [center]
示例#19
0
    def init_primitives(self):
        self.connections = [DPoint(0, 0), self.dr]
        self.angle_connections = [0, 0]

        self.coplanar1 = CPW(self.width, self.gap, DPoint(0, 0),
                             DPoint(0, 0) + DPoint(self.L1, 0), self.gndWidth)
        self.arc1 = CPWArc(self.coplanar1, self.coplanar1.end, self.R1,
                           self.gamma, self.gndWidth, Trans(Trans.M0))
        self.coplanar2 = CPW(
            self.width, self.gap, self.arc1.end, self.arc1.end +
            DPoint(cos(self.gamma), -sin(self.gamma)) * self.L2, self.gndWidth)
        self.arc2 = CPWArc(self.coplanar1, self.coplanar2.end, self.R2,
                           self.gamma, self.gndWidth,
                           DCplxTrans(1, -self.gamma * 180 / pi, False, 0, 0))
        self.coplanar3 = CPW(self.width, self.gap, self.arc2.end,
                             self.arc2.end + DPoint(L3, 0), self.gndWidth)
        self.arc3 = CPWArc(self.coplanar1, self.coplanar3.end, self.R2,
                           self.gamma, self.gndWidth)
        self.coplanar4 = CPW(
            self.width, self.gap, self.arc3.end,
            self.arc3.end + DPoint(cos(self.gamma), sin(self.gamma)) * self.L2,
            self.gndWidth)
        self.arc4 = CPWArc(self.coplanar1, self.coplanar4.end, self.R1,
                           self.gamma, self.gndWidth,
                           DCplxTrans(1, self.gamma * 180 / pi, True, 0, 0))
        self.coplanar5 = CPW(self.width, self.gap, self.arc4.end,
                             self.arc4.end + DPoint(self.L1, 0), self.gndWidth)
        self.primitives = {
            "coplanar1": self.coplanar1,
            "arc1": self.arc1,
            "coplanar2": self.coplanar2,
            "arc2": self.arc2,
            "coplanar3": self.coplanar3,
            "arc3": self.arc3,
            "coplanar4": self.coplanar4,
            "arc4": self.arc4,
            "coplanar5": self.coplanar5
        }
示例#20
0
    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()
示例#21
0
    def __init__(self, origin, params, trans_in=None):

        self.params = params
        self.a = params[0]
        self.b = params[1]
        self.jos1_b = params[2]
        self.jos1_a = params[3]
        self.f1 = params[4]
        self.d1 = params[5]
        self.jos2_b = params[6]
        self.jos2_a = params[7]
        self.f2 = params[8]
        self.d2 = params[9]
        self.w = params[10]
        self.B1_width = params[11]
        self.B1_height = params[12]
        self.B2_height = params[13]
        self.B5_height = params[14]
        self.B6_width = params[15]
        self.B6_height = params[16]
        self.B7_width = params[17]
        self.B7_height = params[18]
        self.dCap = params[19]
        self.gap = params[20]

        # calculated parameters
        self.B2_width = (self.gap - self.dCap - self.B6_width / 2 -
                         4 * self.w - self.jos1_a - self.jos2_a) / 2
        self.B5_width = self.B2_width
        self.B3_width = self.a + self.jos1_a / 2 - self.jos2_a / 2 - self.w
        self.B4_width = self.a + self.jos2_a / 2 - self.jos1_a / 2 - self.w
        self._alpha_1 = 0.5
        self._length1 = (self.b + 2 * self.w + self.jos1_b)
        self._alpha_2 = 0.5
        self._length2 = (self.b + 2 * self.w - 2 * self.f2 - self.jos2_b
                         )  #length

        self.p0 = DPoint(0, 0)
        self.p1 = self.p0 + DPoint(self.dCap, 0)
        self.p2 = self.p1 + DPoint(self.B1_width,
                                   (self.B1_height - self.B2_height) / 2)
        self.p3 = self.p2 + DPoint(self.B2_width, self.B2_height)
        self.p4 = self.p3 + DPoint(self.w, -self.w)
        self.p5 = self.p4 + DPoint(self.B3_width, self.w)
        self.p6 = self.p5 - DPoint(0, self.f2 + self._length2 * self._alpha_2)
        self.p7 = self.p6 + DPoint(2 * self.w + self.jos2_a, -self.jos2_b)
        self.p8 = self.p7 - DPoint(
            0, self.f2 + (1 - self._alpha_2) * self._length2)
        self.p9 = self.p8 - DPoint(self.B4_width + self.w, 0)
        self.p10 = self.p8 + DPoint(self.B5_width,
                                    (self.B5_height - self.B6_height) / 2)
        self.p11 = self.p10 + DPoint(self.B6_width,
                                     (self.B6_height - self.B7_height) / 2)

        self.B1 = pya.DBox(self.p1,
                           self.p1 + DPoint(self.B1_width, self.B1_height))
        self.B2 = pya.DBox(self.p2, self.p3)
        self.B3 = pya.DBox(self.p4, self.p5)
        self.B4 = pya.DBox(self.p9, self.p9 + DPoint(self.B4_width, self.w))
        self.B5 = pya.DBox(self.p8,
                           self.p8 + DPoint(self.B5_width, self.B5_height))
        self.B6 = pya.DBox(self.p10,
                           self.p10 + DPoint(self.B6_width, self.B6_height))
        self.B7 = pya.DBox(self.p11,
                           self.p11 + DPoint(self.B7_width, self.B7_height))

        self.poly_1 = self._make_polygon(self._length1 * self._alpha_1, self.w,
                                         self.d1, self.f1, self.jos1_b)
        self.poly_1.transform(DCplxTrans(1.0, 270, False, self.p3))
        self.poly_2 = self._make_polygon(self._length1 * (1 - self._alpha_1),
                                         self.w, self.d1, self.f1, self.jos1_b)
        self.poly_2.transform(DCplxTrans(1.0, 90, False, self.p9))
        self.poly_3 = self._make_polygon(self._length2 * self._alpha_2, self.w,
                                         self.d2, self.f2, self.jos2_b)
        self.poly_3.transform(DCplxTrans(1.0, 270, False, self.p5))
        self.poly_4 = self._make_polygon(2 * self.jos2_b + self.f2, self.w,
                                         self.d2, self.f2, self.jos2_b)
        self.poly_4.transform(DCplxTrans(1.0, 90, False, self.p7))
        self.poly_5 = self._make_polygon(2 * self.jos2_b + self.f2, self.w,
                                         self.d2, self.f2, self.jos2_b)
        self.poly_5.transform(DCplxTrans(1.0, 270, False, self.p6))
        self.poly_6 = self._make_polygon((1 - self._alpha_2) * self._length2,
                                         self.w, self.d2, self.f2, self.jos2_b)
        self.poly_6.transform(DCplxTrans(1.0, 90, False, self.p8))
        super().__init__(origin, trans_in)
示例#22
0
    def __init__(self, origin, params, trans_in=None):
        self.params = params
        self.a = params[0]
        self.b = params[1]
        self.jos1_b = params[2]
        self.jos1_a = params[3]
        self.f1 = params[4]
        self.d1 = params[5]
        self.jos2_b = params[6]
        self.jos2_a = params[7]
        self.f2 = params[8]
        self.d2 = params[9]
        self.w = params[10]
        self.dCap = params[11]
        self.gap = params[12]
        self.square_a = params[13]
        self.dSquares = params[14]
        self.alum_over = params[15]
        self.B1_width = params[16]

        # calculated parameters
        self.B2_width = self.a + self.jos1_a / 2 - self.jos2_a / 2 - self.w
        self.qbit_width = 2 * self.w + self.B2_width
        self.B3_width = self.a + self.jos2_a / 2 - self.jos1_a / 2 - self.w
        self.B1_height = (self.dSquares - 2 * self.w - self.b) / 2
        self._alpha_1 = 0.5
        self._length1 = (self.b + 2 * self.w + self.jos1_b)
        self._alpha_2 = 0.5
        self._length2 = (self.b + 2 * self.w - 2 * self.f2 - self.jos2_b
                         )  #length

        self.p0 = DPoint(0, 0)
        self.p1 = self.p0 - DPoint(0, self.dCap + self.square_a)
        self.p2 = self.p1 + DPoint(self.square_a / 2 - self.qbit_width / 2,
                                   -(self.dCap + self.B1_height))
        self.p3 = self.p2 + DPoint(self.qbit_width - self.w, 0)
        self.p4 = self.p2 + DPoint(self.w, -self.w)
        self.p5 = self.p3 - DPoint(0, self.f2 + self._length2 * self._alpha_2)
        self.p6 = self.p5 + DPoint(2 * self.w + self.jos2_a, -self.jos2_b)
        self.p7 = self.p6 - DPoint(
            0, self.f2 + (1 - self._alpha_2) * self._length2)
        self.p8 = self.p7 - DPoint(self.w + self.B3_width, 0)
        self.p9 = self.p7 - DPoint(
            self.w + (self.qbit_width + self.B3_width) / 2, self.B1_height)
        self.p10 = self.p1 - DPoint(
            0, self.square_a + self.b + 2 * self.B1_height + 2 * self.w)

        self.SQ1 = pya.DBox(self.p1,
                            self.p1 + DPoint(self.square_a, self.square_a))
        self._B1p1 = self.p2 + DPoint(self.qbit_width / 2 - self.B1_width / 2,
                                      0)
        self.B1 = pya.DBox(
            self._B1p1, self._B1p1 +
            DPoint(self.B1_width, self.B1_height + self.alum_over))
        self.B2 = pya.DBox(self.p4, self.p3)
        self.B3 = pya.DBox(self.p8, self.p8 + DPoint(self.B3_width, self.w))
        self._B4p1 = self.p9 + DPoint(self.qbit_width / 2 - self.B1_width / 2,
                                      -self.alum_over)
        self.B4 = pya.DBox(
            self._B4p1, self._B4p1 +
            DPoint(self.B1_width, self.B1_height + self.alum_over))
        self.SQ2 = pya.DBox(self.p10,
                            self.p10 + DPoint(self.square_a, self.square_a))

        self.poly_1 = self._make_polygon(self._length1 * self._alpha_1, self.w,
                                         self.d1, self.f1, self.jos1_b)
        self.poly_1.transform(DCplxTrans(1.0, 270, False, self.p2))
        self.poly_2 = self._make_polygon(self._length1 * (1 - self._alpha_1),
                                         self.w, self.d1, self.f1, self.jos1_b)
        self.poly_2.transform(DCplxTrans(1.0, 90, False, self.p8))
        self.poly_3 = self._make_polygon(self._length2 * self._alpha_2, self.w,
                                         self.d2, self.f2, self.jos2_b)
        self.poly_3.transform(DCplxTrans(1.0, 270, False, self.p3))
        self.poly_4 = self._make_polygon(2 * self.jos2_b + self.f2, self.w,
                                         self.d2, self.f2, self.jos2_b)
        self.poly_4.transform(DCplxTrans(1.0, 90, False, self.p6))
        self.poly_5 = self._make_polygon(2 * self.jos2_b + self.f2, self.w,
                                         self.d2, self.f2, self.jos2_b)
        self.poly_5.transform(DCplxTrans(1.0, 270, False, self.p5))
        self.poly_6 = self._make_polygon((1 - self._alpha_2) * self._length2,
                                         self.w, self.d2, self.f2, self.jos2_b)
        self.poly_6.transform(DCplxTrans(1.0, 90, False, self.p7))
        super().__init__(origin, trans_in)
示例#23
0
    def __init__(self, origin, params, trans_in=None):
        self.params = params
        self.a = params[0]
        self.b = params[1]
        self.jos1_b = params[2]
        self.jos1_a = params[3]
        self.f1 = params[4]
        self.d1 = params[5]
        self.jos2_b = params[6]
        self.jos2_a = params[7]
        self.f2 = params[8]
        self.d2 = params[9]
        self.w = params[10]
        self.dCap = params[11]
        self.gap = params[12]
        self.square_a = params[13]
        self.dSquares = params[14]
        self.alum_over = params[15]
        self.B1_width = params[16]

        # calculated parameters
        self.B2_width = self.a + self.jos1_a / 2 - self.jos2_a / 2 - self.w
        self.qbit_width = 2 * self.w + self.B2_width
        self.B3_width = self.b - self.jos2_a / 2 - self.jos1_a / 2 - 2 * self.w
        self.B1_height = (self.dSquares - 2 * self.w - self.b) / 2
        self._alpha_1 = 0.5
        self._length1 = (self.b + 2 * self.w + self.jos1_b)
        self._alpha_2 = 0.5
        self._length2 = (self.b + 2 * self.w - 2 * self.f2 - self.jos2_b
                         )  #length

        self._length_right = (self.b + 2 * self.w - 2 * self.jos2_b) / 3
        self.p0 = DPoint(0, 0)
        self.p1 = self.p0 - DPoint(0, self.dCap + self.square_a)
        self.p2 = self.p1 + DPoint(self.square_a / 2 - self.qbit_width / 2,
                                   -(self.dCap + self.B1_height))
        self.p3 = self.p2 + DPoint(self.qbit_width - self.w, 0)
        self.p4 = self.p2 + DPoint(self.w, -self.w)
        self.p5 = self.p3 + DPoint(2 * self.w + self.jos2_a,
                                   -(2 * self._length_right + 2 * self.jos2_b))
        self.p6 = self.p3 - DPoint(0, self.b + 2 * self.w)
        self.p7 = self.p6 - DPoint(self.B3_width, 0)
        self.p8 = self.p7 - DPoint(self.w, self.B1_height)
        self.p9 = self.p1 - DPoint(
            0, self.square_a + self.b + 2 * self.B1_height + 2 * self.w)

        self.SQ1 = pya.DBox(self.p1,
                            self.p1 + DPoint(self.square_a, self.square_a))
        self._B1p1 = self.p2 + DPoint(
            (self.B2_width + 2 * self.w) / 2 - self.B1_width / 2, 0)
        self.B1 = pya.DBox(
            self._B1p1, self._B1p1 +
            DPoint(self.B1_width, self.B1_height + self.alum_over))
        self.B2 = pya.DBox(self.p4, self.p3)
        self.B3 = pya.DBox(self.p7, self.p7 + DPoint(self.B3_width, self.w))
        self._B4p1 = self.p8 + DPoint(
            (self.B3_width + 2 * self.w) / 2 - self.B1_width / 2,
            -self.alum_over)
        self.B4 = pya.DBox(
            self._B4p1, self._B4p1 +
            DPoint(self.B1_width, self.B1_height + self.alum_over))
        self.SQ2 = pya.DBox(self.p9,
                            self.p9 + DPoint(self.square_a, self.square_a))

        self.poly_1 = self._make_polygon(self._length1 * self._alpha_1, self.w,
                                         self.d1, self.f1, self.jos1_b)
        self.poly_1.transform(DCplxTrans(1.0, 270, False, self.p2))
        self.poly_2 = self._make_polygon(self._length1 * (1 - self._alpha_1),
                                         self.w, self.d1, self.f1, self.jos1_b)
        self.poly_2.transform(DCplxTrans(1.0, 90, False, self.p7))
        self.poly_3 = self._make_polygon(self._length_right + self.jos2_b,
                                         self.w, self.d2, self.f2, self.jos2_b)
        self.poly_3.transform(DCplxTrans(1.0, 270, False, self.p3))

        self.poly_4 = self._make_polygon(
            self._length_right + self.jos2_b - self.f2, self.w, self.d2,
            self.f2, self.jos2_b)
        self.poly_4.transform(
            DCplxTrans(
                1.0, 270, True, self.p5 +
                DPoint(0, self._length_right + self.jos2_b - self.f2)))
        _poly_tmp = self._make_polygon(
            self._length_right + self.jos2_b - self.f2, self.w, self.d2,
            self.f2, self.jos2_b)
        _poly_tmp.transform(
            DCplxTrans(1.0, 90, False,
                       self.p5 + DPoint(0, self.jos2_b + self.f2)))
        _reg_tmp4 = Region()
        _reg_tmp4.insert(SimplePolygon().from_dpoly(self.poly_4))
        _reg_tmp = Region()
        _reg_tmp.insert(SimplePolygon().from_dpoly(_poly_tmp))
        self._reg_tmp_to_metal = (_reg_tmp + _reg_tmp4).merged()

        self.poly_5 = self._make_polygon(self._length_right + self.jos2_b,
                                         self.w, self.d2, self.f2, self.jos2_b)
        self.poly_5.transform(DCplxTrans(1.0, 90, True, self.p6))
        super().__init__(origin, trans_in)
        worm = EMResonator_TL2Qbit_worm(Z_res, point, L_coupling[i], L1[i], r,
                                        L2, N)
        worm.place(cell, layer_photo)
        resonators.append(worm)

        dy_qbit = (worm.cop_tail.dr.abs() - square_a) / 2
        qbit_params = [
            a[i], b[i], jos1_b, jos1_a, f1, d1, jos2_b, jos2_a, f2, d2, w,
            dCap, gap, square_a, dSquares, alum_over, B1_width
        ]
        dy_qbit = (worm.cop_tail.dr.abs() - square_a) / 2
        qbit_start = worm.end + DPoint(B1_width / 2, 0)
        qbit = QBit_Flux_Сshunted_3JJ(
            worm.end + DPoint(qbit_coupling_gap + Z_res.width / 2, dy_qbit),
            qbit_params, DCplxTrans(1, 90, False, 0, 0))
        qbit_bbox = pya.DBox().from_ibox(qbit.metal_regions["photo"].bbox())
        p1 = qbit.origin + DPoint(-qbit_coupling_gap, qbit.square_a / 2)
        p2 = p1 + DPoint(qbit_bbox.width() + qbit_coupling_gap + qbit_gnd_gap,
                         0)
        empty = CPW(0, (square_a + 2 * qbit_gnd_gap) / 2, p1, p2)
        empty.place(cell, layer_photo)
        empties.append(empty)

        qbit.place(cell, layer_photo, layer_el)
        qbits.append(qbit)

    # place top array of resonators with qBits
    N_top = N_bottom - 1
    delta = 1e6
    step_top = step_bot
示例#25
0
    def init_primitives(self):

        R_index = 0
        L_index = 0
        origin = DPoint(0, 0)

        prev_primitive_end = origin
        prev_primitive_end_angle = 0

        for i, symbol in enumerate(self._shape_string):

            if symbol == 'R':
                turn_radius = self._turn_radiuses[R_index] \
                    if self._turn_angles[R_index] > 0 \
                    else -self._turn_radiuses[R_index]
                if self._bridged:
                    cpw_arc = BridgedCPWArc(self._cpw_parameters[i],
                                            prev_primitive_end,
                                            turn_radius,
                                            self._turn_angles[R_index],
                                            200e3,
                                            trans_in=DCplxTrans(
                                                1, prev_primitive_end_angle *
                                                180 / pi, False, 0, 0))
                else:
                    cpw_arc = CPW_arc(self._cpw_parameters[i],
                                      prev_primitive_end,
                                      turn_radius,
                                      self._turn_angles[R_index],
                                      trans_in=DCplxTrans(
                                          1,
                                          prev_primitive_end_angle * 180 / pi,
                                          False, 0, 0))

                self.primitives["arc_" + str(R_index)] = cpw_arc
                R_index += 1

            elif symbol == 'L':

                # Turns are reducing segments' lengths so as if there were no roundings at all
                if i + 1 < self._N_elements \
                        and self._shape_string[i + 1] == 'R' \
                        and abs(self._turn_angles[R_index]) < pi:
                    coeff = abs(tan(self._turn_angles[R_index] / 2))
                    self._segment_lengths[
                        L_index] -= self._turn_radiuses[R_index] * coeff

                if i - 1 > 0 \
                        and self._shape_string[i - 1] == 'R' \
                        and abs(self._turn_angles[R_index - 1]) < pi:
                    coeff = abs(tan(self._turn_angles[R_index - 1] / 2))
                    self._segment_lengths[L_index] -= self._turn_radiuses[
                        R_index - 1] * coeff

                if self._bridged:
                    cpw = BridgedCPW(self._cpw_parameters[i].width,
                                     self._cpw_parameters[i].gap,
                                     200e3,
                                     prev_primitive_end,
                                     prev_primitive_end +
                                     DPoint(self._segment_lengths[L_index], 0),
                                     trans_in=DCplxTrans(
                                         1,
                                         prev_primitive_end_angle * 180 / pi,
                                         False, 0, 0))
                else:
                    cpw = CPW(self._cpw_parameters[i].width,
                              self._cpw_parameters[i].gap,
                              prev_primitive_end,
                              prev_primitive_end +
                              DPoint(self._segment_lengths[L_index], 0),
                              trans_in=DCplxTrans(
                                  1, prev_primitive_end_angle * 180 / pi,
                                  False, 0, 0))

                self.primitives["cpw_" + str(L_index)] = cpw
                L_index += 1

            primitive = list(self.primitives.values())[i]
            prev_primitive_end = primitive.end
            prev_primitive_end_angle = primitive.alpha_end

        self.connections = [
            list(self.primitives.values())[0].start,
            list(self.primitives.values())[-1].end
        ]
        self.angle_connections = [
            list(self.primitives.values())[0].alpha_start,
            list(self.primitives.values())[-1].alpha_end
        ]
class Element_Base():
    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_regions( self ):
        raise NotImplementedError
    
    # first it makes trans_init displacement
    # then the rest of the trans_init
    # then displacement of the current state to the origin
    # after all, origin should be updated
    def _init_regions_trans( self ):
        self.init_regions()         # must be implemented in every subclass
        dr_origin = DSimplePolygon( [DPoint(0,0)] )
        if( self.DCplxTrans_init is not None ):
            # constructor trans displacement
            dCplxTrans_temp = DCplxTrans( 1,0,False, self.DCplxTrans_init.disp )
            self.make_trans( dCplxTrans_temp )
            dr_origin.transform( dCplxTrans_temp )
            
            # rest of the constructor trans functions
            dCplxTrans_temp = self.DCplxTrans_init.dup()
            dCplxTrans_temp.disp = DPoint(0,0)
            self.make_trans( dCplxTrans_temp )
            dr_origin.transform( dCplxTrans_temp )                  
            
        # translation to the old origin (self.connections are alredy contain proper values)
        self.make_trans( DCplxTrans( 1,0,False, self.origin ) ) # move to the origin
        self.origin += dr_origin.point( 0 )
        
    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 _update_connections( self, dCplxTrans ):       
        if( dCplxTrans is not None ):
            # the problem is, if k construct polygon with multiple points
            # their order in poly_temp.each_point() doesn't coinside with the 
            # order of the list that was passed to the polygon constructor
            # so, when k perform transformation and try to read new values through poly_temp.each_point()
            # they values are rearranged
            # solution is: k need to create polygon for each point personally, and the initial order presists
            for i,pt in enumerate(self.connections):
                poly_temp = DSimplePolygon( [pt] )
                poly_temp.transform( dCplxTrans )
                self.connections[i] = poly_temp.point( 0 )
    
    def _update_alpha( self, dCplxTrans ):
        if( dCplxTrans is not None ):
            dCplxTrans_temp = dCplxTrans.dup()
            dCplxTrans_temp.disp = DPoint(0,0)
            
            for i,alpha in enumerate(self.angle_connections):
                poly_temp = DSimplePolygon( [DPoint( cos(alpha), sin(alpha) )] )
                poly_temp.transform( dCplxTrans_temp )
                pt = poly_temp.point( 0 )
                self.angle_connections[i] = atan2( pt.y, pt.x )
    
    def _update_origin( self, dCplxTrans ):
        if( dCplxTrans is not None ):     
            poly_temp = DSimplePolygon( [self.origin] )
            poly_temp.transform( dCplxTrans )
            self.origin = poly_temp.point( 0 )
    
    def place( self, dest, layer_i=-1, region_name=None ):
        r_cell = None
        if( layer_i != -1 ): 
            metal_region = None
            empty_region = None
            if( region_name == None ):
                metal_region = self.metal_region
                empty_region = self.empty_region
            else:
                metal_region = self.metal_regions[region_name]
                empty_region = self.empty_regions[region_name]

            r_cell = Region( dest.begin_shapes_rec( layer_i ) )        
            temp_i = dest.layout().layer( pya.LayerInfo(PROGRAM.LAYER1_NUM,0) ) 
            dest.shapes( temp_i ).insert( r_cell + metal_region  - empty_region )
            dest.layout().clear_layer( layer_i )
            dest.layout().move_layer( temp_i, layer_i )
            dest.layout().delete_layer( temp_i )
        if( layer_i == -1 ): # dest is interpreted as instance of Region() class
            for metal_region,empty_region in zip(self.metal_regions.values(),self.empty_regions.values()):
                dest += metal_region
                dest -= empty_region
示例#27
0
    def bridgify_CPW(cpw,
                     bridges_step,
                     cell=None,
                     bridge_layer1=-1,
                     bridge_layer2=-1):
        """
            Function puts bridge patterns to fabricate bridges on coplanar waveguide
        `cpw` with bridges having period of `bridges_step` along coplanar's wave
        propagation direction.
            Bridges are distributed over coplanar starting with its center.

        Parameters
        ----------
        cpw : Union[CPW, CPW_arc, CPW_RL_Path]
            instance of coplanar class to be bridged during fabrication
        bridges_step : float
            distance between centers of bridges in nm
        cell : pya.Cell
            cell to place bridge polygons at
        bridge_layer1 : int
            index of the layer in the `cell` with ground touching polygons
        bridge_layer2 : int
            index of the layer in the `cell` with empty polygons

        Returns
        -------
        None
        """
        if isinstance(cpw, CPW):
            cpw_center = cpw.start + cpw.end
            alpha = atan2(cpw.dr.y, cpw.dr.x)
            cpw_len = cpw.dr.abs()
            cpw_dir_unit_vector = cpw.dr / cpw.dr.abs()

            # bridge with some initial dimensions
            tmp_bridge = Bridge1(DPoint(0, 0))
            bridge_width = tmp_bridge.gnd_touch_dx + 2 * tmp_bridge.surround_gap

            # number of additional bridges on either side of center
            additional_bridges_n = int(
                (cpw_len / 2 - bridge_width / 2) // bridges_step)
            bridge_centers = []
            for i in range(-additional_bridges_n, additional_bridges_n + 1):
                bridge_centers.append(cpw.start +
                                      (cpw_len / 2 + i * bridges_step) *
                                      cpw_dir_unit_vector)

            bridges = []
            for center in bridge_centers:
                bridges.append(
                    Bridge1(center,
                            trans_in=DCplxTrans(1, alpha / pi * 180, False, 0,
                                                0)))
            for bridge in bridges:
                bridge.place(dest=cell,
                             layer_i=bridge_layer1,
                             region_name="bridges_1")
                bridge.place(dest=cell,
                             layer_i=bridge_layer2,
                             region_name="bridges_2")
        elif isinstance(cpw, CPW_arc):
            # to be implemented
            pass
        elif isinstance(cpw, CPW_RL_Path):
            for primitive in cpw.primitives.values():
                if isinstance(primitive, CPW):
                    Bridge1.bridgify_CPW(primitive, bridges_step, cell,
                                         bridge_layer1, bridge_layer2)
        else:
            # do nothing for other shapes
            return
示例#28
0
    lv.add_missing_layers()

    ### DRAW SECTION START ###
    origin = DPoint(0, 0)

    # Chip drwaing START #
    chip = pya.DBox(origin, DPoint(CHIP.dx, CHIP.dy))
    cell.shapes(layer_ph).insert(pya.Box().from_dbox(chip))
    # Chip drawing END #

    # Path test drawing START #
    RL_str = "RLRLR"
    Z0 = CPW(12.2e3, 6.2e3)
    Z_list = [Z0]
    R_list = [0.5e6]
    L_list = [0.2e6]
    delta_alpha_list = [pi / 4, -pi / 4, -pi]
    start = origin
    path = CPW_RL_Path(start,
                       RL_str,
                       Z_list,
                       R_list,
                       L_list,
                       delta_alpha_list,
                       trans_in=DCplxTrans(1, 45, False, 0, 0))
    path.place(cell, layer_ph)
    # Path test drawing END #

    ### DRAW SECTION END ###

    lv.zoom_fit()
示例#29
0
    jos1_a = 0.1e3
    f1 = 0.13e3
    d1 = 0.05e3
    jos2_b = 0.8e3
    jos2_a = 0.09e3
    f2 = 0.25e3
    d2 = d1
    w = 0.2e3
    B1_width = 7.325e3
    B1_height = 2.405e3
    B2_width = 0.6e3
    B5_width = 0.4e3
    B6_width = 2.5e3
    B6_height = 10e3
    B7_width = 5.051e3
    B7_height = 4.076e3
    dCap = 0
    gap = 25e3

    qbit_params = [
        a, b, jos1_b, jos1_a, f1, d1, jos2_b, jos2_a, f2, d2, w, B1_width,
        B1_height, B2_width, B5_width, B6_width, B6_height, B7_width,
        B7_height, dCap, gap
    ]
    qbit = QBit_Flux_3(DPoint(dCap, 0), qbit_params,
                       DCplxTrans(1, 0, False, 0, 0))
    qbit.place(cell, layer_i)

    ### DRAW SECTION END ###
    lv.zoom_fit()
    ### DRAW SECTION START ###
    origin = DPoint(1e6,0)
    a = 4.6e3
    b = 4.6e3
    jos1_b = 0.32e3
    jos1_a = 0.1e3
    f1 = 0.13e3
    d1 = 0.05e3
    jos2_b = 0.8e3
    jos2_a = 0.09e3
    f2 = 0.25e3
    d2 = d1
    w = 0.2e3
    dCap = 0
    dSquares = 30e3
    gap = 25e3
    square_a = 150e3
    alum_over = 20e3
    B1_width = 3e3

    qbit_params = [a,b,
                            jos1_b,jos1_a,f1,d1,
                            jos2_b,jos2_a,f2,d2,
                            w, dCap,gap, square_a, dSquares, alum_over, B1_width]
    qbit = QBit_Flux_Сshuted( DPoint(1e6,1e6), qbit_params, DCplxTrans( 1,0,False,0,0 ) )
    print( qbit.origin )
    qbit.place( cell, layer_photo, layer_el )
    ### DRAW SECTION END ###
    
    lv.zoom_fit()