コード例 #1
0
    def makeYShapes(self, length, width, rotAngle, spacing, Nx, Ny, layers):
        if not (type(layers) == list): layers = [layers]
        slit = Cell("Slit")
        for l in layers:
            membrane = Path([(-length / 2., 0), (length / 2., 0)],
                            width=width,
                            layer=l)
            membrane_cell = Cell('Membrane_w{:.0f}'.format(width * 1000))
            membrane_cell.add(membrane)
            slit.add(membrane_cell)
        shape = Cell('Shapes')
        shape.add(slit, rotation=0 + rotAngle)
        shape.add(slit, rotation=120 + rotAngle)
        shape.add(slit, rotation=240 + rotAngle)

        #            CellArray(slit, Nx, Ny,(length + spacing, pitchV))
        xspacing = length + spacing
        yspacing = (length + spacing) * np.sin(np.deg2rad(60))
        shapearray = CellArray(
            shape,
            Nx,
            Ny / 2, (xspacing, yspacing * 2.),
            origin=(-(Nx * xspacing - spacing) / 2.,
                    -(Ny * yspacing - spacing * np.sin(np.deg2rad(60))) / 2.))
        shapearray2 = CellArray(
            shape,
            Nx,
            Ny / 2, (xspacing, yspacing * 2.),
            origin=(xspacing / 2. - (Nx * xspacing - spacing) / 2., yspacing -
                    (Ny * yspacing - spacing * np.sin(np.deg2rad(60))) / 2.))

        allshapes = Cell('All Shapes')
        allshapes.add(shapearray)
        allshapes.add(shapearray2)
        self.add(allshapes)
コード例 #2
0
    def add_contacts(self, layers):
        corner_pos = pad_size/2
        finger_width = 20.  
        finger_length = 80.
        n_cont = smField_num + 1

        contact_pads = Cell('Contact_Pads')
        pad =  Rectangle((-corner_pos,-corner_pos), (corner_pos,corner_pos), layer=layers)
        pad_cell = Cell('Pad_Cell')
        pad_cell.add(pad)
        finger = Rectangle((-finger_width/2,-finger_length/2), (finger_width/2,finger_length/2), layer=layers)
        finger_cell = Cell('Finger Cell')
        finger_cell.add(finger)
        n_finger = n_cont - 1

        pad_array = CellArray(pad_cell, n_cont, n_cont, (sm_spacing, sm_spacing), origin = (0, 0))
        finger_array1 = CellArray(finger_cell, n_finger, n_finger, (sm_spacing, sm_spacing), origin=(corner_pos - finger_width, +corner_pos + finger_length/2))
        finger_array2 = CellArray(finger_cell, n_finger, n_finger, (sm_spacing, sm_spacing), origin=(sm_spacing -corner_pos + finger_width, sm_spacing -corner_pos - finger_length/2))
        finger_array3 = CellArray(finger_cell, n_finger, n_finger, (sm_spacing, sm_spacing), rotation = 90, origin=((n_cont-1)*sm_spacing - corner_pos - finger_length/2, corner_pos - finger_width))
        finger_array4 = CellArray(finger_cell, n_finger, n_finger, (sm_spacing, sm_spacing), rotation = 90, origin=((n_cont-2)*sm_spacing + corner_pos + finger_length/2, sm_spacing -corner_pos + finger_width))
       
        contact_pads.add(pad_array)
        contact_pads.add(finger_array1)
        contact_pads.add(finger_array2)
        contact_pads.add(finger_array3)
        contact_pads.add(finger_array4)

        center = -0.5*((n_cont-1)*smField_size + (n_cont-1)*pad_size)
        for block in self.blocks:
            for n in range (0, lgField_num):
                for i in range (0, lgField_num):
                    block.add(contact_pads, origin = (center + (n+1)*lgField_spacing, center+ (i+1)*lgField_spacing))
コード例 #3
0
    def add_tem_membranes(self, widths, length, pitch, layer):
        tem_membranes = Cell('TEM_Membranes')
        n = 4
        curr_y = 0
        for width in widths:
            membrane = Path([(-length / 2., 0), (length / 2., 0)],
                            width=width,
                            layer=layer)
            membrane_cell = Cell('Membrane_w{:.0f}'.format(width * 1000))
            membrane_cell.add(membrane)
            membrane_array = CellArray(membrane_cell, 1, n, (0, pitch))
            membrane_array_cell = Cell('MembraneArray_w{:.0f}'.format(width *
                                                                      1000))
            membrane_array_cell.add(membrane_array)
            tem_membranes.add(membrane_array_cell, origin=(0, curr_y))
            curr_y += n * pitch

        n2 = 3
        tem_membranes2 = Cell('Many_TEM_Membranes')
        tem_membranes2.add(
            CellArray(tem_membranes, 1, n2, (0, n * len(widths) * pitch)))

        center_x, center_y = (5000, 5000)
        for block in self.blocks:
            block.add(tem_membranes2, origin=(center_x, center_y + 2000))
            block.add(tem_membranes2,
                      origin=(center_x, center_y + 1500),
                      rotation=45)
コード例 #4
0
    def branch_shape_array(self, length, width, rot_angle, spacing, n_x, n_y, layers):
        if not (type(layers) == list):
            layers = [layers]
        pt1 = np.array((0, -width / 2.))
        pt2 = np.array((length, width / 2.))
        slit = Cell("Slit")
        for l in layers:
            rect = Rectangle(pt1, pt2, layer=l)
            slit.add(rect)
            shape = Cell('Branches-{}/{}/{}-lwp'.format(length, width, spacing))
            shape.add(slit, rotation=0 + rot_angle)
            shape.add(slit, rotation=120 + rot_angle)
            shape.add(slit, rotation=240 + rot_angle)

            x_spacing = length + spacing
            y_spacing = (length + spacing) * np.sin(np.deg2rad(60))
            shape_array = CellArray(shape, n_x, np.ceil(n_y / 2.), (x_spacing, y_spacing * 2.), origin=(
                -(n_x * x_spacing - spacing) / 2., -(n_y * y_spacing - spacing * np.sin(np.deg2rad(60))) / 2.))
            shape_array2 = CellArray(shape, n_x, np.ceil(n_y / 2.), (x_spacing, y_spacing * 2.), origin=(
                x_spacing / 2. - (n_x * x_spacing - spacing) / 2.,
                y_spacing - (n_y * y_spacing - spacing * np.sin(np.deg2rad(60))) / 2.))

            all_shapes = Cell('BranchArray-{}/{}/{}-lwp'.format(length, width, spacing))
            all_shapes.add(shape_array)
            all_shapes.add(shape_array2)
        return all_shapes
コード例 #5
0
    def add_tem_membranes(self, widths, length, pitch, layer):

        tem_membranes = Cell('TEM_Membranes')

        n = 3
        curr_y = 0
        for width in widths:
            membrane = Path([(-length / 2., 0), (length / 2., 0)],
                            width=width,
                            layer=layer)
            membrane_cell = Cell('Membrane_w{:.0f}'.format(width * 1000))
            membrane_cell.add(membrane)
            membrane_array = CellArray(membrane_cell, 1, n, (0, pitch))
            membrane_array_cell = Cell('MembraneArray_w{:.0f}'.format(width *
                                                                      1000))
            membrane_array_cell.add(membrane_array)
            tem_membranes.add(membrane_array_cell, origin=(0, curr_y))
            curr_y += n * pitch

        n2 = 5
        tem_membranes2 = Cell('Many_TEM_Membranes')
        tem_membranes2.add(
            CellArray(tem_membranes, 1, n2, (0, n * len(widths) * pitch)))

        self.block_up.add(tem_membranes2, origin=(0, -2000))
        # self.block_up.add(tem_membranes2, origin=(0, -1400), rotation=90)

        self.block_down.add(tem_membranes2, origin=(0, 2000))
