示例#1
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 )
示例#2
0
 def init_regions(self):
     origin = DPoint(0, 0)
     dx = (self.b - self.t) / 2
     p1 = origin + DPoint(dx, self.h)
     p2 = p1 + DPoint(self.t, 0)
     p3 = p2 + DPoint(dx, -self.h)
     pts_arr = [origin, p1, p2, p3]
     if self.inverse:
         self.empty_region.insert(SimplePolygon().from_dpoly(DSimplePolygon(pts_arr)))
     else:
         self.metal_region.insert(SimplePolygon().from_dpoly(DSimplePolygon(pts_arr)))
示例#3
0
 def init_regions(self):
     origin = DPoint(0, 0)
     p1 = origin + DPoint(self.width, 0)
     self.p2 = p1 + DPoint(0, self.height)
     p3 = self.p2 + DPoint(-self.width, 0)
     pts_arr = [origin, p1, self.p2, p3]
     if self.inverse:
         self.empty_region.insert(SimplePolygon(DSimplePolygon(pts_arr)))
     else:
         self.metal_region.insert(SimplePolygon(DSimplePolygon(pts_arr)))
     self.connections = [origin, self.p2]
示例#4
0
 def init_regions(self):
     origin = DPoint(0, 0)
     p1 = origin + DPoint(self.a, 0)
     p2 = p1 + DPoint(0, self.b)
     p3 = p2 + DPoint(-self.a, 0)
     pts_arr = [origin, p1, p2, p3]
     if self.inverse:
         self.empty_region.insert(SimplePolygon().from_dpoly(DSimplePolygon(pts_arr)))
     else:
         self.metal_region.insert(SimplePolygon().from_dpoly(DSimplePolygon(pts_arr)))
     self.connections = [origin]
 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 )
示例#6
0
 def init_regions(self):
     dpts_arr = [
         DPoint(self.r * cos(2 * pi * i / self.n_pts),
                self.r * sin(2 * pi * i / self.n_pts))
         for i in range(0, self.n_pts)
     ]
     if (self.solid == True):
         self.metal_region.insert(SimplePolygon().from_dpoly(
             DSimplePolygon(dpts_arr)))
     else:
         self.empty_region.insert(SimplePolygon().from_dpoly(
             DSimplePolygon(dpts_arr)))
示例#7
0
    def init_regions( self ):
        d_alpha = (self.alpha_end - self.alpha_start)/(self.n_pts - 1)
        alphas = [(self.alpha_start + d_alpha*i) for i in range(0,self.n_pts)]
        dpts_arr = [DPoint(self.r*cos(alpha),self.r*sin(alpha)) for alpha in alphas]
        dpts_arr.append( DPoint(0,0) )

        if( self.solid == True ):
            self.metal_region.insert( SimplePolygon().from_dpoly( DSimplePolygon(dpts_arr) ) )
        else:
            self.empty_region.insert( SimplePolygon().from_dpoly( DSimplePolygon(dpts_arr) ) )
        self.connections.extend([self._center, self._center+DVector(0, -self.r)])
        self.angle_connections.extend([0,0])
示例#8
0
 def init_regions( self ):
     origin = DPoint(0,0)
     Rin = self.r - self.t
     Rout = self.r
     dpts_arr_Rout = [DPoint(Rout * cos(2 * pi * i / self.n_pts), Rout * sin(2 * pi * i / self.n_pts)) for i in range(0, self.n_pts)]
     dpts_arr_Rin = [DPoint(Rin * cos(2 * pi * i / self.n_pts), Rin * sin(2 * pi * i / self.n_pts)) for i in range(0, self.n_pts)]
     outer_circle = Region(SimplePolygon().from_dpoly(DSimplePolygon(dpts_arr_Rout)))
     inner_circle = Region(SimplePolygon().from_dpoly(DSimplePolygon(dpts_arr_Rin)))
     ring = outer_circle - inner_circle
     #self.metal_region.insert(ring)   
     #if self.inverse:
     self.empty_region = ring
