Skip to content

Commit

Permalink
Merge branch 'master' into feature_meep
Browse files Browse the repository at this point in the history
  • Loading branch information
HelgeGehring committed Dec 28, 2020
2 parents 0775053 + 3edb9a1 commit 2681153
Show file tree
Hide file tree
Showing 37 changed files with 745 additions and 234 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
name: Python package

on: [push]
on:
push:
schedule:
- cron: '0 0 * * 1'

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.5, 3.6, 3.7, 3.8]

os: [ubuntu-latest, windows-latest]
python-version: [ 3.6, 3.7, 3.8, 3.9 ]
steps:
- uses: actions/checkout@v1
- name: Install GEOS library
if: matrix.python-version == 3.8 && matrix.os == 'ubuntu-latest'
run: sudo apt-get install libgeos-dev
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
Expand Down
32 changes: 31 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
Changelog
=========

1.1.0
Unreleased
----------
* 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

1.1.3
-----
* 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

1.1.2
-----
* 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

1.1.1
-----
* 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

1.1.0
-----
* Added support for slot waveguides and coplanar waveguides
* Direct GDSII-export is now the standard GDSII-writer
* Added function for generating vortex traps
Expand Down
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Contributing to GDShelpers
==========================

First off, thanks for contributing!

We're happy about every suggestion, bug-report, question, feature-request and pull-request.

Before you push
---------------
Please execute `flake8 gdshelpers/ --max-line-length=120` and `pytest` in order to assure that your changes
are formatted correctly and everything's working fine.
We also appreciate tests, which check your contributions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ Helge Gehring, Matthias Blaicher, Wladick Hartmann, and Wolfram H. P. Pernice,
OSA Continuum 2, 3091-3101 (2019)