コード例 #6
0
    def make_branch_device_array(self, spacing, _widths, array_height,
                                 array_width, array_spacing, len_inner,
                                 len_outer, n_membranes, layers):
        if not (type(layers) == list):
            layers = [layers]
        if not (type(_widths) == list):
            _widths = [_widths]
        for l in layers:
            i = -1
            j = 0
            manydevices = Cell("ManyDevices")
            for width in _widths:
                device = self.make_branch_device(width, spacing, len_inner,
                                                 len_outer, n_membranes, l)
                [[x_min, y_min], [x_max, y_max]] = device.bounding_box
                x_size = abs(x_max - x_min)
                y_size = abs(y_max - y_min)

                i += 1
                if i % 3 == 0:
                    j += 1  # Move to array to next line
                    i = 0  # Restart at left

                nx = int(array_width / (x_size + spacing))
                ny = int(array_height / (y_size + spacing))

                devices = CellArray(device, nx, ny,
                                    (x_size + spacing, y_size + spacing))
                devices.translate((-(nx - 1) * (x_size + spacing) / 2.,
                                   -(ny - 1) * (y_size + spacing) / 2.))
                device_array = Cell("DeviceArray")
                device_array.add(devices)
                # Make the labels for each array of devices
                text = Label(
                    'w/s/l\n%i/%.1f/%i' % (width * 1000, spacing, len_outer),
                    5)
                lbl_vertical_offset = 1.40
                if j % 2 == 0:
                    text.translate(
                        tuple(
                            np.array(-text.bounding_box.mean(0)) +
                            np.array((0, -array_height / lbl_vertical_offset)))
                    )  # Center justify label
                else:
                    text.translate(
                        tuple(
                            np.array(-text.bounding_box.mean(0)) +
                            np.array((0, array_height / lbl_vertical_offset)))
                    )  # Center justify label
                # TODO: Finish this below
                device_array.add(text)
                manydevices.add(
                    device_array,
                    origin=((array_width + array_spacing) * i,
                            (array_height + 2. * array_spacing) * j -
                            array_spacing / 2.))

            self.add(manydevices,
                     origin=(-i * (array_width + array_spacing) / 2,
                             -(j + 1.5) * (array_height + array_spacing) / 2))
コード例 #7
0
    def makeYShape(self, length, width, rotAngle, spacing, Nx, Ny, layers):
        if not (type(layers) == list): layers = [layers]
        pt1 = np.array((0, -width / 2.))
        pt2 = np.array((length, width / 2.))
        slit = Cell("Slit")
        for l in layers:
            rect = Rectangle(pt1, pt2, layer=l)
            slit.add(rect)
            shape = Cell('Shapes')
            shape.add(slit, rotation=0 + rotAngle)
            shape.add(slit, rotation=120 + rotAngle)
            shape.add(slit, rotation=240 + rotAngle)

            #            CellArray(slit, Nx, Ny,(length + spacing, pitchV))
            xspacing = length + spacing
            yspacing = (length + spacing) * np.sin(np.deg2rad(60))
            shapearray = CellArray(
                shape,
                Nx,
                Ny / 2, (xspacing, yspacing * 2.),
                origin=(-(Nx * xspacing - spacing) / 2.,
                        -(Ny * yspacing - spacing * np.sin(np.deg2rad(60))) /
                        2.))
            shapearray2 = CellArray(
                shape,
                Nx,
                Ny / 2, (xspacing, yspacing * 2.),
                origin=(
                    xspacing / 2. - (Nx * xspacing - spacing) / 2., yspacing -
                    (Ny * yspacing - spacing * np.sin(np.deg2rad(60))) / 2.))

            allshapes = Cell('All Shapes')
            allshapes.add(shapearray)
            allshapes.add(shapearray2)
            self.add(allshapes)
コード例 #8
0
    def add_tem_membranes(self, widths, length, pitch, layer):
        tem_membranes = Cell('TEM_Membranes')
        n = 5
        curr_y = 0
        for width in widths:
            membrane = Path([(-length / 2., 0), (length / 2., 0)],
                            width=width,
                            layer=layer)
            membrane_cell = Cell('Membrane_w{:.0f}'.format(width * 1000))
            membrane_cell.add(membrane)
            membrane_array = CellArray(membrane_cell, 1, n, (0, pitch))
            membrane_array_cell = Cell('MembraneArray_w{:.0f}'.format(width *
                                                                      1000))
            membrane_array_cell.add(membrane_array)
            tem_membranes.add(membrane_array_cell, origin=(0, curr_y))
            curr_y += n * pitch

        n2 = 3
        tem_membranes2 = Cell('Many_TEM_Membranes')
        tem_membranes2.add(
            CellArray(tem_membranes, 1, n2, (0, n * len(widths) * pitch)))

        # Add it in all the cells
        for (i, pt) in enumerate(self.block_pts):
            origin = (pt + np.array([0.5, 0.5])) * self.block_size
            self.add(tem_membranes2, origin=origin)
コード例 #9
0
    def make_slit_array(self, _pitches, spacing, _widths, _lengths, rot_angle,
                        array_height, array_width, array_spacing, layers):
        if not (type(layers) == list):
            layers = [layers]
        if not (type(_pitches) == list):
            _pitches = [_pitches]
        if not (type(_lengths) == list):
            _lengths = [_lengths]
        if not (type(_widths) == list):
            _widths = [_widths]
        manyslits = i = j = None
        for l in layers:
            i = -1
            j = -1
            manyslits = Cell("SlitArray")
            pitch = _pitches[0]
            for length in _lengths:
                j += 1
                i = -1

                for width in _widths:
                    # for pitch in pitches:
                    i += 1
                    if i % 3 == 0:
                        j += 1  # Move to array to next line
                        i = 0  # Restart at left

                    pitch_v = pitch / np.cos(np.deg2rad(rot_angle))
                    #                    widthV = width / np.cos(np.deg2rad(rotAngle))
                    nx = int(array_width / (length + spacing))
                    ny = int(array_height / pitch_v)
                    # Define the slits
                    slit = Cell("Slits")
                    rect = Rectangle((-length / 2., -width / 2.), (length / 2., width / 2.), layer=l)
                    rect = rect.copy().rotate(rot_angle)
                    slit.add(rect)
                    slits = CellArray(slit, nx, ny, (length + spacing, pitch_v))
                    slits.translate((-(nx - 1) * (length + spacing) / 2., -(ny - 1) * pitch_v / 2.))
                    slit_array = Cell("SlitArray")
                    slit_array.add(slits)
                    text = Label('w/p/l\n%i/%i/%i' % (width * 1000, pitch, length), 5, layer=l)
                    lbl_vertical_offset = 1.35
                    if j % 2 == 0:
                        text.translate(
                            tuple(np.array(-text.bounding_box.mean(0)) + np.array((
                                0, -array_height / lbl_vertical_offset))))  # Center justify label
                    else:
                        text.translate(
                            tuple(np.array(-text.bounding_box.mean(0)) + np.array((
                                0, array_height / lbl_vertical_offset))))  # Center justify label
                    slit_array.add(text)
                    manyslits.add(slit_array,
                                  origin=((array_width + array_spacing) * i, (
                                          array_height + 2. * array_spacing) * j - array_spacing / 2.))

        self.add(manyslits,
                 origin=(-i * (array_width + array_spacing) / 2, -(j + 1.5) * (
                         array_height + array_spacing) / 2))