示例#9
0
    def init_regions(self):

        w_res, g_res = self._resonator_cpw_params.width, self._resonator_cpw_params.gap
        w_protect_pad = self._w_claw_pad + g_res * 2
        protect_aperture = self._claw_aperture + 2 * self._w_thin_ground
        protect_width = protect_aperture + 2 * w_protect_pad
        l_claw_pad = self._l_claw_pad
        w_claw = self._w_claw

        protect_points = [
            DPoint(0, -g_res),
            DPoint(-protect_width / 2, -g_res),
            DPoint(-protect_width / 2, w_claw + l_claw_pad + g_res),
            DPoint(-protect_width / 2 + w_protect_pad,
                   w_claw + l_claw_pad + g_res),
            DPoint(-protect_width / 2 + w_protect_pad, w_claw + g_res),
            DPoint(protect_width / 2 - w_protect_pad, w_claw + g_res),
            DPoint(protect_width / 2 - w_protect_pad,
                   w_claw + l_claw_pad + g_res),
            DPoint(protect_width / 2, w_claw + l_claw_pad + g_res),
            DPoint(protect_width / 2, -g_res)
        ]

        protect_region = Region(DSimplePolygon(protect_points))

        metal_points = [
            DPoint(0, 0),
            DPoint(-protect_width / 2 + g_res, 0),
            DPoint(-protect_width / 2 + g_res, w_claw + l_claw_pad),
            DPoint(-protect_width / 2 + w_protect_pad - g_res,
                   w_claw + l_claw_pad),
            DPoint(-protect_width / 2 + w_protect_pad - g_res, w_claw),
            DPoint(protect_width / 2 - w_protect_pad + g_res, w_claw),
            DPoint(protect_width / 2 - w_protect_pad + g_res,
                   w_claw + l_claw_pad),
            DPoint(protect_width / 2 - g_res, w_claw + l_claw_pad),
            DPoint(protect_width / 2 - g_res, 0)
        ]

        metal_poly = DSimplePolygon(metal_points)
        self.metal_region.insert(metal_poly)

        empty_region = protect_region - self.metal_region

        self.empty_region.insert(empty_region)

        self.connections = [
            DPoint(0, 0),
            DPoint(0, w_claw + g_res + self._w_thin_ground)
        ]
示例#10
0
    def init_regions(self):

        self.metal_regions["bridges"] = Region()
        self.metal_regions["bridge_patches"] = Region()
        self.empty_regions["bridges"] = Region()
        self.empty_regions["bridge_patches"] = Region()

        patch_x = 20e3
        patch_y = 10e3
        patch_pos_y = 35e3

        l1 = 23e3
        l2 = 8e3
        l3 = 22e3
        w = 20e3

        bridge_points = [
            DPoint(-w / 2, l1),
            DPoint(-w / 2 - l2, l1 + l2),
            DPoint(-w / 2 - l2, l1 + l2 + l3),
            DPoint(w / 2 + l2, l1 + l2 + l3),
            DPoint(w / 2 + l2, l1 + l2),
            DPoint(w / 2, l1),
            DPoint(w / 2, -l1),
            DPoint(w / 2 + l2, -l1 - l2),
            DPoint(w / 2 + l2, -l1 - l2 - l3),
            DPoint(-w / 2 - l2, -l1 - l2 - l3),
            DPoint(-w / 2 - l2, -l1 - l2),
            DPoint(-w / 2, -l1)
        ]

        bridge_poly = DSimplePolygon(bridge_points)
        self.metal_regions["bridges"].insert(bridge_poly)

        rec1_points = [
            DPoint(patch_x / 2, patch_pos_y),
            DPoint(patch_x / 2, patch_pos_y + patch_y),
            DPoint(-patch_x / 2, patch_pos_y + patch_y),
            DPoint(-patch_x / 2, patch_pos_y)
        ]
        rec2_points = [
            DPoint(patch_x / 2, -patch_pos_y),
            DPoint(patch_x / 2, -(patch_pos_y + patch_y)),
            DPoint(-patch_x / 2, -(patch_pos_y + patch_y)),
            DPoint(-patch_x / 2, -patch_pos_y)
        ]
        rec1_poly = DSimplePolygon(rec1_points)
        rec2_poly = DSimplePolygon(rec2_points)
        self.metal_regions["bridge_patches"].insert(rec1_poly)
        self.metal_regions["bridge_patches"].insert(rec2_poly)
