def makeAlignMarkers(self, t, w, position, layers, cross=False):
     if not (type(layers) == list): layers = [layers]
     self.aMarkers = Cell("AlignMarkers")
     for l in layers:
         if not (cross):
             am1 = Rectangle((-w / 2., -w / 2.), (w / 2., w / 2.), layer=l)
         elif cross:
             h = w
             crosspts = [(-t / 2., t / 2.), (-t / 2., h / 2.),
                         (t / 2., h / 2.), (t / 2., t / 2.),
                         (w / 2., t / 2.), (w / 2., -t / 2.),
                         (t / 2., -t / 2.), (t / 2., -h / 2.),
                         (-t / 2., -h / 2.), (-t / 2., -t / 2.),
                         (-w / 2., -t / 2.), (-w / 2., t / 2.)]
             am1 = Boundary(crosspts, layer=l)  # Create gdsCAD shape
             # am1 = Polygon(crosspts) #Create shapely polygon for later calculation
         am1 = am1.translate(tuple(position))  # 850,850
         am2 = am1.copy().scale((-1, 1))  # Reflect in x-axis
         am3 = am1.copy().scale((1, -1))  # Reflect in y-axis
         am4 = am1.copy().scale((-1, -1))  # Reflect in both x and y-axis
         self.aMarkers.add([am1, am2, am3, am4])
         self.add(self.aMarkers)
Exemplo n.º 2
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
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
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
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
    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)
                    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))
    def makeSlitArray(self, pitches, spacing, widths, lengths, rotAngle,
                      arrayHeight, arrayWidth, arraySpacing, 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:
            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
                    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, length), 5)
                    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.))

        self.add(manyslits,
                 origin=(-i * (arrayWidth + arraySpacing) / 2,
                         -(j + 1.5) * (arrayHeight + arraySpacing) / 2))