コード例 #10
0
def slit_elongation_array(pitches, spacing, widths, lengths, rot_angle,
                          array_height, array_spacing, layers):
    if not (type(layers) == list):
        layers = [layers]
    if not (type(pitches) == list):
        pitches = [pitches]
    if not (type(lengths) == list):
        lengths = [lengths]
    if not (type(widths) == list):
        widths = [widths]
    for l in layers:
        j = -1
        manyslits = Cell("SlitArray")
        slitarray = Cell("SlitArray")
        pitch = pitches[0]
        width = widths[0]
        j += 1
        i = -1
        x_length = 0
        slit = Cell("Slits")
        for length in lengths:
            spacing = length / 5. + 0.1
            i += 1
            pitch_v = pitch / np.cos(np.deg2rad(rot_angle))
            n_y = int(array_height / pitch_v)
            # Define the slits
            if x_length == 0:
                translation = (length / 2., 0)
                x_length += length
            else:
                translation = (x_length + spacing + length / 2., 0)
                x_length += length + spacing
            pt1 = np.array((-length / 2., -width / 2.)) + translation
            pt2 = np.array((length / 2., width / 2.)) + translation
            rect = Rectangle(pt1, pt2, layer=l)
            rect = rect.copy().rotate(rot_angle)
            slit.add(rect)
        slits = CellArray(slit, 1, n_y, (0, pitch_v))
        slits.translate(
            (-slits.bounding_box[1, 0] / 2., -slits.bounding_box[1, 1] / 2.))

        slitarray.add(slits)
        text = Label('w/p\n%i/%i' % (width * 1000, pitch * 1000),
                     2,
                     layer=l_smBeam)
        lbl_vert_offset = 1.4
        text.translate(
            tuple(
                np.array(-text.bounding_box.mean(0)) +
                np.array((0, array_height /
                          lbl_vert_offset))))  # Center justify label
        slitarray.add(text)
        manyslits.add(slitarray)
    return manyslits
コード例 #11
0
    def make_slits_reservoir(self, nslit, pitch, width, contact_distance, layers): # 5 additional slits as material reservoir
        res_slit = 5

        gap = contact_distance + 2. + 2.  
        res_length = (length - gap - 2.5*margin)/2 
        res_width = width
        res_pitch = pitch

        resField = Cell("resField")

        reservoir = Cell("Single Reservoir")
        res_path = Path([(-res_length / 2., 0), (res_length / 2., 0)], width = res_width, layer = layers)
        reservoir.add(res_path)

        reservoirs= CellArray(reservoir, 2, res_slit, spacing = (res_length + gap, res_pitch))
        reservoirs.translate((-(res_length + gap)/2,0))
        res_array = Cell("Multiple Slit")
        res_array.add(reservoirs)
        resField.add(res_array, origin=(0,0), rotation=rot_angle)

        if contact_distance > margin:
            add_slit = Cell("Additional Reservoir")
            add_res_path = Path([(-(contact_distance - 0.8*margin) / 2., 0), ((contact_distance - 0.8*margin) / 2., 0)], width = res_width, layer = layers)
            add_slit.add(add_res_path)

            add_reservoir = CellArray(add_slit, 1, res_slit, spacing = (0, res_pitch))
            add_reservoir.translate((0,0))
            add_res_array = Cell("Additional Multiple Slit")
            add_res_array.add(add_reservoir)
            resField.add(add_res_array, origin=(0,0), rotation=rot_angle)



        self.add(resField, origin= (0,(nslit+1) * pitch/2 ))
        self.add(resField, origin= (0, -((nslit+1+(2*(res_slit-1))) * pitch/2 )))
コード例 #12
0
    def makeXShape(self, length, width, rotAngle, spacing, Nx, Ny, layers):
        if not (type(layers) == list): layers = [layers]
        slit = Cell("Slit")
        for l in layers:
            membrane = Path([(-length / 2., 0), (length / 2., 0)],
                            width=width,
                            layer=l)
            membrane_cell = Cell('Membrane_w{:.0f}'.format(width * 1000))
            membrane_cell.add(membrane)
            slit.add(membrane_cell)
        shape = Cell('Shapes')
        shape.add(slit, rotation=60)
        shape.add(slit, rotation=120)

        xspacing = (length + spacing) * np.cos(np.deg2rad(60))
        yspacing = (length + spacing) * np.sin(np.deg2rad(60))
        shapearray = CellArray(shape,
                               Nx,
                               Ny, (xspacing, yspacing),
                               origin=(-(Nx * xspacing - spacing) / 2.,
                                       -(Ny * yspacing - spacing) / 2.))
        #            shapearray2 = CellArray(shape, Nx, Ny/2,(xspacing,yspacing*2.),origin=(xspacing/2.-(Nx*xspacing-spacing)/2.,yspacing-(Ny*yspacing-spacing*np.tan(np.deg2rad(60)))/2.))
        #            shapearray = CellArray(shape, Nx, Ny,(xspacing,yspacing))
        #            shapearray.rotate(rotAngle)
        #            shapearray.translate((-shapearray.bounding_box.mean(0)[0]/2.,-shapearray.bounding_box.mean(0)[1]/2.))

        allshapes = Cell('All Shapes')
        allshapes.add(shapearray)
        #            allshapes.add(shapearray2)
        #            allshapes.add(shape)
        self.add(allshapes)
コード例 #13
0
    def makeXShape(self, length, width, rotAngle, spacing, Nx, Ny, layers):
        if not (type(layers) == list): layers = [layers]
        pt1 = np.array((-length / 2., -width / 2.))
        pt2 = np.array((length / 2., width / 2.))
        slit = Cell("Slit")
        for l in layers:
            rect = Rectangle(pt1, pt2, layer=l)
            slit.add(rect)
            shape = Cell('Shapes')
            shape.add(slit, rotation=60)
            shape.add(slit, rotation=120)

            xspacing = (length + spacing) * np.cos(np.deg2rad(60))
            yspacing = (length + spacing) * np.sin(np.deg2rad(60))
            shapearray = CellArray(shape,
                                   Nx,
                                   Ny, (xspacing, yspacing),
                                   origin=(-(Nx * xspacing - spacing) / 2.,
                                           -(Ny * yspacing - spacing) / 2.))
            #            shapearray2 = CellArray(shape, Nx, Ny/2,(xspacing,yspacing*2.),origin=(xspacing/2.-(Nx*xspacing-spacing)/2.,yspacing-(Ny*yspacing-spacing*np.tan(np.deg2rad(60)))/2.))
            #            shapearray = CellArray(shape, Nx, Ny,(xspacing,yspacing))
            #            shapearray.rotate(rotAngle)
            #            shapearray.translate((-shapearray.bounding_box.mean(0)[0]/2.,-shapearray.bounding_box.mean(0)[1]/2.))

            allshapes = Cell('All Shapes')
            allshapes.add(shapearray)
            #            allshapes.add(shapearray2)
            #            allshapes.add(shape)
            self.add(allshapes)