示例#11
0
 def init_regions(self):
     dpts_arr = [
         DPoint(self.r * cos(2 * pi * i / self.n_pts + self._offset_angle),
                self.r * sin(2 * pi * i / self.n_pts + self._offset_angle))
         for i in range(0, self.n_pts)
     ]
     if (self.solid == True):
         self.metal_region.insert(SimplePolygon().from_dpoly(
             DSimplePolygon(dpts_arr)))
     else:
         self.empty_region.insert(SimplePolygon().from_dpoly(
             DSimplePolygon(dpts_arr)))
     self.connections.extend(
         [self.center, self.center + DVector(0, -self.r)])
     self.angle_connections.extend([0, 0])
示例#12
0
    def _get_solid_arc(self, center, R, width, alpha_start, alpha_end, n_inner,
                       n_outer):
        pts = []
        #        print(alpha_start/pi, alpha_end/pi, cos( alpha_start ), cos( alpha_end ),
        #                         sin(alpha_start), sin(alpha_end))

        if alpha_end > alpha_start:
            alpha_start = alpha_start - 1e-3
            alpha_end = alpha_end + 1e-3
        else:
            alpha_start = alpha_start + 1e-3
            alpha_end = alpha_end - 1e-3

        d_alpha_inner = (alpha_end - alpha_start) / (n_inner - 1)
        d_alpha_outer = -(alpha_end - alpha_start) / (n_outer - 1)

        #        print("Center:", center)

        for i in range(0, n_inner):
            alpha = alpha_start + d_alpha_inner * i
            pts.append(center + DPoint(cos(alpha), sin(alpha)) *
                       (R - width / 2))
        for i in range(0, n_outer):
            alpha = alpha_end + d_alpha_outer * i
            pts.append(center + DPoint(cos(alpha), sin(alpha)) *
                       (R + width / 2))
        #        print("Points:", pts[:n_inner],"\n       ", pts[n_inner:], "\n")
        return DSimplePolygon(pts)
示例#13
0
    def transform_layer(self, layer_i, trans, trans_ports=False):
        """
        Performs transofmation of the layer desired.

        Parameters
        ----------
        layer_i : int
            layer index, >0
        trans : Union[DcplxTrans, DTrans]
            transformation to perform
        trans_ports : bool
            If `True` also performs transform of `self.sonnet_ports`
            as they are vectors.

        Returns
        -------
        None
        """
        r_cell = Region(self.cell.begin_shapes_rec(layer_i))

        r_cell.transform(trans)

        temp_i = self.cell.layout().layer(pya.LayerInfo(PROGRAM.LAYER1_NUM, 0))
        self.cell.shapes(temp_i).insert(r_cell)
        self.cell.layout().clear_layer(layer_i)
        self.cell.layout().move_layer(temp_i, layer_i)
        self.cell.layout().delete_layer(temp_i)

        if trans_ports:
            self.sonnet_ports = list(
                DSimplePolygon(
                    self.sonnet_ports).transform(trans).each_point())
示例#14
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)
示例#15
0
    def init_regions(self):

        if self._ebeam:
            dw = 2e3 * 4
        else:
            dw = 3e3 * 4

        w = 2e3 * 4

        l = (w * 7 + dw * 6) / 2

        lengths = [
            3e3 * 4, 6e3 * 4, 8e3 * 4, 9e3 * 4, 8e3 * 4, 6e3 * 4, 3e3 * 4
        ]

        empty_points = [
            DPoint(0, -l),
            DPoint(0, l),
            DPoint(9e3 * 4, l),
            DPoint(9e3 * 4, -l)
        ]
        empty_poly = DSimplePolygon(empty_points)
        empty_region = Region(empty_poly)

        l0 = -l

        metal_region = Region(DSimplePolygon([]))

        for l1 in lengths:
            metal1 = Region(
                DSimplePolygon([
                    DPoint(0, l0),
                    DPoint(0, l0 + w),
                    DPoint(l1, l0 + w),
                    DPoint(l1, l0)
                ]))

            metal_region += metal1
            l0 = l0 + w + dw

        self.metal_region.insert(metal_region)

        self.empty_region.insert(empty_region - metal_region)

        self.connections = [DPoint(0, 0), DPoint(0, 0)]
        self.angle_connections = [pi, 0]
