Exemplo n.º 1
0
 def LinesCell(self,
               pas=50,
               Yl=Y_SIZE - 2 * X_OFF - Far_from_border,
               name='Lines_Grating'):
     """ a straight wg series with different width """
     Lines = gdspy.Cell(name)
     for i in range(self.Nmax_ch):
         wg = pc.Waveguide([(pas * i, Far_from_border), (pas * i, Yl)],
                           self.wgt_ch[i])
         tk.add(Lines, wg)
         if name == 'Lines_Grating':
             gc_top = pc.GratingCouplerFocusing(
                 self.wgt_ch[i],
                 focus_distance=self.grating_focusing_distance,
                 width=self.grating_width,
                 length=self.grating_length,
                 period=0.7,
                 dutycycle=0.4,
                 wavelength=0.6,
                 sin_theta=np.sin(np.pi * 8 / 180),
                 **wg.portlist["input"])
             tk.add(Lines, gc_top)
             gc_down = pc.GratingCouplerFocusing(
                 self.wgt_ch[i],
                 focus_distance=self.grating_focusing_distance,
                 width=self.grating_width,
                 length=self.grating_length,
                 period=0.7,
                 dutycycle=0.4,
                 wavelength=0.6,
                 sin_theta=np.sin(np.pi * 8 / 180),
                 **wg.portlist["output"])
             tk.add(Lines, gc_down)
         elif name == 'Lines_Taper':
             tp_bot = pc.Taper(self.wgt_ch[i],
                               length=50.0,
                               end_width=self.Taper_out,
                               end_clad_width=0,
                               extra_clad_length=0,
                               **wg.portlist["input"])
             tk.add(Lines, tp_bot)
             tp_up = pc.Taper(self.wgt_ch[i],
                              length=50.0,
                              end_width=self.Taper_out,
                              end_clad_width=0,
                              extra_clad_length=0,
                              **wg.portlist["output"])
             tk.add(Lines, tp_up)
             wg_taper_bot=pc.Waveguide([tp_bot.portlist["output"]["port"], \
                                        (tp_bot.portlist["output"]["port"][0], Far_from_border-2000)],self.Taper_wg_Template)
             tk.add(Lines, wg_taper_bot)
             wg_taper_up=pc.Waveguide([tp_up.portlist["output"]["port"], \
                                   (tp_up.portlist["output"]["port"][0], Y_SIZE-2*X_OFF-Far_from_border+2000)],self.Taper_wg_Template)
             tk.add(Lines, wg_taper_up)
     return Lines
Exemplo n.º 2
0
import gdspy
from picwriter import toolkit as tk
import picwriter.components as pc

top = gdspy.Cell("top")

top.add(gdspy.Rectangle((0, 0), (1000, 1000), layer=100, datatype=0))

wgt = pc.WaveguideTemplate(
    wg_width=0.45,
    clad_width=10.0,
    bend_radius=100,
    resist="+",
    fab="ETCH",
    wg_layer=1,
    wg_datatype=0,
    clad_layer=2,
    clad_datatype=0,
)
wg = pc.Waveguide([(25, 25), (975, 25), (975, 500), (25, 500), (25, 975),
                   (975, 975)], wgt)

tk.add(top, wg)

tk.build_mask(top, wgt, final_layer=3, final_datatype=0)

