GDSHelpers is an open-source package for automatized pattern generation for nano-structuring.

Overview

GDSHelpers

Build Status Documentation Status GitHub release PyPI DOI

GDSHelpers in an open-source package for automatized pattern generation for nano-structuring. It allows exporting the pattern in the GDSII-format and OASIS-format, which are currently mainly used for describing 2D-masks. Currently, the focus is mainly on photonic and superconducting circuitry. The library consists of growing list of parts, which can be composed into larger circuits.

So far, the following parts are implemented:

  • A waveguide part, allowing easy chaining of bends and straight waveguides.
    • Includes parameterized paths and Bézier curves.
    • Automatic smooth connection to a target point/port
    • The size of the waveguide can be tapered (linear or by a user defined function), which can e.g. be used for optical edge coupling or electronic contact pads
    • Allows to design slot-waveguides and coplanar waveguides (with arbitrary number of rails)
  • Different types of splitters:
    • Y-splitter
    • MMI-splitters
    • Directional splitter
  • Couplers
    • Grating couplers (allowing apodized gratings)
    • Tapers for hybrid 3D-integration
  • Ring and racetrack resonators
  • Mach-Zehnder interferometers
  • Strip to slot mode converter
  • Spirals
  • Superconducting nanowire single photon detectors (SNSPDs)
  • Superconducting nanoscale Transistors (NTRONs)
  • Different types of markers
  • QRcodes
  • A possibility to include images
  • Text-elements for labeling the structures
  • GDSII-import

Besides this it also allows to perform conveniently operations on the design, like:

  • Convert the pattern for usage of positive resist
  • Create holes around the circuitry, which is e.g. necessary for under-etching
  • Shapely-operations can also be applied on the generated structures, e.g. shrinking or inflating of the geometry
  • Surrounding the structures with holes in a rectangular lattice and filling waveguides with holes in a honeycomb lattice for controlling vortex dynamics

The structures are organized in cells, which allow:

  • Adding structures on multiple layers
  • Adding cells into other cells, the cells can be added with an offset with respect to the parent cell and can be rotated
  • Storing additional information, which can be used for saving design parameters
  • Automatized generation of region layers
  • Parallelized export

Additionally the structures can conveniently be simulated by:

  • Using the meep integration (FDTD)

Finally, there are also different formats in which the pattern can be exported:

  • The GDSII-format, which is quite often used for (electron beam/...)-lithography
  • The OASIS-format, which one of the successors of the GDSII-format
  • To an 2D-image
  • To stl-objects which are useful e.g. for 3D-renderings
  • Directly to a blender-file or an rendered 3D-image

Citing GDSHelpers

We would appreciate if you cite the following paper in your publications for which you used GDSHelpers:

Helge Gehring, Matthias Blaicher, Wladick Hartmann, and Wolfram H. P. Pernice, "Python based open source design framework for integrated nanophotonic and superconducting circuitry with 2D-3D-hybrid integration" OSA Continuum 2, 3091-3101 (2019)

Documentation

You can find the documentation on readthedocs. If you have problems using GDSHelpers don't hesitate to contact us using Discussions or send me a mail.

Installation

The GDSHelpers can be installed via pip using (more details in the installation documentation)