コード例 #14
0
    def add_cleave_xsection_nws(self):
        pitches = [0.5, 1., 2., 4.]
        widths = [10., 20., 40., 60., 100., 160., 240.]
        n_membranes = 10
        length = 50
        spacing = 10

        cleave_xsection_cell = Cell("CleaveCrossSection")

        y_offset = 0
        for pitch in pitches:
            for width in widths:
                nm_cell = Cell("P{:.0f}W{:.0f}".format(pitch, width))
                slit = Path([(-length / 2., 0), (length / 2., 0)], width=width / 1000., layer=l_smBeam)
                nm_cell.add(slit)
                nm_cell_array = Cell("P{:.0f}W{:.0f}_Array".format(pitch, width))
                tmp = CellArray(nm_cell, 1.0, n_membranes, [0, pitch])
                nm_cell_array.add(tmp)
                cleave_xsection_cell.add(nm_cell_array, origin=(0, y_offset + pitch * n_membranes))
                y_offset += pitch * n_membranes + spacing

                text = Label("P{:.1f}W{:.0f}".format(pitch, width), 1.0, layer=l_smBeam)
                text.translate(tuple(np.array(-text.bounding_box.mean(0))))  # Center justify label
                txt_cell = Cell("lbl_P{:.1f}W{:.0f}".format(pitch, width))
                txt_cell.add(text)
                cleave_xsection_cell.add(txt_cell, origin=(length * 0.75, y_offset - 8.0))
                cleave_xsection_cell.add(txt_cell, origin=(-length * 0.75, y_offset - 8.0))

            y_offset += spacing * 3

        center_x, center_y = (5000, 5000)
        for block in self.blocks:
            block.add(cleave_xsection_cell, origin=(center_x + 1150, center_y - 463))
            # block.add(cleave_xsection_cell, origin=(center_x - 350, center_y + 350), rotation=45.)    # >> VP_mod: disabled <<
            block.add(cleave_xsection_cell, origin=(center_x + 463, center_y - 1150), rotation=90.)   # >> VP_mod: disabled<<
コード例 #15
0
    def makeArrowShape(self, length, width, rotAngle, spacing, Nx, Ny, layers):
        if not (type(layers) == list): layers = [layers]
        pt1 = np.array((-width * 0.3, -width / 2.))
        pt2 = np.array((length, width / 2.))
        slit = Cell("Slit")
        for l in layers:
            rect = Rectangle(pt1, pt2, layer=l)
            slit.add(rect)
            shape = Cell('Shapes')
            shape.add(slit, rotation=-120)
            shape.add(slit, rotation=120)

            xspacing = (width + spacing) / np.cos(np.deg2rad(30))
            yspacing = (length + spacing / 2.) * np.sin(np.deg2rad(60))
            shapearray = CellArray(shape,
                                   Nx,
                                   Ny, (xspacing, yspacing * 2.),
                                   origin=(-(Nx * xspacing - spacing) / 2.,
                                           -(Ny * yspacing - spacing) / 2.))

            allshapes = Cell('All Shapes')
            allshapes.add(shapearray)
            #            allshapes.add(shapearray2)
            #            allshapes.add(shape)
            self.add(allshapes)
コード例 #16
0
    def add_cleave_xsection_nws(self):
        pitches = [1., 2., 4.]
        widths = [10., 15., 20., 30., 40., 50.]
        n_membranes = 10
        length = 50
        spacing = 10

        cleave_xsection_cell = Cell("CleaveCrossSection")

        y_offset = 0
        for pitch in pitches:
            for width in widths:
                nm_cell = Cell("P{:.0f}W{:.0f}".format(pitch, width))
                slit = Path([(-length / 2., 0), (length / 2., 0)], width=width / 1000., layer=l_smBeam)
                nm_cell.add(slit)
                nm_cell_array = Cell("P{:.0f}W{:.0f}_Array".format(pitch, width))
                tmp = CellArray(nm_cell, 1.0, n_membranes, [0, pitch])
                nm_cell_array.add(tmp)
                cleave_xsection_cell.add(nm_cell_array, origin=(0, y_offset + pitch * n_membranes))
                y_offset += pitch * n_membranes + spacing
            y_offset += spacing * 3

        center_x, center_y = (5000, 5000)
        for block in self.blocks:
            block.add(cleave_xsection_cell, origin=(center_x + 1150, center_y - 340))
            block.add(cleave_xsection_cell, origin=(center_x - 500, center_y + 500), rotation=45.)
            block.add(cleave_xsection_cell, origin=(center_x + 340, center_y - 1150), rotation=90.)
コード例 #17
0
    def make_slits(self, length, width, nslit, pitch, rot_angle, layers):
        """
        Define a single slit or a slit array with a given length, width and pitch
        """
        slitField = Cell("slitField")

        slit = Cell("Single Slit")
        slit_path = Path([(-length / 2., 0), (length / 2., 0)], width = width, layer = layers)
        slit.add(slit_path)
        
        if nslit == 1:
            slitField.add(slit, origin=(0,0), rotation=rot_angle)
        elif nslit > 1:
            slits = CellArray(slit, 1, nslit, (0,pitch))
            slits.translate((0, -(nslit-1) * pitch / 2.))
            slit_array = Cell("Multiple Slit")
            slit_array.add(slits)
            slitField.add(slit_array, origin=(0,0), rotation=rot_angle)
        else:
            print("Error in the number of slits. Check the internal code"*50)
            quit()
        self.add(slitField)
コード例 #18
0
    def make_shape_array(self, array_size, shape_area, shape_pitch, type, layer, skew, toplabels=False,
                         sidelabels=False):
        num_of_shapes = int(np.ceil(array_size / shape_pitch))
        base_cell = Cell('Base')

        if 'tris' in type.lower():
            triangle_side = np.sqrt(shape_area / np.sqrt(3) * 4)
            tri_shape = scale(RegPolygon([0, 0], triangle_side, 3, layer=layer), [skew, 1.0])
            tri_cell = Cell('Tri')
            tri_cell.add(tri_shape)
            if 'right' in type.lower():
                base_cell.add(tri_cell, rotation=0)
            elif 'left' in type.lower():
                base_cell.add(tri_cell, rotation=-180)
            elif 'down' in type.lower():
                base_cell.add(tri_cell, rotation=30)  # not working for skew yet
            elif 'up' in type.lower():
                base_cell.add(tri_cell, rotation=-30)  # not working for skew yet
        elif type.lower() == "circles":
            circ_radius = np.sqrt(shape_area / np.pi)
            circ = scale(Disk([0, 0], circ_radius, layer=layer), [skew, 1.0])
            base_cell.add(circ)
        elif type.lower() == 'hexagons':
            hex_side = np.sqrt(shape_area / 6. / np.sqrt(3) * 4)
            hex_shape = scale(RegPolygon([0, 0], hex_side, 6, layer=layer), [skew, 1.0])
            hex_cell = Cell('Hex')
            hex_cell.add(hex_shape)
            base_cell.add(hex_cell, rotation=0)

        shape_array = CellArray(base_cell, num_of_shapes, num_of_shapes, [shape_pitch, shape_pitch])
        shape_array_cell = Cell('Shape Array')
        shape_array_cell.add(shape_array)

        lbl_dict = {'hexagons': 'hex', 'circles': 'circ', 'tris_right': 'triR', 'tris_left': 'triL'}

        if toplabels:
            text = Label('{}'.format(lbl_dict[type.lower()]), 2, layer=layer)
            lblVertOffset = 0.8
            text.translate(
                tuple(np.array(-text.bounding_box.mean(0)) + np.array((
                    array_size / 2., array_size / lblVertOffset))))  # Center justify label
            shape_array_cell.add(text)
        if sidelabels:
            text = Label('a={:.0f}knm2'.format(shape_area * 1000), 2, layer=layer)
            lblHorizOffset = 1.5
            text.translate(
                tuple(np.array(-text.bounding_box.mean(0)) + np.array((
                    -array_size / lblHorizOffset, array_size / 2.))))  # Center justify label
            shape_array_cell.add(text)

        return shape_array_cell