gdspy.LayoutViewer()
gdspy.write_gds("tutorial.gds", unit=1.0e-6, precision=1.0e-9)
Exemplo n.º 3
0
def compute_transmission_spectra(
    pic_component,
    mstack,
    wgt,
    ports,
    port_vcenter,
    port_height,
    port_width,
    res,
    wl_center,
    wl_span,
    boolean_operations=None,
    norm=False,
    input_pol="TE",
    nfreq=100,
    dpml=0.5,
    fields=False,
    plot_window=False,
    source_offset=0.1,
    symmetry=None,
    skip_sim=False,
    output_directory="meep-sim",
    parallel=False,
    n_p=2,
):
    """ Launches a MEEP simulation to compute the transmission/reflection spectra from each of the component's ports when light enters at the input `port`.

    How this function maps the GDSII layers to the material stack is something that will be improved in the future.  Currently works well for 1 or 2 layer devices.
    **Currently only supports components with port-directions that are `EAST` (0) or `WEST` (pi)**

    Args:
       * **pic_component** (gdspy.Cell): Cell object (component of the PICwriter library)
       * **mstack** (MaterialStack): MaterialStack object that maps the gds layers to a physical stack
       * **wgt** (WaveguideTemplate): Waveguide template
       * **ports** (list of `Port` dicts): These are the ports to track the Poynting flux through.  **IMPORTANT** The first element of this list is where the Eigenmode source will be input.
       * **port_vcenter** (float): Vertical center of the waveguide
       * **port_height** (float): Height of the port cross-section (flux plane)
       * **port_width** (float): Width of the port cross-section (flux plane)
       * **res** (int): Resolution of the MEEP simulation
       * **wl_center** (float): Center wavelength (in microns)
       * **wl_span** (float): Wavelength span (determines the pulse width)

    Keyword Args:
       * **boolean_operations** (list): A list of specified boolean operations to be performed on the layers (ORDER MATTERS).  In the following format:
           [((layer1/datatype1), (layer2/datatype2), operation), ...] where 'operation' can be 'xor', 'or', 'and', or 'not' and the resulting polygons are placed on (layer1, datatype1).  See below for example.
       * **norm** (boolean):  If True, first computes a normalization run (transmission through a straight waveguide defined by `wgt` above.  Defaults to `False`.  If `True`, a WaveguideTemplate must be specified.
       * **input_pol** (String): Input polarization of the waveguide mode.  Must be either "TE" or "TM".  Defaults to "TE" (z-antisymmetric).
       * **nfreq** (int): Number of frequencies (wavelengths) to compute the spectrum over.  Defaults to 100.
       * **dpml** (float): Length (in microns) of the perfectly-matched layer (PML) at simulation boundaries.  Defaults to 0.5 um.
       * **fields** (boolean): If true, outputs the epsilon and cross-sectional fields.  Defaults to false.
       * **plot_window** (boolean): If true, outputs the spectrum plot in a matplotlib window (in addition to saving).  Defaults to False.
       * **source_offset** (float): Offset (in x-direction) between reflection monitor and source.  Defaults to 0.1 um.
       * **skip_sim** (boolean): Defaults to False.  If True, skips the simulation (and hdf5 export).  Useful if you forgot to perform a normalization and don't want to redo the whole MEEP simulation.
       * **output_directory** (string): Output directory for files generated.  Defaults to 'meep-sim'.
       * **parallel** (boolean): If `True`, will run simulation on `np` cores (`np` must be specified below, and MEEP/MPB must be built from source with parallel-libraries).  Defaults to False.
       * **n_p** (int): Number of processors to run meep simulation on.  Defaults to `2`.


    Example of **boolean_operations** (using the default):
           The following default boolean_operation will:
               (1) do an 'xor' of the default layerset (-1,-1) with a cladding (2,0) and then make this the new default layerset
               (2) do an 'xor' of the cladding (2,0) and waveguide (1,0) and make this the new cladding

            boolean_operations = [((-1,-1), (2,0), 'and'), ((2,0), (1,0), 'xor')]

    """
    from subprocess import call
    import os
    import time

    if boolean_operations == None:
        boolean_operations = [
            ((-1, -1), (wgt.clad_layer, wgt.clad_datatype), "xor"),
            (
                (wgt.clad_layer, wgt.clad_datatype),
                (wgt.wg_layer, wgt.wg_datatype),
                "xor",
            ),
        ]
    """ For each port determine input_direction (useful for computing the sign of the power flux) """
    input_directions = []
    for port in ports:
        if isinstance(port["direction"], float):
            if abs(port["direction"]) < 1e-6:
                input_directions.append(-1)
            elif abs(port["direction"] - np.pi) < 1e-6:
                input_directions.append(1)
            else:
                raise ValueError("Warning! An invalid float port direction (" +
                                 str(port["direction"]) +
                                 ") was provided.  Must be 0 or pi.")
        elif isinstance(port["direction"], (str, bytes)):
            if port["direction"] == "EAST":
                input_directions.append(-1)
            elif port["direction"] == "WEST":
                input_directions.append(1)
            else:
                raise ValueError(
                    "Warning! An invalid string port direction (" +
                    str(port["direction"]) +
                    ") was provided.  Must be `EAST` or `WEST`.")
        else:
            raise ValueError(
                "Warning! A port was given in `ports` that is not a valid type!"
            )

    if norm and wgt == None:
        raise ValueError(
            "Warning! A normalization run was called, but no WaveguideTemplate (wgt) was provided."
        )
    """ If a normalization run is specified, create short waveguide component, then simulate
    """
    if norm:
        import picwriter.toolkit as tk
        import picwriter.components as pc

        norm_component = gdspy.Cell(tk.getCellName("norm_straightwg"))
        wg1 = pc.Waveguide([(0, 0), (1, 0)], wgt)
        wg2 = pc.Waveguide([(1, 0), (2, 0)], wgt)
        wg3 = pc.Waveguide([(2, 0), (3, 0)], wgt)
        tk.add(norm_component, wg1)
        tk.add(norm_component, wg2)
        tk.add(norm_component, wg3)

        flatcell = norm_component.flatten()
        bb = flatcell.get_bounding_box()
        sx, sy, sz = bb[1][0] - bb[0][0], mstack.vsize, bb[1][1] - bb[0][1]
        center = ((bb[1][0] + bb[0][0]) / 2.0, 0, (bb[1][1] + bb[0][1]) / 2.0)

        norm_ports = [wg2.portlist["input"], wg2.portlist["output"]]

        eps_norm_input_file = str("epsilon-norm.h5")
        export_component_to_hdf5(eps_norm_input_file, norm_component, mstack,
                                 boolean_operations)
        #        convert_to_hdf5(eps_norm_input_file, norm_component, mstack, sx, sz, 1.5*res)

        # Launch MEEP simulation using correct inputs
        port_string = ""
        for port in norm_ports:
            port_string += str(port["port"][0]) + " " + str(
                port["port"][1]) + " "
        port_string = str(port_string[:-1])

        if parallel:
            exec_str = ("mpirun -np %d"
                        " python mcts.py"
                        " -fields %r"
                        " -input_pol %s"
                        " -output_directory '%s/%s'"
                        " -eps_input_file '%s/%s'"
                        " -res %d"
                        " -nfreq %d"
                        " -input_direction %d"
                        " -dpml %0.3f"
                        " -wl_center %0.3f"
                        " -wl_span %0.3f"
                        " -port_vcenter %0.3f"
                        " -port_height %0.3f"
                        " -port_width %0.3f"
                        " -source_offset %0.3f"
                        " -center_x %0.3f"
                        " -center_y %0.3f"
                        " -center_z %0.3f"
                        " -sx %0.3f"
                        " -sy %0.3f"
                        " -sz %0.3f"
                        " -port_coords %r"
                        " > '%s/%s-norm-res%d.out'") % (
                            int(n_p),
                            False,
                            input_pol,
                            str(os.getcwd()),
                            str(output_directory),
                            str(os.getcwd()),
                            eps_norm_input_file,
                            res,
                            nfreq,
                            input_directions[0],
                            float(dpml),
                            float(wl_center),
                            float(wl_span),
                            float(port_vcenter),
                            float(port_height),
                            float(port_width),
                            float(source_offset),
                            float(center[0]),
                            float(center[1]),
                            float(center[2]),
                            float(sx),
                            float(sy),
                            float(sz),
                            port_string,
                            str(os.getcwd()),
                            str(output_directory),
                            res,
                        )
        else:
            exec_str = ("python mcts.py"
                        " -fields %r"
                        " -input_pol %s"
                        " -output_directory '%s/%s'"
                        " -eps_input_file '%s/%s'"
                        " -res %d"
                        " -nfreq %d"
                        " -input_direction %d"
                        " -dpml %0.3f"
                        " -wl_center %0.3f"
                        " -wl_span %0.3f"
                        " -port_vcenter %0.3f"
                        " -port_height %0.3f"
                        " -port_width %0.3f"
                        " -source_offset %0.3f"
                        " -center_x %0.3f"
                        " -center_y %0.3f"
                        " -center_z %0.3f"
                        " -sx %0.3f"
                        " -sy %0.3f"
                        " -sz %0.3f"
                        " -port_coords %r"
                        " > '%s/%s-norm-res%d.out'") % (
                            False,
                            input_pol,
                            str(os.getcwd()),
                            str(output_directory),
                            str(os.getcwd()),
                            eps_norm_input_file,
                            res,
                            nfreq,
                            input_directions[0],
                            float(dpml),
                            float(wl_center),
                            float(wl_span),
                            float(port_vcenter),
                            float(port_height),
                            float(port_width),
                            float(source_offset),
                            float(center[0]),
                            float(center[1]),
                            float(center[2]),
                            float(sx),
                            float(sy),
                            float(sz),
                            port_string,
                            str(os.getcwd()),
                            str(output_directory),
                            res,
                        )
        dir_path = os.path.dirname(os.path.realpath(__file__))
        print("Running MEEP normalization... (straight waveguide)")
        start = time.time()
        call(exec_str, shell=True, cwd=dir_path)
        print("Time to run MEEP normalization = " + str(time.time() - start) +
              " seconds")

        grep_str = "grep flux1: '%s/%s-norm-res%d.out' > '%s/%s-norm-res%d.dat'" % (
            str(os.getcwd()),
            str(output_directory),
            res,
            str(os.getcwd()),
            str(output_directory),
            res,
        )
        call(grep_str, shell="True")

    # Get size, center of simulation window
    flatcell = pic_component.flatten()
    bb = flatcell.get_bounding_box()
    sx, sy, sz = bb[1][0] - bb[0][0], mstack.vsize, bb[1][1] - bb[0][1]
    center = ((bb[1][0] + bb[0][0]) / 2.0, 0, (bb[1][1] + bb[0][1]) / 2.0)

    # Convert the structure to an hdf5 file
    eps_input_file = str("epsilon-component.h5")
    export_component_to_hdf5(eps_input_file, pic_component, mstack,
                             boolean_operations)

    # Launch MEEP simulation using correct inputs
    port_string = ""
    for port in ports:
        port_string += str(port["port"][0]) + " " + str(port["port"][1]) + " "
    port_string = str(port_string[:-1])

    if parallel:
        exec_str = ("mpirun -np %d"
                    " python mcts.py"
                    " -fields %r"
                    " -input_pol %s"
                    " -output_directory '%s/%s'"
                    " -eps_input_file '%s/%s'"
                    " -res %d"
                    " -nfreq %d"
                    " -input_direction %d"
                    " -dpml %0.3f"
                    " -wl_center %0.3f"
                    " -wl_span %0.3f"
                    " -port_vcenter %0.3f"
                    " -port_height %0.3f"
                    " -port_width %0.3f"
                    " -source_offset %0.3f"
                    " -center_x %0.3f"
                    " -center_y %0.3f"
                    " -center_z %0.3f"
                    " -sx %0.3f"
                    " -sy %0.3f"
                    " -sz %0.3f"
                    " -port_coords %r"
                    " > '%s/%s-res%d.out'") % (
                        int(n_p),
                        fields,
                        input_pol,
                        str(os.getcwd()),
                        str(output_directory),
                        str(os.getcwd()),
                        eps_input_file,
                        res,
                        nfreq,
                        input_directions[0],
                        float(dpml),
                        float(wl_center),
                        float(wl_span),
                        float(port_vcenter),
                        float(port_height),
                        float(port_width),
                        float(source_offset),
                        float(center[0]),
                        float(center[1]),
                        float(center[2]),
                        float(sx),
                        float(sy),
                        float(sz),
                        port_string,
                        str(os.getcwd()),
                        str(output_directory),
                        res,
                    )
    else:
        exec_str = ("python mcts.py"
                    " -fields %r"
                    " -input_pol %s"
                    " -output_directory '%s/%s'"
                    " -eps_input_file '%s/%s'"
                    " -res %d"
                    " -nfreq %d"
                    " -input_direction %d"
                    " -dpml %0.3f"
                    " -wl_center %0.3f"
                    " -wl_span %0.3f"
                    " -port_vcenter %0.3f"
                    " -port_height %0.3f"
                    " -port_width %0.3f"
                    " -source_offset %0.3f"
                    " -center_x %0.3f"
                    " -center_y %0.3f"
                    " -center_z %0.3f"
                    " -sx %0.3f"
                    " -sy %0.3f"
                    " -sz %0.3f"
                    " -port_coords %r"
                    " > '%s/%s-res%d.out'") % (
                        fields,
                        input_pol,
                        str(os.getcwd()),
                        str(output_directory),
                        str(os.getcwd()),
                        eps_input_file,
                        res,
                        nfreq,
                        input_directions[0],
                        float(dpml),
                        float(wl_center),
                        float(wl_span),
                        float(port_vcenter),
                        float(port_height),
                        float(port_width),
                        float(source_offset),
                        float(center[0]),
                        float(center[1]),
                        float(center[2]),
                        float(sx),
                        float(sy),
                        float(sz),
                        port_string,
                        str(os.getcwd()),
                        str(output_directory),
                        res,
                    )

    dir_path = os.path.dirname(os.path.realpath(__file__))
    if skip_sim == False:
        print(
            "Running MEEP simulation... (check .out file for current status)")
        start = time.time()
        call(exec_str, shell=True, cwd=dir_path)
        print("Time to run MEEP simulation = " + str(time.time() - start) +
              " seconds")

    grep_str = "grep flux1: '%s/%s-res%d.out' > '%s/%s-res%d.dat'" % (
        str(os.getcwd()),
        str(output_directory),
        res,
        str(os.getcwd()),
        str(output_directory),
        res,
    )
    call(grep_str, shell="True")
    """ Grab data and plot transmission/reflection spectra
    """
    norm_data = np.genfromtxt(
        "%s/%s-norm-res%d.dat" %
        (str(os.getcwd()), str(output_directory), res),
        delimiter=",",
    )
    freq, refl0, trans0 = (
        norm_data[:, 1],
        -norm_data[:, 2],
        norm_data[:, 3],
    )  # refl0 = -norm_data[:,2]
    comp_data = np.genfromtxt(
        "%s/%s-res%d.dat" % (str(os.getcwd()), str(output_directory), res),
        delimiter=",",
    )

    flux_data = []
    for i in range(
            len(ports)
    ):  # Get the power flux-data from the component simulation for each flux-plane
        flux_data.append((-1) * input_directions[i] * comp_data[:, i + 2])

    wavelength = [1.0 / f for f in freq]
    from matplotlib import pyplot as plt

    # Plot a spectrum corresponding to each port (sign is calculated from the port "direction")
    colorlist = ["r-", "b-", "g-", "c-", "m-", "y-"]
    plt.plot(wavelength, (flux_data[0] - refl0) / trans0,
             colorlist[0],
             label="port 0")
    for i in range(len(flux_data) - 1):
        plt.plot(
            wavelength,
            flux_data[i + 1] / trans0,
            colorlist[(i + 1) % len(colorlist)],
            label="port " + str(i + 1),
        )

    plt.xlabel("Wavelength [um]")
    plt.ylabel("Transmission")
    plt.xlim([min(wavelength), max(wavelength)])
    plt.legend(loc="best")
    plt.savefig("%s/%s-res%d.png" %
                (str(os.getcwd()), str(output_directory), res))
    if plot_window:
        plt.show()
    plt.close()

    if fields:
        print("Outputting fields images to " + str(output_directory))
        export_timestep_fields_to_png(str(output_directory))

    return None