示例#16
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
示例#17
0
    def init_regions(self):

        w_pad, g_pad = self._pad_cpw_params["w"], self._pad_cpw_params["g"]
        w_feed, g_feed = self._feedline_cpw_params[
            "w"], self._feedline_cpw_params["g"]
        x, y = self._ground_connector_width + self._back_gap, 0

        metal_points = [
            DPoint(x, y + w_pad / 2),
            DPoint(x + self._pad_length, y + w_pad / 2),
            DPoint(x + self._pad_length + self._transition_length,
                   y + w_feed / 2),
            DPoint(x + self._pad_length + self._transition_length,
                   y - w_feed / 2),
            DPoint(x + self._pad_length, y - w_pad / 2),
            DPoint(x, y - w_pad / 2)
        ]
        metal_poly = DSimplePolygon(metal_points)

        self.metal_region.insert(metal_poly)

        protect_points = [
            DPoint(x - self._back_gap, y + w_pad / 2 + g_pad),
            DPoint(x + self._pad_length, y + w_pad / 2 + g_pad),
            DPoint(x + self._pad_length + self._transition_length,
                   y + w_feed / 2 + g_feed),
            DPoint(x + self._pad_length + self._transition_length,
                   y - w_feed / 2 - g_feed),
            DPoint(x + self._pad_length, y - w_pad / 2 - g_pad),
            DPoint(x - self._back_gap, y - w_pad / 2 - g_pad)
        ]

        protect_poly = DSimplePolygon(protect_points)
        protect_region = Region(protect_poly)

        empty_region = protect_region - self.metal_region

        self.empty_region.insert(empty_region)

        self.connections = [
            DPoint(0, 0),
            DPoint(x + self._pad_length + self._transition_length, 0)
        ]
        self.angle_connections = [pi, 0]
示例#18
0
    def init_regions(self):
        origin = DPoint(0, 0)
        dpts_arr = [DPoint(self.r * cos(2 * pi * i / self.n_pts + self._offset_angle),
                           self.r * sin(2 * pi * i / self.n_pts + self._offset_angle)) for i in range(0, self.n_pts)]
        circle_polygon = SimplePolygon().from_dpoly(DSimplePolygon(dpts_arr))
        if self.inverse:
            self.empty_region.insert(circle_polygon)
        else:
            self.metal_region.insert(circle_polygon)

        self.connections.extend([origin, origin + DVector(0, -self.r)])
        self.angle_connections.extend([0, 0])
示例#19
0
    def _make_polygon(self, length, w, d, f, overlapping):
        polygon = DSimplePolygon
        p1 = DPoint(0, 0)
        p2 = p1 + DPoint(length, 0)
        p3 = p2 + DPoint(0, w)
        p4 = p3 - DPoint(overlapping, 0)
        p5 = p4 - DPoint(0, d)
        p6 = p5 - DPoint(f, 0)
        p7 = p6 + DPoint(0, d)
        p8 = p1 + DPoint(0, w)

        polygon = DSimplePolygon([p1, p2, p3, p4, p5, p6, p7, p8])
        return polygon
示例#20
0
    def _get_solid_arc(self, center, R, width, alpha_start, alpha_end, n_inner, n_outer):
        pts = []

        d_alpha_inner = (alpha_end - alpha_start) / (n_inner - 1)
        d_alpha_outer = -(alpha_end - alpha_start) / (n_outer - 1)

        for i in range(0, n_inner):
            alpha = alpha_start + d_alpha_inner * i
            pts.append(center + DPoint(cos(alpha), sin(alpha)) * (R - width / 2))
        for i in range(0, n_outer):
            alpha = alpha_end + d_alpha_outer * i
            pts.append(center + DPoint(cos(alpha), sin(alpha)) * (R + width / 2))

        return DSimplePolygon(pts)
	def init_regions(self):
		w_fc, g_fc = self._fc_cpw_params.width, self._fc_cpw_params.gap

		empty_points = [DPoint(w_fc / 2, 0),
						DPoint(w_fc / 2, w_fc),
						DPoint(-self._width / 2, w_fc),
						DPoint(-self._width / 2, w_fc + g_fc),
						DPoint(self._width / 2, w_fc + g_fc),
						DPoint(self._width / 2, w_fc),
						DPoint(w_fc / 2 + g_fc, w_fc),
						DPoint(w_fc / 2 + g_fc, 0)]

		empty_region = Region(DSimplePolygon(empty_points))
		self.empty_region.insert(empty_region)

		self.connections = [DPoint(0, 0), DPoint(0, w_fc + g_fc)]