コード例 #19
0
    def add_contacts(self, md_size_x, md_size_y, layers):
            smField_num_x = int((md_size_x)/sm_spacing-1)
            smField_num_y = int((md_size_y)/sm_spacing-1)

            corner_pos = pad_size/2
            finger_width = 20.  
            finger_length = 80.
            n_cont_x = smField_num_x + 1
            n_cont_y = smField_num_y + 1


            contact_pads = Cell('Contact_Pads')
            pad =  Rectangle((-corner_pos,-corner_pos), (corner_pos,corner_pos), layer=layers)
            pad_cell = Cell('Pad_Cell')
            pad_cell.add(pad)
            finger = Rectangle((-finger_width/2,-finger_length/2), (finger_width/2,finger_length/2), layer=layers)
            finger_cell = Cell('Finger Cell')
            finger_cell.add(finger)
            n_finger_x = n_cont_x - 1
            n_finger_y = n_cont_y - 1

            pad_array = CellArray(pad_cell, n_cont_x, n_cont_y, (sm_spacing, sm_spacing), origin = (0, 0))
            finger_array1 = CellArray(finger_cell, n_finger_x, n_finger_y, (sm_spacing, sm_spacing), origin=(corner_pos - finger_width, corner_pos + finger_length/2))
            finger_array2 = CellArray(finger_cell, n_finger_x, n_finger_y, (sm_spacing, sm_spacing), origin=(sm_spacing -corner_pos + finger_width, sm_spacing -corner_pos - finger_length/2))
            finger_array3 = CellArray(finger_cell, n_finger_y, n_finger_x, (sm_spacing, sm_spacing), rotation = 90, origin=((n_cont_x-1)*sm_spacing - corner_pos - finger_length/2, corner_pos - finger_width))
            finger_array4 = CellArray(finger_cell, n_finger_y, n_finger_x, (sm_spacing, sm_spacing), rotation = 90, origin=((n_cont_x-2)*sm_spacing + corner_pos + finger_length/2, sm_spacing -corner_pos + finger_width))
        
            contact_pads.add(pad_array)
            contact_pads.add(finger_array1)
            contact_pads.add(finger_array2)
            contact_pads.add(finger_array3)
            contact_pads.add(finger_array4)

            center_x = -0.5*((n_cont_x-1)*smField_size + (n_cont_x-1)*pad_size)
            center_y = -0.5*((n_cont_y-1)*smField_size + (n_cont_y-1)*pad_size)

            self.add(contact_pads, origin = (center_x, center_y))
            return smField_num_x, smField_num_y
コード例 #20
0
def make_shape_array(array_size,
                     shape_area,
                     shape_pitch,
                     type,
                     layer,
                     labels=True):
    num_of_shapes = int(np.ceil(array_size / shape_pitch))
    base_cell = Cell('Base')

    if 'tris' in type.lower():
        triangle_side = np.sqrt(shape_area / np.sqrt(3) * 4)
        tri_shape = RegPolygon([0, 0], triangle_side, 3, layer=layer)
        tri_cell = Cell('Tri')
        tri_cell.add(tri_shape)
        if 'right' in type.lower():
            base_cell.add(tri_cell, rotation=0)
        elif 'left' in type.lower():
            base_cell.add(tri_cell, rotation=60)
        elif 'down' in type.lower():
            base_cell.add(tri_cell, rotation=30)
        elif 'up' in type.lower():
            base_cell.add(tri_cell, rotation=-30)
    elif type.lower() == "circles":
        circ_radius = np.sqrt(shape_area / np.pi)
        circ = Disk([0, 0], circ_radius, layer=layer)
        base_cell.add(circ)
    elif type.lower() == 'hexagons':
        hex_side = np.sqrt(shape_area / 6. / np.sqrt(3) * 4)
        hex_shape = RegPolygon([0, 0], hex_side, 6, layer=layer)
        hex_cell = Cell('Hex')
        hex_cell.add(hex_shape)
        base_cell.add(hex_cell, rotation=0)

    shape_array = CellArray(base_cell, num_of_shapes, num_of_shapes,
                            [shape_pitch, shape_pitch])
    shape_array_cell = Cell('Shape Array')
    shape_array_cell.add(shape_array)

    if labels:
        text = Label('{}'.format(type), 2, layer=l_smBeam)
        lblVertOffset = 0.8
        text.translate(
            tuple(
                np.array(-text.bounding_box.mean(0)) +
                np.array((array_size / 2., array_size /
                          lblVertOffset))))  # Center justify label

        shape_array_cell.add(text)

    return shape_array_cell
コード例 #21
0
 def processCheck_Slits(self, position, arrayWidth, slitWidth, pitch,
                        length, rotation, layers):
     if not (type(layers) == list): layers = [layers]
     Nx = int(arrayWidth / pitch)
     Ny = 1
     for l in layers:
         # Define the slits
         slit = Cell("Slits")
         rect = Rectangle((-slitWidth / 2., -length / 2.),
                          (slitWidth / 2., length / 2.),
                          layer=l)
         slit.add(rect)
         slits = CellArray(slit, Nx, Ny, (pitch, 0))
         slits.translate((-(Nx) * (pitch) / 2., 0.))
         slits.translate(position)
         slitarray = Cell("ProcessCheckingSlits")
         slitarray.add(slits)
     self.add(slitarray)
コード例 #22
0
    def make_slit_patterns(self, sflabels, _pitches, spacing, _widths,
                           _lengths, rot_angle, array_height, array_width,
                           array_spacing, layers):
        if not (type(layers) == list):
            layers = [layers]
        if not (type(_pitches) == list):
            _pitches = [_pitches]
        if not (type(_lengths) == list):
            _lengths = [_lengths]
        if not (type(_widths) == list):
            _widths = [_widths]
        manyslits = i = j = None
        for l in layers:
            i = -1
            j = -1
            manyslits = Cell("SlitArray")
            pitch = _pitches[0]
            for length in _lengths:
                j += 1
                i = -1

                for width in _widths:
                    # for pitch in pitches:
                    i += 1
                    if i % 3 == 0:
                        j += 1  # Move to array to next line
                        i = 0  # Restart at left

                    nx = int(array_width / (length + spacing))
                    ny = int(array_height / pitch)
                    # Define the slits
                    slit = Cell("Slit_w{:.0f}".format(width * 1000))
                    slit_path = Path([(-length / 2., 0), (length / 2., 0)],
                                     width=width,
                                     layer=l)
                    slit.add(slit_path)
                    slits = CellArray(slit, nx, ny, (length + spacing, pitch))
                    slits.translate((-(nx - 1) * (length + spacing) / 2.,
                                     -(ny - 1) * pitch / 2.))
                    slit_array = Cell("SlitArray_w{:.0f}".format(width * 1000))
                    slit_array.add(slits)
                    text = Label('w/p/l\n%i/%i/%i' %
                                 (width * 1000, pitch, length),
                                 5,
                                 layer=l)
                    lbl_vertical_offset = 1.35
                    if j % 2 == 0:
                        text.translate(
                            tuple(
                                np.array(-text.bounding_box.mean(0)) +
                                np.array((0,
                                          -array_height / lbl_vertical_offset))
                            ))  # Center justify label
                    else:
                        text.translate(
                            tuple(
                                np.array(-text.bounding_box.mean(0)) +
                                np.array((0, array_height / lbl_vertical_offset
                                          ))))  # Center justify label
                    slit_array.add(text)
                    manyslits.add(
                        slit_array,
                        origin=((array_width + array_spacing) * i,
                                (array_height + 2. * array_spacing) * j -
                                array_spacing / 2.))

        specific_label = Label(sflabels, 20, layer=l)
        specific_label.translate(
            (-lbl_vertical_offset * smMarkerPosition,
             -lbl_vertical_offset * smMarkerPosition))  # Center Small Field
        slit_array.add(specific_label)

        # This is an ugly hack to center rotated slits, should fix this properly...
        if rot_angle == 45:  # TODO: fix this ugly thing
            hacky_offset_x = 200
            hacky_offset_y = -25
        elif rot_angle == 90:
            hacky_offset_x = 356
            hacky_offset_y = 96.5
        elif rot_angle == 180:
            hacky_offset_x = 260
            hacky_offset_y = 452
        elif rot_angle == 270 or rot_angle == -90:
            hacky_offset_x = -96.5
            hacky_offset_y = 356
        else:
            hacky_offset_x = 0
            hacky_offset_y = 0

        self.add(manyslits,
                 origin=(-(i * (array_width + array_spacing)) / 2 +
                         hacky_offset_x, -(j + 1.5) *
                         (array_height + array_spacing) / 2 + hacky_offset_y),
                 rotation=rot_angle)