Exemplo n.º 4
0
    def Spirales(self, name='Spiral_Grating'):
        spiral_unit = gdspy.Cell(name)
        two_spiral_space = 1200
        deltaY = 0.5 * self.spiral_width
        for i in range(self.Nmax):
            if (i % 2 == 0):
                sp1 = pc.Spiral(
                    self.wgt[i],
                    width=self.spiral_width,
                    length=self.spiral_length,
                    spacing=self.spiral_spacing,
                    parity=1,
                    direction=u'NORTH',
                    port=(
                        100 + (two_spiral_space * i / 2),
                        Y_SIZE / 2 - 1.8 * self.spiral_width +
                        deltaY))  #port is cartisian cordinate of the inputport
                tk.add(spiral_unit, sp1)
                wg1=pc.Waveguide([sp1.portlist["input"]["port"],\
                    (sp1.portlist["input"]["port"][0], Far_from_border)],self.wgt[i])
                tk.add(spiral_unit, wg1)
                sp2 = pc.Spiral(self.wgt[i],
                                width=self.spiral_width,
                                length=self.spiral_length,
                                spacing=self.spiral_spacing,
                                parity=1,
                                direction=u'NORTH',
                                port=(100 + (two_spiral_space * i / 2),
                                      Y_SIZE / 1.8 + deltaY))
            else:
                #-------------------------------------------------------------------------------------------------------------------
                sp1 = pc.Spiral(
                    self.wgt[i],
                    width=self.spiral_width,
                    length=self.spiral_length,
                    spacing=self.spiral_spacing,
                    parity=-1,
                    direction=u'NORTH',
                    port=(
                        100 + (two_spiral_space *
                               (i - 1) / 2 + 0.9 * two_spiral_space),
                        Y_SIZE / 2 - 1.8 * self.spiral_width -
                        deltaY))  #port is cartisian cordinate of the inputport
                tk.add(spiral_unit, sp1)
                wg1=pc.Waveguide([sp1.portlist["input"]["port"],\
                    (sp1.portlist["input"]["port"][0], Far_from_border)],self.wgt[i])
                tk.add(spiral_unit, wg1)
                sp2 = pc.Spiral(
                    self.wgt[i],
                    width=self.spiral_width,
                    length=self.spiral_length,
                    spacing=self.spiral_spacing,
                    parity=-1,
                    direction=u'NORTH',
                    port=(100 + (two_spiral_space *
                                 (i - 1) / 2 + 0.9 * two_spiral_space),
                          Y_SIZE / 1.8 - deltaY))

            tk.add(spiral_unit, sp2)
            wg2=pc.Waveguide([sp1.portlist["output"]["port"], \
                              (sp1.portlist["output"]["port"][0], sp2.portlist["input"]["port"][1])],self.wgt[i])
            tk.add(spiral_unit, wg2)
            wg3=pc.Waveguide([sp2.portlist["output"]["port"], \
                              (sp2.portlist["output"]["port"][0], Y_SIZE-2*X_OFF-Far_from_border)],self.wgt[i])
            tk.add(spiral_unit, wg3)
            if name == 'Spiral_Grating':
                gc_top = pc.GratingCouplerFocusing(
                    self.wgt[i],
                    focus_distance=self.grating_focusing_distance,
                    width=self.grating_width,
                    length=self.grating_length,
                    period=0.7,
                    dutycycle=0.4,
                    wavelength=0.6,
                    sin_theta=np.sin(np.pi * 8 / 180),
                    **wg3.portlist["output"])
                tk.add(spiral_unit, gc_top)
                gc_down = pc.GratingCouplerFocusing(
                    self.wgt[i],
                    focus_distance=self.grating_focusing_distance,
                    width=self.grating_width,
                    length=self.grating_length,
                    period=0.7,
                    dutycycle=0.4,
                    wavelength=0.6,
                    sin_theta=np.sin(np.pi * 8 / 180),
                    **wg1.portlist["output"])
                tk.add(spiral_unit, gc_down)
            elif name == 'Spiral_Taper':
                tp_bot = pc.Taper(self.wgt[i],
                                  length=50.0,
                                  end_width=self.Taper_out,
                                  end_clad_width=0,
                                  extra_clad_length=0,
                                  **wg1.portlist["output"])
                tk.add(spiral_unit, tp_bot)
                tp_up = pc.Taper(self.wgt[i],
                                 length=50.0,
                                 end_width=self.Taper_out,
                                 end_clad_width=0,
                                 extra_clad_length=0,
                                 **wg3.portlist["output"])
                tk.add(spiral_unit, tp_up)
                wg_taper_bot=pc.Waveguide([tp_bot.portlist["output"]["port"], \
                                       (tp_bot.portlist["output"]["port"][0], Far_from_border-2000)],self.Taper_wg_Template)
                tk.add(spiral_unit, wg_taper_bot)
                wg_taper_up=pc.Waveguide([tp_up.portlist["output"]["port"], \
                                           (tp_up.portlist["output"]["port"][0], Y_SIZE-2*X_OFF-Far_from_border+2000)],self.Taper_wg_Template)
                tk.add(spiral_unit, wg_taper_up)
        return spiral_unit