示例#22
0
    def init_regions(self):

        metal_points = [
            DPoint(0, self._y / 2),
            DPoint(self._x, self._y / 2),
            DPoint(self._x, -self._y / 2),
            DPoint(0, -self._y / 2)
        ]

        metal_poly = DSimplePolygon(metal_points)
        self.metal_region.insert(metal_poly)

        self.empty_region.insert(self.metal_region)

        self.connections = [DPoint(0, 0), DPoint(self._x, 0)]
        self.angle_connections = [pi, 0]
 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 )
示例#24
0
    def transform_region(self, reg, trans, trans_ports=False):
        """
        Performs transofmation of the layer desired.

        Parameters
        ----------
        reg : int
            layer index, >0
        trans : Union[DcplxTrans, DTrans]
            transformation to perform
        trans_ports : bool
            If `True` also performs transform of `self.sonnet_ports`
            as they are vectors.

        Returns
        -------
        None
        """
        reg.transform(trans)

        if trans_ports:
            self.sonnet_ports = list(
                DSimplePolygon(
                    self.sonnet_ports).transform(trans).each_point())
示例#25
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
示例#26
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))
    def init_regions(self):

        metal_points = [
            DPoint(
                0, self._width_in / 2 + self._width + self._width_empty * 2 +
                10e3),
            DPoint(
                20e3 + self._width_empty_end + self._length,
                self._width_in / 2 + self._width + self._width_empty * 2 +
                10e3),
            DPoint(
                20e3 + self._width_empty_end + self._length,
                -(self._width_in / 2 + self._width + self._width_empty * 2 +
                  10e3)),
            DPoint(
                0, -(self._width_in / 2 + self._width + self._width_empty * 2 +
                     10e3))
        ]

        metal_poly = DSimplePolygon(metal_points)
        self.metal_region.insert(metal_poly)

        metal1_points = [
            DPoint(self._width_empty_end,
                   self._width_in / 2 + self._width_empty + 10e3),
            DPoint(self._width_empty_end, self._width_in / 2 +
                   self._width_empty + self._width + 10e3),
            DPoint(10e3 + self._width_empty_end + self._length,
                   self._width_in / 2 + self._width_empty + self._width +
                   10e3),
            DPoint(10e3 + self._width_empty_end + self._length,
                   self._width_in / 2),
            DPoint(20e3 + self._width_empty_end + self._length,
                   self._width_in / 2),
            DPoint(20e3 + self._width_empty_end + self._length,
                   -self._width_in / 2),
            DPoint(10e3 + self._width_empty_end + self._length,
                   -self._width_in / 2),
            DPoint(
                10e3 + self._width_empty_end + self._length,
                -(self._width_in / 2 + self._width_empty + self._width +
                  10e3)),
            DPoint(
                self._width_empty_end,
                -(self._width_in / 2 + self._width_empty + self._width +
                  10e3)),
            DPoint(self._width_empty_end,
                   -(self._width_in / 2 + self._width_empty + 10e3)),
            DPoint(
                10e3 + self._width_empty_end + self._length - self._width_in,
                -(self._width_in / 2 + self._width_empty + 10e3)),
            DPoint(
                10e3 + self._width_empty_end + self._length - self._width_in,
                self._width_in / 2 + self._width_empty + 10e3)
        ]

        metal1_poly = DSimplePolygon(metal1_points)
        metal1_reg = Region(metal1_poly)

        metal2_points = [
            DPoint(0, self._width_in / 2),
            DPoint(
                self._width_empty_end + self._length - self._width_in -
                self._width_empty, self._width_in / 2),
            DPoint(
                self._width_empty_end + self._length - self._width_in -
                self._width_empty, -self._width_in / 2),
            DPoint(0, -self._width_in / 2)
        ]

        metal2_poly = DSimplePolygon(metal2_points)
        metal2_reg = Region(metal2_poly)

        metal3_points = [
            DPoint(0, self._width_in / 2 + self._width_empty),
            DPoint(0, self._width_in / 2 + self._width_empty + 5e3),
            DPoint(self._width_empty_end + self._length + 5e3 - self._width_in,
                   self._width_in / 2 + self._width_empty + 5e3),
            DPoint(self._width_empty_end + self._length + 5e3 - self._width_in,
                   -(self._width_in / 2 + self._width_empty + 5e3)),
            DPoint(0, -(self._width_in / 2 + self._width_empty + 5e3)),
            DPoint(0, -(self._width_in / 2 + self._width_empty)),
            DPoint(self._width_empty_end + self._length - self._width_in,
                   -(self._width_in / 2 + self._width_empty)),
            DPoint(self._width_empty_end + self._length - self._width_in,
                   self._width_in / 2 + self._width_empty)
        ]

        metal3_poly = DSimplePolygon(metal3_points)
        metal3_reg = Region(metal3_poly)

        self.empty_region.insert(self.metal_region - metal1_reg - metal2_reg -
                                 metal3_reg)

        self.connections = [
            DPoint(0, 0),
            DPoint(self._length + self._width_empty_end + 20e3, 0)
        ]
        self.angle_connections = [pi, 0]