コード例 #23
0
def make_branch_array(x_vars, y_vars, stat_vars, var_names, spacing, rot_angle,
                      array_height, array_width, array_spacing, layers):
    if len(var_names) != 3:
        raise Exception('Error! Need to have three variable names.')
    if not (type(layers) == list):
        layers = [layers]
    if not (type(x_vars) == list):
        x_vars = [x_vars]
    if not (type(y_vars) == list):
        y_vars = [y_vars]
    if not (type(stat_vars) == list):
        stat_vars = [stat_vars]

    x_var_name = var_names[0]
    y_var_name = var_names[1]
    stat_var_name = var_names[2]

    for l in layers:
        j = -1
        manybranches = Cell("ManyBranches")
        for x_var in x_vars:
            j += 1
            i = -1
            for y_var in y_vars:
                i += 1
                if i % 3 == 0:
                    j += 1  # Move to array to next line
                    i = 0  # Restart at left

                var_dict = {x_var_name: x_var, y_var_name: y_var, stat_var_name: stat_vars[0]}
                pitch = var_dict['pitch']
                width = var_dict['width']
                length = var_dict['length']
                branch = make_branch(length, width, layers, rot_angle=rot_angle)
                x_spacing = length + pitch
                y_spacing = (length + pitch) * np.sin(np.deg2rad(60))
                n_x = int(array_width / x_spacing)
                n_x2 = int((array_width - x_spacing / 2.) / x_spacing)
                n_y = np.round(array_height / 2. / y_spacing)
                n_y2 = np.round((array_height - y_spacing / 2.) / 2. / y_spacing)
                shape_array = CellArray(branch, n_x, n_y, (x_spacing, y_spacing * 2.), origin=(
                    -(n_x * x_spacing - pitch) / 2., -(2. * n_y * y_spacing - pitch * np.sin(np.deg2rad(60))) / 2.))
                if n_x == n_x2:
                    translation = (x_spacing / 2. - (n_x2 * x_spacing - pitch) / 2.,
                                   y_spacing - (2. * n_y * y_spacing - pitch * np.sin(np.deg2rad(60))) / 2.)
                else:
                    translation = (-(n_x2 * x_spacing - pitch) / 2.,
                                   y_spacing - (2. * n_y * y_spacing - pitch * np.sin(np.deg2rad(60))) / 2.)

                shape_array2 = CellArray(branch, n_x2, n_y2, (x_spacing, y_spacing * 2.),
                                         origin=translation)

                branch_array = Cell('BranchArray-{:.2f}/{:.3f}/{:.1f}-lwp'.format(length, width, spacing))
                branch_array.add(shape_array)
                branch_array.add(shape_array2)

                text = Label('w/p/l\n{:.0f}/{:.1f}/{:.1f}'.format(width * 1000, pitch, length), 2, layer=l_smBeam)
                lbl_vert_offset = 1.35
                if j % 2 == 0:
                    text.translate(
                        tuple(np.array(-text.bounding_box.mean(0)) + np.array((
                            0, -array_height / lbl_vert_offset))))  # Center justify label
                else:
                    text.translate(
                        tuple(np.array(-text.bounding_box.mean(0)) + np.array((
                            0, array_height / lbl_vert_offset))))  # Center justify label
                branch_array.add(text)
                manybranches.add(branch_array,
                                 origin=((array_width + array_spacing) * i, (
                                     array_height + 2. * array_spacing) * j - array_spacing / 2.))
    return manybranches
コード例 #24
0
def make_slit_array(x_vars, y_vars, stat_vars, var_names, spacing, rot_angle,
                    array_height, array_width, array_spacing, layers):
    if len(var_names) != 3:
        raise Exception('Error! Need to have three variable names.')
    if not (type(layers) == list):
        layers = [layers]
    if not (type(x_vars) == list):
        x_vars = [x_vars]
    if not (type(y_vars) == list):
        y_vars = [y_vars]
    if not (type(stat_vars) == list):
        stat_vars = [stat_vars]

    x_var_name = var_names[0]
    y_var_name = var_names[1]
    stat_var_name = var_names[2]

    for l in layers:
        j = -1
        manyslits = Cell("SlitArray")
        for x_var in x_vars:
            j += 1
            i = -1
            for y_var in y_vars:
                i += 1
                if i % 3 == 0:
                    j += 1  # Move to array to next line
                    i = 0  # Restart at left

                var_dict = {
                    x_var_name: x_var,
                    y_var_name: y_var,
                    stat_var_name: stat_vars[0]
                }
                pitch = var_dict['pitch']
                width = var_dict['width']
                length = var_dict['length']

                pitch_v = pitch / np.cos(np.deg2rad(rot_angle))
                #                    widthV = width / np.cos(np.deg2rad(rotAngle))
                n_x = int(array_width / (length + spacing))
                n_y = int(array_height / pitch_v)
                # Define the slits
                slit = Cell("Slits")
                rect = Rectangle((-length / 2., -width / 2.),
                                 (length / 2., width / 2.),
                                 layer=l)
                rect = rect.copy().rotate(rot_angle)
                slit.add(rect)
                slits = CellArray(slit, n_x, n_y, (length + spacing, pitch_v))
                slits.translate((-(n_x - 1) * (length + spacing) / 2.,
                                 -(n_y - 1) * pitch_v / 2.))
                slit_array = Cell("SlitArray")
                slit_array.add(slits)
                text = Label('w/p/l\n%i/%i/%i' %
                             (width * 1000, pitch * 1000, length * 1000),
                             2,
                             layer=l_smBeam)
                lbl_vert_offset = 1.35
                if j % 2 == 0:
                    text.translate(
                        tuple(
                            np.array(-text.bounding_box.mean(0)) +
                            np.array((0, -array_height / lbl_vert_offset)))
                    )  # Center justify label
                else:
                    text.translate(
                        tuple(
                            np.array(-text.bounding_box.mean(0)) +
                            np.array((0, array_height / lbl_vert_offset)))
                    )  # Center justify label
                slit_array.add(text)
                manyslits.add(slit_array,
                              origin=((array_width + array_spacing) * i,
                                      (array_height + 2. * array_spacing) * j -
                                      array_spacing / 2.))
    return manyslits