Exemplo n.º 5
0
    clad_datatype=0,
)

gc1 = pc.GratingCouplerFocusing(
    wgt,
    focus_distance=20.0,
    width=20,
    length=40,
    period=1.0,
    dutycycle=0.7,
    port=(100, 0),
    direction="WEST",
)
tk.add(top, gc1)

wg1 = pc.Waveguide([gc1.portlist["output"]["port"], (200, 0)], wgt)
tk.add(top, wg1)

mmi1 = pc.MMI1x2(
    wgt, length=50, width=10, taper_width=2.0, wg_sep=3, **wg1.portlist["output"]
)
tk.add(top, mmi1)

mmi2 = pc.MMI1x2(
    wgt,
    length=50,
    width=10,
    taper_width=2.0,
    wg_sep=3,
    port=(1750, 0),
    direction="WEST",
Exemplo n.º 6
0
        }


if __name__ == "__main__":
    #    from . import *
    import picwriter.components as pc

    top = gdspy.Cell("top")
    wgt = pc.WaveguideTemplate(bend_radius=50, wg_width=0.5, resist="+")

    # Values from Publication
    spline_widths = [
        0.5, 0.5, 0.6, 0.7, 0.9, 1.26, 1.4, 1.4, 1.4, 1.4, 1.31, 1.2, 1.2
    ]
    ysplitter = SplineYSplitter(
        wgt,
        length=2,
        widths=spline_widths,
        taper_width=None,
        taper_length=None,
        output_length=10,
        output_wg_sep=5,
        output_width=0.5,
        port=(0, 0),
        direction="EAST",
    )
    wg1 = pc.Waveguide([(-10, 0), ysplitter.portlist["input"]["port"]], wgt)
    ysplitter.addto(top)
    wg1.addto(top)
    gdspy.LayoutViewer()