pip install gdshelpers
Comments
  • Rounding & Spacing Issue when writing Cell Array to gdsii

    Rounding & Spacing Issue when writing Cell Array to gdsii

    https://github.com/HelgeGehring/gdshelpers/blob/96cfe541c18360dc8a8902fa723b7b5edfabbe72/gdshelpers/export/gdsii_export.py#L82-L84

    So I am trying to implement 2 cells within a cell as an array. I am using the standard micron as the unit, but I am trying to have increased precision to 0.1nm [10000 grid steps per micron]. When I make the spacing equal micron steps apart, it works. When they are not, there is a spacing issue. I am pretty sure the problem is here in the code referenced above as internally the spacing kept in the gdspy_cell->references->spacing is correct. The code shown seems to round before the points are scaled by the grid_steps_per_unit rather than after, which I think is causing my problem.

    opened by Trajectory989 4
  • Add Waveguide.add_route_straight_to_port

    Add Waveguide.add_route_straight_to_port

    Add method add_route_straight_to_port to Waveguide. Allows routing a straight segment to a target port and tapers the width linearly on the way.

    This can be used for electrode contact pads etc.

    route_port

    enhancement 
    opened by fbeutel 4
  • issue about Boolean operation: difference

    issue about Boolean operation: difference

    Thanks for gdshelpers, this package is amazing!

    When I used the boolean operation difference(), I got a small problem as shown in the figure, and it may occurr at the junction of the arc and the spiral. If I changed the parameter num, this issue would disapear. I don't know how to fix it. I tried to get the same layout by boolean operation not from gdspy package, and it looked correct.

    result_difference

    The code is attached below.

    from gdshelpers.geometry.chip import Cell
    from gdshelpers.parts.spiral import Spiral
    from gdshelpers.geometry import geometric_union
    
    # create the spiral
    spiral = Spiral(origin=(0,0), angle=0, width=0.45, num=16, gap=3, inner_gap=30)
    
    # get the shapely 
    device = geometric_union([spiral])
    # Boolean operation: difference
    buffer_device = device.buffer(3)
    buffer_not_device = buffer_device.difference(device)
    
    cell = Cell('cell_difference')
    cell.add_to_layer(1, buffer_not_device)
    # Here don't use cell.show() to verify the issue, and use cell.save() please.
    cell.save('gdshelpers_difference.gds')
    
    
    # And I found it's OK if I use "not" from gdspy.boolean()
    from gdshelpers.geometry import convert_to_layout_objs
    import gdspy
    # STEP 1: 
    lib = gdspy.GdsLibrary(precision = 1e-10)
    
    # create a new cell to save 
    cell_gdspy = lib.new_cell("cell_not_gdspy")
    
    geo1 = convert_to_layout_objs(buffer_device,library='gdspy')
    geo2 = convert_to_layout_objs(device,library='gdspy')
    inv = gdspy.boolean(geo1, geo2, "not")
    
    cell_gdspy.add(inv)
    lib.write_gds("gdspy_not.gds")
    bug 
    opened by HoneyGump 4
  • Waveguide.add_parameterized_path fails with multiple widths

    Waveguide.add_parameterized_path fails with multiple widths

    This seems to be a regression, because I think it worked before, but the following produces an error:

    wg = Waveguide([0, 0], 0, [1, 2, 1])
    wg.add_parameterized_path(lambda t: [10*t, 10*t])
    wg.get_shapely_object()
    

    Error:

    Traceback (most recent call last):
      File "gdshelpers/tests/test_waveguide.py", line 40, in test_waveguide_multiple_widths
        wg.add_parameterized_path(some_path)
      File "gdshelpers/parts/waveguide.py", line 275, in add_parameterized_path
        poly_path_1 = sample_coordinates + start[..., None] * sample_coordinates_d1_normed_ortho
    ValueError: operands could not be broadcast together with shapes (3,1) (28,2) 
    

    I opened a pull request which adds a failing test case: #26

    bug 
    opened by fbeutel 2
  • First example Script error

    First example Script error

    Hi @HelgeGehring,

    The first example script is flawed:

    1. numpy is missing
    2. Something is wrong with gdshelpers.parts.logo:
    ~/.local/lib/python3.7/site-packages/gdshelpers/parts/logo.py in get_shapely_object(self)
        180             # WWU width = 368.93 = 369     *M2 == w
        181             # box width unscaled = w = 336
    --> 182             m2 = w / 369.  # scale width of WWU to width of logo
        183             m = self.height / (h + 10 + 114)  # scaling factor height
        184 
    

    the code works with numpy and without logo:

    import numpy as np
    from gdshelpers.geometry.chip import Cell
    from gdshelpers.parts.waveguide import Waveguide
    from gdshelpers.parts.coupler import GratingCoupler
    from gdshelpers.parts.resonator import RingResonator
    from gdshelpers.parts.splitter import Splitter
    #from gdshelpers.parts.logo import KITLogo, WWULogo
    from gdshelpers.parts.optical_codes import QRCode
    from gdshelpers.parts.text import Text
    from gdshelpers.parts.marker import CrossMarker
    
    # Generate a coupler with parameters from the coupler database
    coupler1 = GratingCoupler.make_traditional_coupler_from_database([0, 0], 1, 'sn330', 1550)
    coupler2 = GratingCoupler.make_traditional_coupler_from_database([150, 0], 1, 'sn330', 1550)
    
    coupler1_desc = coupler1.get_description_text(side='left')
    coupler2_desc = coupler2.get_description_text(side='right')
    
    # And add a simple waveguide to it
    wg1 = Waveguide.make_at_port(coupler1.port)
    wg1.add_straight_segment(10)
    wg1.add_bend(-np.pi/2, 10, final_width=1.5)
    
    res = RingResonator.make_at_port(wg1.current_port, gap=0.1, radius=20,
                                     race_length=10, res_wg_width=0.5)
    
    wg2 = Waveguide.make_at_port(res.port)
    wg2.add_straight_segment(30)
    splitter = Splitter.make_at_root_port(wg2.current_port, total_length=20, sep=10, wg_width_branches=1.0)
    
    wg3 = Waveguide.make_at_port(splitter.right_branch_port)
    wg3.add_route_single_circle_to_port(coupler2.port)
    
    # Add a marker just for fun
    marker = CrossMarker.make_traditional_paddle_markers(res.center_coordinates)
    
    # The fancy stuff
    #kit_logo = KITLogo([25, 0], 10)
    #wwu_logo = WWULogo([100, 30], 30, 2)
    qr_code = QRCode([25, -40], 'https://www.uni-muenster.de/Physik.PI/Pernice', 1.0)
    dev_label = Text([100, 0], 10, 'A0', alignment='center-top')
    
    # Create a Cell to hold the objects
    cell = Cell('EXAMPLE')
    
    # Convert parts to gdsCAD polygons
    cell.add_to_layer(1, coupler1, wg1, res, wg2, splitter, wg3, coupler2)
    #cell.add_to_layer(2, wwu_logo, kit_logo, qr_code, dev_label)
    cell.add_to_layer(2, marker)
    cell.add_to_layer(3, coupler1_desc, coupler2_desc)
    cell.show()
    

    best, quearitis

    opened by quaeritis 2
  • Allow to set the last derivative point in add_parameterized_path

    Allow to set the last derivative point in add_parameterized_path

    Since add_parameterized_path has no information about how the waveguide will proceed afterwards, it can be useful to set the last point in the list of derivatives.

    opened by fbeutel 2
  • convert_to_positive_resist: Allow clearance features and exclusion features

    convert_to_positive_resist: Allow clearance features and exclusion features

    Allows specifying clearance_features: useful when building e.g. DLW tapers with positive resist image

    When reusing cells (e.g. grating couplers on one cell) which have interfaces to other features the interface must not be covered with the positive resist but must remain open. This allows to specify exclusion zones at these interfaces. image

    opened by fbeutel 1
  • Update waveguide.py

    Update waveguide.py

    changed line 283 from "...lower radii..." to "...larger radii..."

    If the outer lines of a parameterized wg intersect, a larger radius or smaller wg must be used.

    opened by jr2701 1
  • Allow to limit the max number of workers when exporting in parallel

    Allow to limit the max number of workers when exporting in parallel

    I ran into some out-of-memory errors when too many big cells where involved, limiting the number of workers can help (and might also help if you want to keep using your computer while exporting :) )

    opened by fbeutel 1
  • Create Contributing guide

    Create Contributing guide

    It would be helpful to have a small CONTRIBUTING.md in the root directory with the main instructions and conventions.

    Especially the Flake8 flavor used, so people don't have to look it up in the CI script

    flake8 gdshelpers/ --max-line-length=120

    opened by fbeutel 1
  • Fix waveguide route straight

    Fix waveguide route straight

    All route to port functions expect the target port to be pointing towards the current_port of the waveguide to be routed. This fixes add_route_straight_to_port to be consistent and adds a testcase.

    bug 
    opened by fbeutel 1
  • GDSIIImport's get_as_shapely does not work properly with cell arrays

    GDSIIImport's get_as_shapely does not work properly with cell arrays

    If this is run on a cell array, it does not recognize multiple instantiations....only the original copy at the original origin is placed (like just cellarray[0] and not the others....). See the zip.zip file. Use the Top Cell for copy image zip.zip

    opened by Trajectory989 2
  • Allow cell reuse when creating cells in parallel

    Allow cell reuse when creating cells in parallel

    Sometime, the cell creation is expensive and benefits from parallelization. At the same time, some sub-cells can be reused between cells.

    Currently, this fails because when ProcessPoolExecutor (or similar parallelization structures) are used, sub-cells are pickled and deserialized again. When merging the parallel cells together in the end, comparison for those sub-cells fails because they have no common identity anymore.

    This adds a UUID when a cell is created, such that cells can be identified by their UUID.

    Possible downside is that if a user modifies a sub-cell after it has been pickled, the changes might get lost, but this can easily be avoided by finishing the sub-cell before using it.

    opened by fbeutel 0
  • Desc format

    Desc format

    Suggestion for a new format for the desc output dictionary. This follows more closely the idea of GDSII that each cell is identified by a unique name and can be referenced mulitple times.

    With this new format, the resulting dict will only contain the desc data for each cell once and just store (name) references to the other cells.

    Basically, the resulting dict will look somewhat like this:

    {
        "root": "name_of_root_cell",
        "cells": {
            "name_of_root_cell": {
                "desc": {...},
                "cells": [ <list of all cells referenced by this cell (with origin, angle etc.)>  ]
            },
            "other_cell": {
                "desc": {...},
                "cells": [ <list of all cells referenced by this cell (with origin, angle etc.)>  ]
            },
        }
    }
    
    opened by fbeutel 0
  • Added new spiral part where length can be set

    Added new spiral part where length can be set

    This replaces the old spiral with a new version of an archimedean spiral which allows to set the length. The number of turns required to achieve the length is determined numerically (afaik an analytical solution doesn't exist).

    Different types are supported. Especially for use inside an MZI the inline and inline_rel types are of interest. spiral

    ToDo's before merge:

    • [ ] Update changelog
    • [x] Add to tests
    • [x] Update documentation
    • [x] Allow choosing the spiral direction (752d3b2)
    • [x] Choose an appropriate guess value for the numerical estimation
    enhancement 
    opened by fbeutel 5
Releases(v1.2.1)
  • v1.2.1(Jan 26, 2022)

    • Allow explicit definition of datatype by passing a tuple (layer, datatype) as layer
    • Allow setting the width of LineStrings
    • Angle of sub-cells considered in DLW-data and boundaries
    • Fix GDSII-export: allow negative angles, correct rounding of spacing
    • Allow specifying clearance features and exlusion features for convert_to_positive_resist
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(May 29, 2021)

  • v1.1.4(Jan 31, 2021)

    • Waveguide: added add_left_bend and add_right_bend to make code easier readable
    • added alphanumeric_to_id as an inverse of id_to_alphanumeric
    • allow to limit the numbers of workers for parallel export
    • fixed oasis export
    Source code(tar.gz)
    Source code(zip)
  • v1.1.3(Nov 24, 2020)

    • Grating coupler: make_traditional_coupler now allows to apodize the period of the grating
    • Port: added with_width function to generate a copy of the Port with a certain width
    • Increased precision in add_straight_segment by evaluating derivative
    • Added add_route_straight_to_port to Waveguide
    • Fixed evaluation of width-parameter in add_parametrized_path
    • Stopped testing with Python 3.5, as it reached it's end-of-life and added a warning
    • Deprecated gdsCAD, as it isn't compatible with Python 3
    • Fixed cell.show
    Source code(tar.gz)
    Source code(zip)
  • v1.1.2(Jun 4, 2020)

    • Added scale-parameter to save_image
    • fixed .dxf-export in Cell
    • Waveguide.add_parameterized_path now also supports an array as path_derivative
    • fixed add_dlw_marker, origin can now also be a list
    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Feb 5, 2020)

    • Removed __future__ imports and (object) in class definitions for Python 2
    • create_holes_for_under_etching now allows ovals and rectangles
    • add_route_single_circle_to_port now tapers the waveguide to match the width of the port
    • Bugfixes
    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Dec 3, 2019)

    • Added support for slot waveguides and coplanar waveguides
    • Direct GDSII-export is now the standard GDSII-writer
    • Added function for generating vortex traps
    • Improved shape generation performance of waveguide
    • Strip to slot mode converter added
    • Bugfixes
    Source code(tar.gz)
    Source code(zip)
  • v1.0.4(Sep 3, 2019)

  • v1.0.3(Aug 6, 2019)

    • Structures in Cell are now converted individually for pattern export
    • annotate_write_fields now works with Cells instead of gdscad.Cells
    • fixed some bugs
    Source code(tar.gz)
    Source code(zip)
  • v1.0.2(Jul 30, 2019)

  • v1.0.1(Jul 29, 2019)

