Ejemplo n.º 1
0
        def _generate_elements(self, elems):
            # Waveguide path
            wg_path = [(0.0, 0.0), (self.length, 0.0)]

            # Grating tooth path
            gt_path = [(0.0, 0.0), (self.duty_cycle, 0.0)]

            gap_cycle = self.period - self.duty_cycle
            numperiod = int(np.floor(self.length / self.period))

            # Add waveguide core
            elems += i3.Path(layer=i3.TECH.PPLAYER.WG.COR,
                             shape=wg_path,
                             line_width=self.wg_width)

            # Add grating teeth
            if self.grating_amp > 0.0:
                # grating amplitude has to be non-zero

                ytrans = i3.Translation(
                    (0.0, self.wg_width / 2 + self.grating_amp / 2))
                for ii in range(numperiod):
                    #Start with gap rather than tooth
                    xtrans = i3.Translation(
                        ((gap_cycle + ii * self.period), 0.0))
                    elems += i3.Path(layer=i3.TECH.PPLAYER.WG.COR,
                                     shape=gt_path,
                                     line_width=self.grating_amp,
                                     transformation=(xtrans + ytrans))

                    # draw bottom grating if desired
                    if self.both_sides == True:
                        elems += i3.Path(layer=i3.TECH.PPLAYER.WG.COR,
                                         shape=gt_path,
                                         line_width=self.grating_amp,
                                         transformation=(xtrans - ytrans))

            # Add block layers
            import block_layers as bl
            block_layers = bl.layers
            block_widths = bl.widths
            for ii in range(len(block_layers)):
                elems += i3.Path(layer=block_layers[ii],
                                 shape=wg_path,
                                 line_width=self.wg_width +
                                 2 * self.grating_amp + 2 * block_widths[ii])

            return elems
Ejemplo n.º 2
0
        def _get_electrical_route_elements(self):
            els = []
            for r in self._get_final_electrical_routes():
                els += i3.Path(layer=self.metal1_layer,
                               shape=r,
                               line_width=self.metal1_width)

            return els
Ejemplo n.º 3
0
        def _generate_elements(self, elems):

            elems = super(DropRingAtWavelength.Layout,
                          self)._generate_elements(elems)

            r = self.directional_coupler.bend_radius
            dcl = self.directional_coupler.coupler_length

            # Metal 1
            ring_s = i3.RingSegment(layer=self.layer_heater,
                                    center=(-dcl / 2.0, r),
                                    angle_start=180,
                                    angle_end=270,
                                    inner_radius=r - self.width_m1 / 2.0,
                                    outer_radius=r + self.width_m1 / 2.0)

            elems += ring_s
            trans = [
                i3.HMirror(),
                i3.VMirror(mirror_plane_y=self._get_distance_between_dc() /
                           2.0)
            ]
            trans.append(trans[0] + trans[1])
            for t in trans:
                elems += ring_s.transform_copy(t)

            straights = i3.Path(layer=self.layer_heater,
                                shape=[(-r - dcl / 2.0, r),
                                       (-r - dcl / 2.0,
                                        self._get_distance_between_dc() - r)],
                                line_width=self.width_m1)

            elems += straights
            elems += straights.transform_copy(trans[0])

            top = i3.Path(layer=self.layer_heater,
                          shape=[(-dcl / 2.0, self._get_distance_between_dc()),
                                 (dcl / 2.0, self._get_distance_between_dc())],
                          line_width=self.width_m1)

            elems += top
            return elems
Ejemplo n.º 4
0
 def _generate_elements(self, elems):
     elems = super(LinearWindowWaveguideTransition.Layout,
                   self)._generate_elements(elems)
     # shape_shift = ShapeOffset(original_shape=elems.shape, offset=self.offset)
     fbms_line = i3.ElementList()
     for el in elems:
         if el.layer == i3.TECH.PPLAYER.WG.CLADDING:
             el_shape = el.shape
             el_shape.open()
             fbms_line += [
                 i3.Path(layer=el.layer, shape=el_shape, line_width=0.0)
             ]
     return elems + fbms_line
Ejemplo n.º 5
0
    def get_elements_from_shape(self, shape, termination_offsets=[], **kwargs):
        elems = super(PathTraceWindow, self).get_elements_from_shape(
            shape, termination_offsets=termination_offsets, **kwargs)

        elems = i3.ElementList([
            i3.Path(layer=el.layer,
                    shape=el.centerline_shape,
                    line_width=el.path_line_width)
            if el.path_line_width == 0 else el for el in elems
        ])

        # print([(el.layer, getattr(el, 'line_width', None), type(el)) for el in elems])
        return elems
