Esempio n. 1
0
    def _init_primitives(self):

        N, R = self._meander_periods, self._turn_radius

        # meander_period = 2*meander_length + 2piR
        # self._length = coupling_length + (2piR/4 + offset_length + 2piR/4 + meander_length)
        # + N*meander_period + 2piR/2 + (meander_length/2 - R) + 2piR/4 + neck_length

        meander_length = (self._length - self._coupling_length \
            - self._offset_length - 2*2*pi*R/4 \
            -N*2*pi*R - 2*pi*R/2 + R - 2*pi*R/4 - self._neck_length)/(2*N+3/2)
        #        print(meander_length)

        shape = "LRLRL" + N * "RLRL" + "RLRL"


        segment_lengths = [self._coupling_length + R, self._offset_length + 2*R]\
             + [meander_length+R] + 2*N*[meander_length] \
             + [meander_length/2, self._neck_length+R]

        turn_angles = [pi / 2, pi / 2] + N * [-pi, pi] + [-pi, pi / 2]

        #        print(sum([abs(turn_angle) for turn_angle in turn_angles])/pi)
        #        print(sum(segment_lengths) +\
        #             R*sum([abs(turn_angle) for turn_angle in turn_angles])-6*R)
        #        print(self._length)
        #        print(segment_lengths)

        self._line = CPW_RL_Path(
            DPoint(0, 0),
            shape,
            self._cpw_parameters,
            self._turn_radius,
            segment_lengths,
            turn_angles,
            DTrans(DPoint(-self._coupling_length + meander_length / 2, 0)),
            bridged=False)
        # print("Connections[0] 1:", self._line.connections[0])
        # print("Primitive_start:", list(self._line.primitives.values())[0].connections[0])
        self._line.make_trans(self._trans_in)
        self._line.make_trans(DTrans(self._origin))
        # print("Primitive_start:", )
        # print("Connections[0] 2:", self._line.connections[0])

        self.start = list(self._line.primitives.values())[0].connections[0]
        self.end = list(self._line.primitives.values())[-1].connections[-1]
        self.alpha_start =\
                    list(self._line.primitives.values())[0].angle_connections[0]
        self.alpha_end =\
                    list(self._line.primitives.values())[-1].angle_connections[-1]
 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()
Esempio n. 3
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()
Esempio n. 4
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()
            max_distance = 0
            port_pt = None
            edge_p1, edge_p2 = None, None
            for poly in reg1.each():
                for edge in poly.each_edge():
                    edge_center = (edge.p1 + edge.p2) / 2
                    d = edge_center.distance(xmonCross.center)
                    if d > max_distance:
                        max_distance = d
                        port_pt = edge_center
                        edge_p1 = edge.p1
                        edge_p2 = edge.p2

            design.sonnet_ports[0] = port_pt
        design.transform_region(design.region_ph,
                                DTrans(dr.x, dr.y),
                                trans_ports=True)

        design.show()
        design.lv.zoom_fit()
        ### DRAWING SECTION END ###

        ### MATLAB COMMANDER SECTION START ###
        ml_terminal = SonnetLab()
        # print("starting connection...")
        from sonnetSim.cMD import CMD

        ml_terminal._send(CMD.SAY_HELLO)
        ml_terminal.clear()
        simBox = SimulationBox(crop_box.width(), crop_box.height(),
                               crop_box.width() / resolution_dx,
Esempio n. 6
0
resonators_x_positions_l = cp2.end.x - feed_cpw_params.b/2 - res_cpw_params.b/2 -resonator_offsets
resonators_x_positions_r = cp2.end.x + feed_cpw_params.b/2 + res_cpw_params.b/2 +resonator_offsets

for i in range(-(chain_length)//2, (chain_length)//2, 1):
  coupling_length = 200e3
  if np.mod(i,2)==0:
    trans_in = DTrans.R90
    resonators_x_positions = resonators_x_positions_l
  else:
    trans_in = DTrans.R270
    resonators_x_positions = resonators_x_positions_r
  res_cursor = DPoint(resonators_x_positions, i*resonators_interval+resonators_interval/2)
  claw = Claw(DPoint(0,0), res_cpw_params, 0e3, w_claw = 0e3, w_claw_pad=0e3, l_claw_pad = 0e3, trans_in = trans_in)
  res = CPWResonator(res_cursor, res_cpw_params, 40e3, 6+i/10, 11.45, coupling_length=250e3,
                                    meander_periods = 5, trans_in = trans_in)
  claw.make_trans(DTrans(res.end))
  claw.place(canvas)
  res.place(canvas)


#end

ebeam = ebeam.merge()
canvas = Region(ground) - canvas
cell.shapes( layer_photo ).insert(canvas)
cell.shapes( layer_el ).insert(ebeam)
cell.shapes( layer_patch ).insert(patch)
cell.shapes( layer_litho ).insert(litho)
cell.shapes( layer_bridge ).insert(bridges)
cell.shapes( layer_bridge_patches ).insert(bridge_patches)
lv.zoom_fit()