A filler visualizer built using python

filler-visualizer 42 filler のログをビジュアライズしてスポーツさながら楽しむことができます! Usage (標準入力でvisualizer.pyに渡せばALL OK) 1. 既にあるログをビジュアライズする $ ./filler_vm -t 3 -p1 john_fill

Takumi Hara 1 Nov 04, 2021
Info for The Great DataTas plot-a-thon

The Great DataTas plot-a-thon Datatas is organising a Data Visualisation competition: The Great DataTas plot-a-thon We will be using Tidy Tuesday data

2 Nov 21, 2021
Declarative statistical visualization library for Python

Altair http://altair-viz.github.io Altair is a declarative statistical visualization library for Python. With Altair, you can spend more time understa

Altair 8k Jan 05, 2023
A python script and steps to display locations of peers connected to qbittorrent

A python script (along with instructions) to display the locations of all the peers your qBittorrent client is connected to in a Grafana worldmap dash

62 Dec 07, 2022
A Python library created to assist programmers with complex mathematical functions

libmaths was created not only as a learning experience for me, but as a way to make mathematical models in seconds for Python users using mat

Simple 73 Oct 02, 2022
Matplotlib colormaps from the yt project !

cmyt Matplotlib colormaps from the yt project ! Colormaps overview The following colormaps, as well as their respective reversed (*_r) versions are av