示例#28
0
    def init_regions(self):

        p1y = 0.5 * (self._width_empty_begin * 2 +
                     (self._fingers * 4 + 3) * self._width)
        p3y = 0.5 * (self._width_end + 2 * self._width_empty_end)
        metal_points = [
            DPoint(0, p1y),
            DPoint(self._length + 20e3 + self._width, p1y),
            DPoint(self._length + 20e3 + 100e3 + self._width, p3y),
            DPoint(self._length + 20e3 + 100e3 + self._width, -p3y),
            DPoint(self._length + 20e3 + self._width, -p1y),
            DPoint(0, -p1y)
        ]
        metal_poly = DSimplePolygon(metal_points)
        self.metal_region.insert(metal_poly)

        metal1_points = [
            DPoint(0, 0.5 * (self._fingers * 4 + 3) * self._width),
            DPoint(10e3, 0.5 * (self._fingers * 4 + 3) * self._width),
            DPoint(10e3, (0.5 * (self._fingers * 4 + 3) - 2) * self._width)
        ]
        py_last = (0.5 * (self._fingers * 4 + 3) - 2) * self._width
        for k in range(self._fingers):
            metal1_points.append(DPoint(10e3 + self._length, py_last))
            metal1_points.append(
                DPoint(10e3 + self._length, py_last - self._width))
            metal1_points.append(DPoint(10e3, py_last - self._width))
            metal1_points.append(DPoint(10e3, py_last - 4 * self._width))
            py_last = py_last - 4 * self._width
        metal1_points.append(DPoint(10e3 + self._length, py_last))
        metal1_points.append(DPoint(10e3 + self._length,
                                    py_last - self._width))
        metal1_points.append(DPoint(0, py_last - self._width))

        metal1_poly = DSimplePolygon(metal1_points)
        metal1_reg = Region(metal1_poly)

        metal2_points = [
            DPoint(self._length + 20e3 + 100e3 + self._width,
                   self._width_end / 2),
            DPoint(self._length + 20e3 + self._width,
                   0.5 * (self._fingers * 4 + 3) * self._width),
            DPoint(self._width + 10e3,
                   0.5 * (self._fingers * 4 + 3) * self._width),
            DPoint(self._width + 10e3,
                   (0.5 * (self._fingers * 4 + 3) - 1) * self._width)
        ]
        py_last = (0.5 * (self._fingers * 4 + 3) - 1) * self._width
        for k in range(self._fingers):
            metal2_points.append(
                DPoint(self._width + 10e3 + self._length, py_last))
            metal2_points.append(
                DPoint(self._width + 10e3 + self._length,
                       py_last - 3 * self._width))
            metal2_points.append(
                DPoint(self._width + 10e3, py_last - 3 * self._width))
            metal2_points.append(
                DPoint(self._width + 10e3, py_last - 4 * self._width))
            py_last = py_last - 4 * self._width
        metal2_points.append(DPoint(self._width + 10e3 + self._length,
                                    py_last))
        metal2_points.append(
            DPoint(self._width + 10e3 + self._length,
                   py_last - 2 * self._width))
        metal2_points.append(
            DPoint(self._width + 10e3 + self._length + 10e3,
                   py_last - 2 * self._width))
        metal2_points.append(
            DPoint(self._length + 20e3 + self._width + 100e3,
                   -self._width_end / 2))

        metal2_poly = DSimplePolygon(metal2_points)
        metal2_reg = Region(metal2_poly)

        self.empty_region.insert(self.metal_region - metal1_reg - metal2_reg)

        self.connections = [
            DPoint(0, 0),
            DPoint(self._length + 20e3 + 100e3 + self._width, 0)
        ]
        self.angle_connections = [pi, 0]
 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 )