コード例 #25
0
def makeSlitArray2(pitches, spacing, widths, lengths, rotAngle, arrayHeight,
                   arrayWidth, arraySpacing, layers):
    '''
    Give it a single pitch and lengths/widths and it will generate an array for all the combinations
    Makes seperate frame for each length value
    '''
    if not (type(layers) == list): layers = [layers]
    if not (type(pitches) == list): pitches = [pitches]
    if not (type(lengths) == list): lengths = [lengths]
    if not (type(widths) == list): widths = [widths]
    for l in layers:
        i = -1
        j = -1
        manyslits = Cell("SlitArray")
        pitch = pitches[0]
        for length in lengths:
            j += 1
            i = -1

            for width in widths:
                #            for pitch in pitches:
                i += 1
                if i % 3 == 0:
                    j += 1  # Move to array to next line
                    i = 0  # Restart at left

                pitchV = pitch / np.cos(np.deg2rad(rotAngle))
                #                    widthV = width / np.cos(np.deg2rad(rotAngle))
                Nx = int(arrayWidth / (length + spacing))
                Ny = int(arrayHeight / (pitchV))
                # Define the slits
                membrane = Path([(-length / 2., 0), (length / 2., 0)],
                                width=width,
                                layer=l)
                membrane_cell = Cell('Membrane_w{:.0f}_l{:.0f}'.format(
                    width * 1000, length * 1000))
                membrane_cell.add(membrane)
                slit = Cell("Slits")
                slit.add(membrane_cell, rotation=rotAngle)
                if Nx <= 1:
                    slits = CellArray(slit, Nx, Ny, (length, pitchV))
                    slits.translate((0, -(Ny - 1) * (pitchV) / 2.))
                else:
                    slits = CellArray(slit, Nx, Ny, (length + spacing, pitchV))
                    slits.translate((-(Nx - 1) * (length + spacing) / 2.,
                                     -(Ny - 1) * (pitchV) / 2.))

                slitarray = Cell("SlitArray")
                slitarray.add(slits)
                text = Label('w/p/l\n%i/%i/%i' %
                             (width * 1000, pitch * 1000, length),
                             2,
                             layer=l_smBeam)
                lblVertOffset = 1.35
                if j % 2 == 0:
                    text.translate(
                        tuple(
                            np.array(-text.bounding_box.mean(0)) +
                            np.array((0, -arrayHeight /
                                      lblVertOffset))))  # Center justify label
                else:
                    text.translate(
                        tuple(
                            np.array(-text.bounding_box.mean(0)) +
                            np.array((0, arrayHeight /
                                      lblVertOffset))))  # Center justify label
                slitarray.add(text)
                manyslits.add(slitarray,
                              origin=((arrayWidth + arraySpacing) * i,
                                      (arrayHeight + 2. * arraySpacing) * j -
                                      arraySpacing / 2.))
    return manyslits
コード例 #26
0
    def add_contacts(self, pad_size, finger_width, finger_length, layers):
        contact_frames = [2, 4, 6, 8]
        spacing = pad_size / 2
        for frame in contact_frames:
            frame_length = (10 - frame) * 1000
            n_cont = int((frame_length) / (pad_size + spacing)) - 1

            corner_pos = pad_size / 2

            contact_pads = Cell('Contact_Pads')
            pad = Rectangle((-corner_pos, -corner_pos),
                            (corner_pos, corner_pos),
                            layer=layers)
            pad_cell = Cell('Pad_Cell')
            pad_cell.add(pad)
            finger = Rectangle((-finger_width / 2, -finger_length / 2),
                               (finger_width / 2, finger_length / 2),
                               layer=layers)
            finger_cell = Cell('Finger Cell')
            finger_cell.add(finger)

            curr_x = (10000 - ((n_cont - 1) * (pad_size + spacing))) / 2
            curr_y = (10000 - frame_length) / 2
            pad_array = CellArray(pad_cell,
                                  n_cont,
                                  1, (pad_size + spacing, pad_size + spacing),
                                  origin=(curr_x, curr_y))
            finger_array_tr = CellArray(
                finger_cell,
                n_cont,
                1, (pad_size + spacing, pad_size + spacing),
                origin=(curr_x - pad_size / 2 + finger_width,
                        curr_y + corner_pos + finger_length / 2))
            finger_array_tl = CellArray(
                finger_cell,
                n_cont,
                1, (pad_size + spacing, pad_size + spacing),
                origin=(curr_x + pad_size / 2 - finger_width,
                        curr_y + corner_pos + finger_length / 2))
            finger_array_br = CellArray(
                finger_cell,
                n_cont,
                1, (pad_size + spacing, pad_size + spacing),
                origin=(curr_x - pad_size / 2 + finger_width,
                        curr_y - corner_pos - finger_length / 2))
            finger_array_bl = CellArray(
                finger_cell,
                n_cont,
                1, (pad_size + spacing, pad_size + spacing),
                origin=(curr_x + pad_size / 2 - finger_width,
                        curr_y - corner_pos - finger_length / 2))

            contact_pads.add(pad_array)
            if frame < 8:
                contact_pads.add(finger_array_tr)
                contact_pads.add(finger_array_tl)
            if frame > 2:
                contact_pads.add(finger_array_br)
                contact_pads.add(finger_array_bl)

            for block in self.blocks:
                block.add(contact_pads)
                block.add(contact_pads, origin=(10000, 0), rotation=90)
                block.add(contact_pads, origin=(10000, 10000), rotation=180)
                block.add(contact_pads, origin=(0, 10000), rotation=270)
コード例 #27
0
def makeSlitArray(pitches, spacing, widths, lengths, rotAngle, arrayHeight,
                  arraySpacing, layers):
    '''
    Give it a single pitch and width and it will generate an array for all the lengths
    '''
    if not (type(layers) == list): layers = [layers]
    if not (type(pitches) == list): pitches = [pitches]
    if not (type(lengths) == list): lengths = [lengths]
    if not (type(widths) == list): widths = [widths]
    for l in layers:
        i = -1
        j = -1
        manyslits = Cell("SlitArray")
        slitarray = Cell("SlitArray")
        pitch = pitches[0]
        width = widths[0]
        j += 1
        i = -1
        xlength = 0
        slit = Cell("Slits")
        for length in lengths:
            spacing = length / 5. + 0.1
            i += 1
            pitchV = pitch / np.cos(np.deg2rad(rotAngle))
            #            widthV = width / np.cos(np.deg2rad(rotAngle))
            #            Nx = int(arrayWidth / (length + spacing))
            Ny = int(arrayHeight / (pitchV))
            # Define the slits
            if xlength == 0:
                translation = (length / 2., 0)
                xlength += length
            else:
                translation = (xlength + spacing + length / 2., 0)
                xlength += length + spacing

            pt1 = np.array((-length / 2., -width / 2.)) + translation
            pt2 = np.array((length / 2., width / 2.)) + translation
            rect = Rectangle(pt1, pt2, layer=l)
            rect = rect.copy().rotate(rotAngle)
            slit.add(rect)
        slits = CellArray(slit, 1, Ny, (0, pitchV))
        # slits.translate((-(Nx - 1) * (length + spacing) / 2., -(Ny - 1)* (pitchV) / 2.))
        slits.translate(
            (-slits.bounding_box[1, 0] / 2., -slits.bounding_box[1, 1] / 2.))

        slitarray.add(slits)
        text = Label('w/p\n%i/%i' % (width * 1000, pitch * 1000),
                     2,
                     layer=l_smBeam)
        lblVertOffset = 1.4
        text.translate(
            tuple(
                np.array(-text.bounding_box.mean(0)) +
                np.array((0, arrayHeight /
                          lblVertOffset))))  # Center justify label
        slitarray.add(text)
        #            manyslits.add(slitarray,origin=((arrayWidth + arraySpacing) * i, (arrayHeight + 2.*arraySpacing) * j-arraySpacing/2.))
        manyslits.add(slitarray)

    # self.add(manyslits, origin=(-i * (arrayWidth + arraySpacing) / 2, -j * (arrayHeight + arraySpacing) / 2))
    #    self.add(manyslits)
    return manyslits