Ejemplo n.º 6
0
def merge_path(paths):

    ## firstly expand the transformation
    for path in paths:
        path.expand_transform()

    lines = []
    layer = i3.TECH.PPLAYER.NONE.DOC
    paths_in_loop = paths[:]

    for path0 in paths:
        if path0 not in paths_in_loop:
            pass

        else:

            finish_flag = 0
            line = path0.shape.points[:]
            rtol = 0
            atol = 2e-04

            while finish_flag == 0:
                finish_flag = 1
                for path in paths:
                    if path not in paths_in_loop:
                        pass

                    elif np.array_equal(line, path.shape.points[:]):
                        # np.array_equal(line, path.shape.points):
                        # print "enter1"
                        # print path
                        paths_in_loop.remove(path)
                        finish_flag = 0

                    elif np.allclose(line[-1],
                                     path.shape.points[0],
                                     atol=atol,
                                     rtol=rtol):
                        # print "enter3"
                        # print line
                        line = np.concatenate((line, path.shape.points[1:]))
                        # print path.shape.points
                        # print line
                        paths_in_loop.remove(path)
                        finish_flag = 0

                    elif np.allclose(line[0],
                                     path.shape.points[-1],
                                     atol=atol,
                                     rtol=rtol):
                        # print "enter2"
                        # print line
                        line = np.concatenate((path.shape.points[:-1], line))
                        # print path.shape.points
                        # print line
                        paths_in_loop.remove(path)
                        finish_flag = 0

                    elif np.allclose(line[0],
                                     path.shape.points[0],
                                     atol=atol,
                                     rtol=rtol):
                        # print "enter4"
                        line = line[::-1]
                        # print path.shape.points
                        # print line
                        line = np.concatenate((line, path.shape.points[1:]))
                        # print line
                        paths_in_loop.remove(path)
                        finish_flag = 0

                    elif np.allclose(line[-1],
                                     path.shape.points[-1],
                                     atol=atol,
                                     rtol=rtol):
                        # print "enter5"
                        line = line[::-1]
                        # print path.shape.points
                        # print line
                        line = np.concatenate((path.shape.points[:-1], line))
                        # print line
                        paths_in_loop.remove(path)
                        finish_flag = 0

                    else:
                        pass

            lines.append(line)

    merged_path = i3.ElementList()
    for l in lines:
        merged_path += [i3.Path(layer=layer, line_width=0, shape=l)]

    return merged_path
        def _generate_elements(self, elems):
            # Waveguide path
            wg_path = [(0.0, 0.0), (self.length, 0.0)]

            # Grating tooth path
            gt_path = [(0.0, 0.0), (self.duty_cycle, 0.0)]

            gap_cycle = self.period - self.duty_cycle
            numperiod = int(np.floor(self.length / self.period))

            # determine which layer to use
            my_layer = {
                'top': i3.TECH.PPLAYER.AIM.SNAM,
                'bottom': i3.TECH.PPLAYER.AIM.FNAM,
            }[self.nitride_layer]

            # Add waveguide core
            elems += i3.Path(layer=i3.TECH.PPLAYER.WG.COR,
                             shape=wg_path,
                             line_width=self.wg_width)
            if self.grating_type != 'vertical':
                elems += i3.Path(layer=my_layer,
                                 shape=wg_path,
                                 line_width=self.wg_width)

            # Add grating teeth
            ytrans = i3.Translation(
                (0.0, self.wg_width / 2 + self.grating_amp / 2))
            for ii in range(numperiod):
                #Start with gap rather than tooth

                if self.grating_type == 'vertical':
                    # Draw vertically etched tooth
                    xtrans = i3.Translation(
                        ((gap_cycle + ii * self.period), 0.0))
                    elems += i3.Path(layer=my_layer,
                                     shape=gt_path,
                                     line_width=self.wg_width,
                                     transformation=(xtrans))

                elif self.grating_type == 'one_sidewall':
                    # Draw single sided sidewall grating
                    xtrans = i3.Translation(
                        ((gap_cycle + ii * self.period), 0.0))
                    elems += i3.Path(layer=my_layer,
                                     shape=gt_path,
                                     line_width=self.grating_amp,
                                     transformation=(xtrans + ytrans))

                elif self.grating_type == 'two_sidewalls':
                    # Draw double sided sidewall grating
                    xtrans = i3.Translation(
                        ((gap_cycle + ii * self.period), 0.0))
                    elems += i3.Path(layer=my_layer,
                                     shape=gt_path,
                                     line_width=self.grating_amp,
                                     transformation=(xtrans + ytrans))
                    elems += i3.Path(layer=my_layer,
                                     shape=gt_path,
                                     line_width=self.grating_amp,
                                     transformation=(xtrans - ytrans))

                # # draw bottom grating if desired
                # if self.both_sides == True:
                #     elems += i3.Path(layer=i3.TECH.PPLAYER.WG.COR, shape=gt_path, line_width=self.grating_amp,
                #                      transformation=(xtrans - ytrans))

            # Add block layers
            import block_layers as bl
            block_layers = bl.layers
            block_widths = bl.widths
            for ii in range(len(block_layers)):
                elems += i3.Path(layer=block_layers[ii],
                                 shape=wg_path,
                                 line_width=self.wg_width +
                                 2 * self.grating_amp + 2 * block_widths[ii])

            return elems