示例#30
0
    def init_regions(self):
        self.metal_regions["bridges_1"] = Region(
        )  # region with ground contacts
        self.empty_regions["bridges_1"] = Region()  # remains empty

        self.metal_regions["bridges_2"] = Region()  # remains empty
        self.empty_regions["bridges_2"] = Region(
        )  # region with erased bridge area

        center = DPoint(0, 0)
        self.connections = [center]
        self.angle_connections = [0]

        # init metal region of ground touching layer
        top_gnd_center = center + DPoint(
            0, self.gnd2gnd_dy / 2 + self.gnd_touch_dy / 2)
        p1 = top_gnd_center + DPoint(-self.gnd_touch_dx / 2,
                                     -self.gnd_touch_dy / 2)
        p2 = p1 + DVector(self.gnd_touch_dx, self.gnd_touch_dy)
        top_gnd_touch_box = pya.DBox(p1, p2)
        self.metal_regions["bridges_1"].insert(
            pya.Box().from_dbox(top_gnd_touch_box))

        bot_gnd_center = center + DPoint(
            0, -(self.gnd2gnd_dy / 2 + self.gnd_touch_dy / 2))
        p1 = bot_gnd_center + DPoint(-self.gnd_touch_dx / 2,
                                     -self.gnd_touch_dy / 2)
        p2 = p1 + DVector(self.gnd_touch_dx, self.gnd_touch_dy)
        bot_gnd_touch_box = pya.DBox(p1, p2)
        self.metal_regions["bridges_1"].insert(
            pya.Box().from_dbox(bot_gnd_touch_box))

        # init empty region for second layout layer
        # points start from left-bottom corner and goes in clockwise direction
        p1 = bot_gnd_touch_box.p1 + DPoint(-self.surround_gap,
                                           -self.surround_gap)
        p2 = p1 + DPoint(
            0, self.surround_gap + self.gnd_touch_dy + self.transition_len -
            self.surround_gap)
        # top left corner + `surrounding_gap` + `transition_length`
        p3 = bot_gnd_touch_box.p1 + DPoint(0, bot_gnd_touch_box.height()) + \
             DPoint(0, self.transition_len)
        bl_pts_list = [p1, p2, p3]  # bl stands for bottom-left
        ''' exploiting symmetry of reflection at x and y axes. '''
        # reflecting at x-axis
        tl_pts_list = list(map(lambda x: DTrans.M0 * x,
                               bl_pts_list))  # tl stands for top-left
        # preserving order
        tl_pts_list = reversed(
            list(tl_pts_list))  # preserving clockwise points order
        # converting iterator to list
        l_pts_list = list(itertools.chain(bl_pts_list,
                                          tl_pts_list))  # l stands for left

        # reflecting all points at y-axis
        r_pts_list = list(map(lambda x: DTrans.M90 * x, l_pts_list))
        r_pts_list = list(
            reversed(r_pts_list))  # preserving clockwise points order

        # gathering points
        pts_list = l_pts_list + r_pts_list  # concatenating proper ordered lists

        empty_polygon = DSimplePolygon(pts_list)
        self.empty_regions["bridges_2"].insert(
            SimplePolygon.from_dpoly(empty_polygon))