How to use the gdspy.LayoutViewer function in gdspy

To help you get started, we’ve selected a few gdspy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heitzmann / gdspy / tools / maketestgds.py View on Github external
cell.add(gdspy.Polygon(c.get_points(), layer=13))
c = gdspy.Curve(0, 3, tolerance=1e-3)
c.i(
    [(1, 2), (2, 1), (3, 2), (4, 0)],
    angles=[numpy.pi * 3 / 4.0, None, None, None, -numpy.pi * 3 / 4.0],
    t_in=[1, 1, 1, 1, 1],
    t_out=[1, 1, 1, 1, 1],
    cycle=True,
)
cell.add(gdspy.Polygon(c.get_points(), layer=14))


### END

lib.write_gds("tests/test.gds")
gdspy.LayoutViewer(lib)
github DerekK88 / PICwriter / picwriter / components / taper.py View on Github external
if __name__ == "__main__":
    from . import *

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

    wg1 = Waveguide([(0, 0), (100, 40)], wgt)
    tk.add(top, wg1)

    tp1 = Taper(wgt, 100.0, 0.3, end_clad_width=50, **wg1.portlist["input"])
    tp2 = Taper(wgt, 100.0, 0.5, end_clad_width=15, **wg1.portlist["output"])
    tk.add(top, tp1)
    tk.add(top, tp2)

    gdspy.LayoutViewer()
    # gdspy.write_gds('taper.gds', unit=1.0e-6, precision=1.0e-9)
github DerekK88 / PICwriter / picwriter / components / bbend.py View on Github external
from . import *

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

    wg1 = Waveguide([(0, 0), (25, 0)], wgt)
    tk.add(top, wg1)

    bb1 = BBend(wgt, [(25, 0), (125, 0), (125, 100), (225, 100)])
    tk.add(top, bb1)

    x, y = bb1.portlist["output"]["port"]
    wg2 = Waveguide([(x, y), (x + 25, y)], wgt)
    tk.add(top, wg2)

    gdspy.LayoutViewer(cells=top, depth=3)
#    gdspy.write_gds('bbend.gds', unit=1.0e-6, precision=1.0e-9)
github stanfordnqp / spins-b / examples / grating_coupler / grating.py View on Github external
# Generate the foreground and background GDS files.
    gds_fg = gdspy.Cell("FOREGROUND", exclude_from_current=True)
    gds_fg.add(waveguide_top)
    gds_fg.add(waveguide_bottom)
    gds_fg.add(design_region)

    gds_bg = gdspy.Cell("BACKGROUND", exclude_from_current=True)
    gds_bg.add(waveguide_top)
    gds_bg.add(waveguide_bottom)

    gdspy.write_gds(gds_fg_name, [gds_fg], unit=1e-9, precision=1e-9)
    gdspy.write_gds(gds_bg_name, [gds_bg], unit=1e-9, precision=1e-9)

    if visualize:
        gdspy.LayoutViewer(cells=[gds_fg])
        gdspy.LayoutViewer(cells=[gds_bg])

    # The BOX layer/silicon device interface is set at `z = 0`.
    #
    # Describe materials in each layer.
    # We actually have four material layers:
    # 1) Silicon substrate
    # 2) Silicon oxide BOX layer
    # 3) Bottom part of grating that is not etched
    # 4) Top part of grating that can be etched.
    #
    # The last two layers put together properly describe a partial etch.
    #
    # Note that the layer numbering in the GDS file is arbitrary. In our case,
    # layer 100 and 101 correspond to actual structure. Layer 300 is a dummy
    # layer; it is used for layers that only have one material (i.e. the
    # background and foreground indices are identical) so the actual structure
github DerekK88 / PICwriter / picwriter / examples / tutorial1.py View on Github external
bend_radius=100,
    resist="+",
    fab="ETCH",
    wg_layer=1,
    wg_datatype=0,
    clad_layer=2,
    clad_datatype=0,
)

top.add(gdspy.Rectangle((0, 0), (1000, 1000), layer=100, datatype=0))
wg = 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("tutorial1.gds", unit=1.0e-6, precision=1.0e-9)
github DerekK88 / PICwriter / picwriter / components / swgcontradc.py View on Github external
**wg1.portlist["output"]
    )
    #    cdc = SWGContraDirectionalCoupler(wgt, length=40.0, gap=0.5, period=0.5, dc=0.5, taper_length=5.0,
    #                                      w_phc_bot=0.0,
    #                                      apodization_top=False,
    #                                      top_angle=np.pi/8,
    #                                      width_top=2.0,
    #                                      width_bot=1.0,
    #                                      extra_swg_length=10.0,
    #                                      input_bot=True,
    #                                      contradc_wgt=contradc_wgt,
    #                                      fins=True,
    #                                      **wg1.portlist["output"])
    tk.add(top, cdc)

    gdspy.LayoutViewer(cells=top)
#    gdspy.write_gds('swgcontradc.gds', unit=1.0e-6, precision=1.0e-9)
github DerekK88 / PICwriter / picwriter / components / stripslotmmiconverter.py View on Github external
bend_radius=50, wg_type="slot", wg_width=0.7, slot=0.2
    )

    wg1 = Waveguide([(0, 0), (100, 30)], wgt_strip)
    tk.add(top, wg1)

    ycoup = StripSlotMMIConverter(
        wgt_strip, wgt_slot, 2.5, 6.0, 20.0, **wg1.portlist["output"]
    )
    tk.add(top, ycoup)

    (x1, y1) = ycoup.portlist["output"]["port"]
    wg2 = Waveguide([(x1, y1), (x1 + 100, y1)], wgt_slot)
    tk.add(top, wg2)

    gdspy.LayoutViewer(cells=top)
#    gdspy.write_gds('StripSlotMMIConverter.gds', unit=1.0e-6, precision=1.0e-9)
github HelgeGehring / gdshelpers / gdshelpers / geometry / chip.py View on Github external
def start_viewer(self):
        import gdspy
        gdspy.LayoutViewer(library=self.get_gdspy_lib(), depth=10)
github BerkeleyPhotonicsGenerator / BPG / gdspy / examples / tutorial.py View on Github external
2: 8,
        3: 9
    })

# Now we extract the cells we want to actually include in our current
# structure. Note that the referenced cells will be automatically
# extracted as well.
gdsii.extract('IMPORT_REFS')

# ------------------------------------------------------------------ #
#      VIEWER
# ------------------------------------------------------------------ #

# View the layout using a GUI.  Full description of the controls can
# be found in the online help at http://gdspy.sourceforge.net/
gdspy.LayoutViewer()