The yt project 5 Sep 16, 2022
Python+Numpy+OpenGL: fast, scalable and beautiful scientific visualization

Python+Numpy+OpenGL: fast, scalable and beautiful scientific visualization

Glumpy 1.1k Jan 05, 2023
This is a small program that prints a user friendly, visual representation, of your current bsp tree

bspcq, q for query A bspc analyzer (utility for bspwm) This is a small program that prints a user friendly, visual representation, of your current bsp

nedia 9 Apr 24, 2022
Plotting library for IPython/Jupyter notebooks

bqplot 2-D plotting library for Project Jupyter Introduction bqplot is a 2-D visualization system for Jupyter, based on the constructs of the Grammar

3.4k Dec 30, 2022
This is a Boids Simulation, written in Python with Pygame.

PyNBoids A Python Boids Simulation This is a Boids simulation, written in Python3, with Pygame2 and NumPy. To use: Save the pynboids_sp.py file (and n

Nik 17 Dec 18, 2022
This repository contains a streaming Dataflow pipeline written in Python with Apache Beam, reading data from PubSub.

Sample streaming Dataflow pipeline written in Python This repository contains a streaming Dataflow pipeline written in Python with Apache Beam, readin

Israel Herraiz 9 Mar 18, 2022
🐍PyNode Next allows you to easily create beautiful graph visualisations and animations

PyNode Next A complete rewrite of PyNode for the modern era. Up to five times faster than the original PyNode. PyNode Next allows you to easily create

ehne 3 Feb 12, 2022
Arras.io Highest Scores Over Time Bar Chart Race

Arras.io Highest Scores Over Time Bar Chart Race This repo contains a python script (make_racing_bar_chart.py) that can generate a csv file which can

Road 2 Jan 16, 2022
Render Jupyter notebook in the terminal

jut - JUpyter notebook Terminal viewer. The command line tool view the IPython/Jupyter notebook in the terminal. Install pip install jut Usage $jut --

Kracekumar 169 Dec 27, 2022
This is a learning tool and exploration app made using the Dash interactive Python framework developed by Plotly

Support Vector Machine (SVM) Explorer This app has been moved here. This repo is likely outdated and will not be updated. This is a learning tool and

Plotly 150 Nov 03, 2022
Using SQLite within Python to create database and analyze Starcraft 2 units data (Pandas also used)

SQLite python Starcraft 2 English This project shows the usage of SQLite with python. To create, modify and communicate with the SQLite database from

1 Dec 30, 2021
IPython/Jupyter notebook module for Vega and Vega-Lite

IPython Vega IPython/Jupyter notebook module for Vega 5, and Vega-Lite 4. Notebooks with embedded visualizations can be viewed on GitHub and nbviewer.

Vega 335 Nov 29, 2022
ICS-Visualizer is an interactive Industrial Control Systems (ICS) network graph that contains up-to-date ICS metadata

ICS-Visualizer is an interactive Industrial Control Systems (ICS) network graph that contains up-to-date ICS metadata (Name, company, port, user manua

QeeqBox 2 Dec 13, 2021
A tool for creating Toontown-style nametags in Panda3D

Toontown-Nametag Toontown-Nametag is a tool for creating Toontown Online/Toontown Rewritten-style nametags in Panda3D. It contains a function, createN

BoggoTV 2 Dec 23, 2021
Monochromatic colorscheme for matplotlib with opinionated sensible default

Monochromatic colorscheme for matplotlib with opinionated sensible default If you need a simple monochromatic colorscheme for your matplotlib figures,

Aria Ghora Prabono 2 May 06, 2022