コード例 #28
0
def makeSlitArray3(pitches, spacing, widths, lengths, rotAngle, arrayHeight,
                   arrayWidth, arraySpacing, layers):
    '''
    Give it a single pitch and arrays for spacings/widths and it will generate an array for all the combinations
    Makes seperate frame for each pitch
    '''
    if not (type(layers) == list): layers = [layers]
    if not (type(pitches) == list): pitches = [pitches]
    if not (type(lengths) == list): lengths = [lengths]
    if not (type(widths) == list): widths = [widths]
    for l in layers:
        i = -1
        j = -1
        manyslits = Cell("SlitArray")
        length = lengths[0]
        spacing = length / 5. + 0.1  # Set the spacing between arrays
        for pitch in pitches:
            j += 1
            i = -1

            for width in widths:
                #            for pitch in pitches:
                i += 1
                if i % 3 == 0:
                    j += 1  # Move to array to next line
                    i = 0  # Restart at left
                pitchV = pitch / np.cos(np.deg2rad(rotAngle))
                #                    widthV = width / np.cos(np.deg2rad(rotAngle))
                Nx = int(arrayWidth / (length + spacing))
                Ny = int(arrayHeight / (pitchV))
                # Define the slits
                slit = Cell("Slits")
                rect = Rectangle((-length / 2., -width / 2.),
                                 (length / 2., width / 2.),
                                 layer=l)
                rect = rect.copy().rotate(rotAngle)
                slit.add(rect)
                slits = CellArray(slit, Nx, Ny, (length + spacing, pitchV))
                slits.translate((-(Nx - 1) * (length + spacing) / 2.,
                                 -(Ny - 1) * (pitchV) / 2.))
                slitarray = Cell("SlitArray")
                slitarray.add(slits)
                text = Label('w/p/l\n%i/%i/%i' %
                             (width * 1000, pitch * 1000, length * 1000),
                             2,
                             layer=l_smBeam)
                lblVertOffset = 1.35
                if j % 2 == 0:
                    text.translate(
                        tuple(
                            np.array(-text.bounding_box.mean(0)) +
                            np.array((0, -arrayHeight /
                                      lblVertOffset))))  # Center justify label
                else:
                    text.translate(
                        tuple(
                            np.array(-text.bounding_box.mean(0)) +
                            np.array((0, arrayHeight /
                                      lblVertOffset))))  # Center justify label
                slitarray.add(text)
                manyslits.add(slitarray,
                              origin=((arrayWidth + arraySpacing) * i,
                                      (arrayHeight + 2. * arraySpacing) * j -
                                      arraySpacing / 2.))
    return manyslits
コード例 #29
0
    def make_slit_array(self, _pitches, spacing, _widths, _lengths, rot_angle,
                        array_height, array_width, array_spacing, layers):
        if not (type(layers) == list):
            layers = [layers]
        if not (type(_pitches) == list):
            _pitches = [_pitches]
        if not (type(_lengths) == list):
            _lengths = [_lengths]
        if not (type(_widths) == list):
            _widths = [_widths]
        manyslits = i = j = None
        for l in layers:
            i = -1
            j = -1
            manyslits = Cell("SlitArray")
            pitch = _pitches[0]
            for length in _lengths:
                j += 1
                i = -1

                for width in _widths:
                    # for pitch in pitches:
                    i += 1
                    if i % 3 == 0:
                        j += 1  # Move to array to next line
                        i = 0  # Restart at left

                    nx = int(array_width / (length + spacing))
                    ny = int(array_height / pitch)
                    # Define the slits
                    slit = Cell("Slits")
                    rect = Rectangle((-length / 2., -width / 2.),
                                     (length / 2., width / 2.),
                                     layer=l)
                    slit.add(rect)
                    slits = CellArray(slit, nx, ny, (length + spacing, pitch))
                    slits.translate((-(nx - 1) * (length + spacing) / 2.,
                                     -(ny - 1) * pitch / 2.))
                    slit_array = Cell("SlitArray")
                    slit_array.add(slits)
                    text = Label('w/p/l\n%i/%i/%i' %
                                 (width * 1000, pitch, length),
                                 5,
                                 layer=l)
                    lbl_vertical_offset = 1.35
                    if j % 2 == 0:
                        text.translate(
                            tuple(
                                np.array(-text.bounding_box.mean(0)) +
                                np.array((0,
                                          -array_height / lbl_vertical_offset))
                            ))  # Center justify label
                    else:
                        text.translate(
                            tuple(
                                np.array(-text.bounding_box.mean(0)) +
                                np.array((0, array_height / lbl_vertical_offset
                                          ))))  # Center justify label
                    slit_array.add(text)
                    manyslits.add(
                        slit_array,
                        origin=((array_width + array_spacing) * i,
                                (array_height + 2. * array_spacing) * j -
                                array_spacing / 2.))

        # This is an ugly hack to center rotated slits, should fix this properly...
        hacky_offset_x = 200 if rot_angle == 45 else 0  # TODO: fix this ugly thing
        hacky_offset_y = -25 if rot_angle == 45 else 0

        self.add(manyslits,
                 origin=(-i * (array_width + array_spacing) / 2 +
                         hacky_offset_x, -(j + 1.5) *
                         (array_height + array_spacing) / 2 + hacky_offset_y),
                 rotation=rot_angle)
コード例 #30
0
    def make_branch_array(self, _widths, _lengths, nx, ny, spacing_structs,
                          spacing_arrays, rot_angle, layers):
        if not (type(layers) == list):
            layers = [layers]
        if not (type(_lengths) == list):
            _lengths = [_lengths]
        if not (type(_widths) == list):
            _widths = [_widths]
        l = layers[0]
        _length = _lengths[0]

        manyslits = i = j = None

        slits = []
        for width in _widths:
            slit = Cell("Slit_{:.0f}".format(width * 1000))
            line = Path([[-_length / 2., 0], [_length / 2., 0]],
                        width=width,
                        layer=l)
            slit.add(line)
            slits.append(slit)

        buffers = self.make_branch_device(0.08,
                                          1.0,
                                          _lengths[0] / 2.,
                                          _lengths[0] / 2.,
                                          4,
                                          layers[0],
                                          buffers_only=True)

        many_crosses = Cell("CrossArray")
        x_pos = 0
        y_pos = 0

        array_pitch = (ny - 1) * (
            length + spacing_structs) - spacing_structs + spacing_arrays

        for j, width_vert in enumerate(_widths[::-1]):
            for i, width_horiz in enumerate(_widths):
                # Define a single cross
                cross = Cell("Cross_{:.0f}_{:.0f}".format(
                    width_horiz * 1000, width_vert * 1000))
                cross.add(slits[i])  # Horizontal slit
                cross.add(slits[j], rotation=90)  # Vertical slit
                cross.add(buffers)
                # Define the cross array
                cross_array = Cell("CrossArray_{:.0f}_{:.0f}".format(
                    width_horiz * 1000, width_vert * 1000))
                slit_array = CellArray(
                    cross, nx, ny,
                    (_length + spacing_structs, _length + spacing_structs))
                slit_array.translate(
                    (-(nx - 1) * (_length + spacing_structs) / 2.,
                     (-(ny - 1) * (_length + spacing_structs) / 2.)))
                cross_array.add(slit_array)
                many_crosses.add(cross_array, origin=(x_pos, y_pos))
                x_pos += array_pitch
            y_pos += array_pitch
            x_pos = 0

        # Make the labels
        lbl_cell = Cell("Lbl_Cell")
        for i, width in enumerate(_widths):
            text_string = 'W{:.0f}'.format(width * 1000)
            text = Label(text_string, 5, layer=l)
            text.translate(tuple(np.array(-text.bounding_box.mean(0))))
            x_offset = -1.5 * array_pitch + i * array_pitch
            text.translate(np.array((x_offset, 0)))  # Center justify label
            lbl_cell.add(text)

        centered_cell = Cell('Centered_Cell')
        bbox = np.mean(many_crosses.bounding_box, 0)  # Get center of cell

        centered_cell.add(many_crosses, origin=tuple(-bbox))
        lbl_vertical_offset = 1.5
        centered_cell.add(lbl_cell, origin=(0, -bbox[1] * lbl_vertical_offset))
        centered_cell.add(lbl_cell,
                          origin=(-bbox[1] * lbl_vertical_offset, 0),
                          rotation=90)

        self.add(centered_cell, rotation=rot_angle)