## Documentation
You can find the [documentation on readthedocs](https://gdshelpers.readthedocs.io)
You can find the [documentation on readthedocs](https://gdshelpers.readthedocs.io).
If you have problems using GDSHelpers don't hesitate to contact us using
[Discussions](https://github.com/HelgeGehring/gdshelpers/discussions) or [send me a mail](https://github.com/HelgeGehring).

## Installation
The GDSHelpers can be installed via pip using
Expand Down
6 changes: 6 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ 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" <https://www.osapublishing.org/osac/abstract.cfm?uri=osac-2-11-3091>`_
OSA Continuum 2, 3091-3101 (2019)

Support
_______
If you have problems using GDSHelpers don't hesitate to contact us using
`Discussions <https://github.com/HelgeGehring/gdshelpers/discussions>`_ or `send me a mail <https://github.com/HelgeGehring>`_

Table of contents
_________________

Expand All @@ -116,6 +121,7 @@ _________________
install_guide/guide
tutorial/tutorial
parts/parts
modifier/modifier
api/modules


Expand Down
36 changes: 9 additions & 27 deletions docs/install_guide/guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@ need it. Download it from `git-scm.com <http://git-scm.com/downloads>`_. Keep th
Download and install Python
===========================

Anaconda as Python distribution
CPython as Python distribution
-------------------------------

While you can basically use any Python interpreter (preferably Python 3), there are distribution which include a lot of nice
extra modules for Python out of the box. This guide uses Anaconda by continuum.io. Head there now and
`download <http://continuum.io/downloads>`_ the Windows installer.
But **install Anaconda as local user**, which allows you to update and install more Python modules. When asked to add
Anaconda to PATH and as default Python, make sure these options are checked.

The installation will run for quite some time, go and get yourself a nice cup of creme coffee.
While you can basically use any Python 3 interpreter (at least Python 3.5, preferably the newest version), in this guide we use CPython by python.org. Head there now and
`download <https://www.python.org/downloads/>`_ the Windows installer. Make sure that the installer **adds CPython to PATH** and installs the Python package managment **pip**.


PyCharm as IDE
Expand All @@ -38,27 +33,19 @@ Setting up Python in PyCharm

Before doing any real work you will have to tell PyCharm which Python it should use. On the welcome screen, select
``Configure``, then ``Settings``. Add the Python interpreter in ``Project Interpreters`` and click
on the gear in the upper right and then ``Add``. There you can add the Anaconda Python Interpreter by selecting ``System Interpreter``.
on the gear in the upper right and then ``Add``. There you can add the Python Interpreter by selecting ``System Interpreter``.
The right path should be already in the form.

PyCharm will then parse all the installed modules of that Python installation. Since Anaconda comes with a lot of stuff
this will take its time.

Installing Shapely
^^^^^^^^^^^^^^^^^^
Normally new Python can be installed easily from command line or directly from an IDE such as PyCharm. In case of
Shapely, the library which handles all the polygon stuff, needs the GEOS library installed as well.
You can install both via the Conda Prompt (look for it in the start menu) using the command::

conda install shapely
PyCharm will then parse all the installed modules of that Python installation.

Installing the gdshelpers and optional dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Even under Windows, the command line is sometimes useful. In our case we use `pip`, which is the Python package
managment. First install gdshelpers by executing::
Even under Windows, the command line is sometimes useful. In our case we use `pip` to install gdshelpers with image-export directly by using the single command::

pip install gdshelpers
pip install gdshelpers[image_export]
For most users this configuration should be sufficient.

Alternatively, you can also add the gdshelpers to your project using ``VCS --> Checkout from Version Control --> Git`` (the link is https://github.com/HelgeGehring/gdshelpers.git)
and then ``Attach`` to add it to your project. Using this way, it is also possible to modify the gdshelpers and to contribute to the development.
Expand All @@ -68,11 +55,6 @@ For exporting the design to the OASIS-format you should install the library `fat
In order to create GDSII-files, you can use the included GDSII-export or decide between `gdspy` (fully python 3 compatible, ``pip install gdspy``) and `gdsCAD` (also working under python 3, but not installable using `pip`).
For directly generating pictures from the designs the package `descartes` needs to be installed (``pip install descartes``).

Alternatively, installing the gdshelpers e.g. with image-export can directly be done using the single command::

pip install gdshelpers[image_export]

For most users this configuration should be sufficient.

Updating gdshelpers
^^^^^^^^^^^^^^^^^^^
Expand Down
116 changes: 116 additions & 0 deletions docs/modifier/modifier.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
********
Modifier
********

From negative layout to postive layout
""""""""""""""""""""""""""""""""""""""

Sometimes, using positive resist to pattern the waveguides gives better results compared to negative resist. To make this way of designing the structures
as easy as possible, we implemented a function called :func:`convert_to_positve_resist`. Apart from the defining the structure itself,
the only parameter that has to be given is the buffer radius. Here is a short example of two photonic routings,
one patterned with negative (red) and one patterned with positive (green) resist:

.. plot::
:include-source:

import numpy as np
from gdshelpers.geometry.chip import Cell
from gdshelpers.parts.waveguide import Waveguide
from gdshelpers.parts.coupler import GratingCoupler
from gdshelpers.helpers.positive_resist import convert_to_positive_resist

coupler_params = {
'width': 1.3,
'full_opening_angle': np.deg2rad(40),
'grating_period': 1.155,
'grating_ff': 0.85,
'n_gratings': 20,
'taper_length': 16.
}

# negative resist
left_coupler_1 = GratingCoupler.make_traditional_coupler((0,0), **coupler_params)
right_coupler_1 = GratingCoupler.make_traditional_coupler((100,0), **coupler_params)
wg_1 = Waveguide.make_at_port(left_coupler_1.port)
wg_1.add_straight_segment(10)
wg_1.add_bend(-np.pi / 2, 30)
wg_1.add_straight_segment_until_x(right_coupler_1.port.x - 30)
wg_1.add_bend(-np.pi / 2, 30)
wg_1.add_straight_segment(10)

# positive resist
left_coupler_2 = GratingCoupler.make_traditional_coupler((200,0), **coupler_params)
right_coupler_2 = GratingCoupler.make_traditional_coupler((300,0), **coupler_params)
wg_2 = Waveguide.make_at_port(left_coupler_2.port)
wg_2.add_straight_segment(10)
wg_2.add_bend(-np.pi / 2, 30)
wg_2.add_straight_segment_until_x(right_coupler_2.port.x - 30)
wg_2.add_bend(-np.pi / 2, 30)
wg_2.add_straight_segment(10)

cell = Cell('SIMPLE_DEVICE')
cell.add_to_layer(1, left_coupler_1, wg_1, right_coupler_1)
cell.add_to_layer(2, convert_to_positive_resist(parts=[wg_2, left_coupler_2, right_coupler_2], buffer_radius=5))
cell.show()

As it can be seen, the workflow is exactly the same as for negative resist and only one additional function has to be added.
Of course, this does also work for more complex designs.

Creating holes for underetching
""""""""""""""""""""""""""""""""
To creates holes around defined parts, which can be used for underetching processes, we implemented a :func:`create_holes_for_under_etching` function.
For this example, let us consider a grating coupler, a waveguide, a ring resonator and a second grating coupler.
First, we have to define the parts which shall be underetched, in this case the left grating coupler, waveguide and ring resonator.
If the complete structure is underetched, then you will not notice any problems.
However, if one part of your structure is not underetched, for example the right grating coupler, then you might get a collision between the
photonics layer and the hole layer. For this reason, in addition to the `underetching_parts`,
we have to define the `complete_structure`, which is used to prevent overlapping. While the `underetching_parts` contains the left grating coupler, waveguide and resonator,
the `complete_structure` contains the `underetching_parts` and additonally, the second grating coupler.
Finally, the radius, distance, spacing and and length of the holes ca be adjusted using the corresponding parameters.

.. plot::
:include-source:

import numpy as np
from gdshelpers.geometry import geometric_union
from gdshelpers.parts.coupler import GratingCoupler
from gdshelpers.geometry.chip import Cell
from gdshelpers.parts.waveguide import Waveguide
from gdshelpers.parts.resonator import RingResonator
from gdshelpers.helpers.under_etching import create_holes_for_under_etching

coupler_params = {
'width': 1.3,
'full_opening_angle': np.deg2rad(40),
'grating_period': 1.155,
'grating_ff': 0.85,
'n_gratings': 20,
'taper_length': 16.
}

# ==== create some sample structures (straight line with ring resonator)
coupler_1 = GratingCoupler.make_traditional_coupler((0,0), **coupler_params)
wg_1 = Waveguide.make_at_port(coupler_1.port)
wg_1.add_straight_segment(11)
wg_1.add_bend(-np.pi / 2, 30)
wg_1.add_straight_segment(30)
resonator = RingResonator.make_at_port(port=wg_1.current_port, gap=0.2, radius=40)
wg_1.add_straight_segment(30)
wg_1.add_bend(-np.pi / 2, 30)
wg_1.add_straight_segment(11)
coupler_2 = GratingCoupler.make_traditional_coupler(wg_1.current_port.origin, **coupler_params)
underetching_parts = geometric_union([wg_1, resonator, coupler_1])
complete_structure = geometric_union([underetching_parts, coupler_2])
# create the holes with a radius of 0.5 microns, a distance of 2 microns to the structure borders and
# a distance of 2 microns between the holes
holes = create_holes_for_under_etching(underetch_parts=underetching_parts, complete_structure=complete_structure,
hole_radius=0.5, hole_distance=2, hole_spacing=3, hole_length=3)

# create a cell with the structures in layer 1 and the holes in layer 2
cell = Cell('CELL')
cell.add_to_layer(1, complete_structure)
cell.add_to_layer(2, holes)
cell.show()
Loading

0 comments on commit 2681153

Please sign in to comment.