gdshelpers.helpers package

Submodules

gdshelpers.helpers.alignment module

class gdshelpers.helpers.alignment.Alignment(alignment='left-bottom')

Bases: object

Alignment helper class.

Given a bounding box in the form of ((min_x, min_y), (max_x, max_y)), this class returns special points of this box:

(max_y)    top +------+------+
             |      |      |
             |      |      |
     center  +------+------+
             |      |      |
             |      |      |
(min_y) bottom +------+------+
          (min_x)         (max_x)
            Left  Center   Right

Alignment options are given as - separated tuple, allowing for combinations of left, center, right with bottom, center, top.

alignment

Property holding the current alignment.

Returns:Alignment string, i.e. 'bottom-left'.
Return type:str
alignment_functions

Returns a 2-tuple of functions, calculating the offset coordinates for a given bounding box.

Returns:Tuple of functions.
Return type:tuple
calculate_offset(bbox)

Calculate the coordinates of the current alignment for the given bounding box bbox.

Parameters:bbox – Bounding box in the ((min_x, min_y), (max_x, max_y)) format.
Returns:(x, y) offset coordinates.
Return type:np.array

gdshelpers.helpers.bezier module

class gdshelpers.helpers.bezier.CubicBezierCurve(p0, p1, p2, p3)

Bases: object

evaluate(t)
evaluate_d1(t)
split(t)

Split the cubic Bezier curve into two new cubic Bezier, both describing one part of the curve.

Parameters:t
Returns:

gdshelpers.helpers.layers module

gdshelpers.helpers.layers.devnamelayer = 8

Layer for device names. (For example A1, F0, etc..)

gdshelpers.helpers.layers.framelayer = 6

Layer for frames. (For overall pattern and/or arrays of devices)

gdshelpers.helpers.layers.gmarklayer = 2

Layer for global markers (Crosses, …)

gdshelpers.helpers.layers.gplayers = (16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69)

List of unassigned layers for general purpose use.

gdshelpers.helpers.layers.lmarklayer = 3

Layer for local markers (Crosses, …)

gdshelpers.helpers.layers.masklayer1 = 14

Mask window layer 1. (opening windows for subsequent etching e.g. freestanding devices)

gdshelpers.helpers.layers.masklayer2 = 15

Mask window layer 2. (opening windows for subsequent etching e.g. freestanding devices)

gdshelpers.helpers.layers.nanolayer = 13

Nano features layer. (SSPD wires, high resolution elements…)

gdshelpers.helpers.layers.outlayer = 1

Layer for photonic devices (Waveguides, Couplers, Splitters…)

gdshelpers.helpers.layers.padlayer = 11

Metal contact pad layer. (For probe contacts or wire bonding)

gdshelpers.helpers.layers.parnamelayer1 = 9

Layer for local parameters. (Period of couplers, gaps, … Used for first lithography step)

gdshelpers.helpers.layers.parnamelayer2 = 10

Layer for local parameters. (Period of couplers, gaps, … Used for second lithography step)

gdshelpers.helpers.layers.patnamelayer = 7

Layer for pattern names. (For example NG01 CalibCoupler)

gdshelpers.helpers.layers.regionlayer = 5

Layer for region definition. (For defining working areas = multiple of writefield_size)

gdshelpers.helpers.layers.wflayer = 4

Layer for write fields. (Used just for checking, not used in lithography)

gdshelpers.helpers.layers.winglayer = 12

Wing layer. (For connection between nanowires and pads)

gdshelpers.helpers.positive_resist module

gdshelpers.helpers.positive_resist.convert_to_positive_resist(parts, buffer_radius, outer_resolution=None, clearance_features=None, exclude=None)

Convert a list of parts and shapely objects to a positive resist design by adding a buffer around the actual design.

Parameters:
  • parts – List of parts and shapely objects.
  • buffer_radius – Buffer radius
  • outer_resolution – Outer buffer circumference resolution. Defaults to one 20th of the buffer radius.
  • clearance_features – List of additional features to include in the generated structure. Can be useful for providing clearance areas around couplers or other features.
  • exclude – List of features to subtract from the generated structure. Can be used for interconnects between structures from different cells, such that the end of a waveguide remains “open”.
Returns:

Converted Shapely geometry.

Return type:

shapely.base.BaseGeometry

gdshelpers.helpers.small module

gdshelpers.helpers.small.alphanumeric_to_id(text)

Do the reverse of id_to_alphanumeric. :return: (column, row) tuple.

gdshelpers.helpers.small.find_line_intersection(r1, angle1, r2, angle2)

Find intersection between two lines defined by point and direction.

Parameters:
  • r1 – Origin of the first line.
  • angle1 – Angle of the first line.
  • r2 – Origin of the second line.
  • angle2 – Angle of the second line.
Returns:

Tuple of point of intersection and distances from the origins.

Return type:

tuple

gdshelpers.helpers.small.id_to_alphanumeric(column, row)

Convert a column, row pair to an alphanumeric representation.

Parameters:
  • column (int) – Column
  • row (int) – Row
Returns:

Alphanumeric representation.

Return type:

str

gdshelpers.helpers.small.int_to_alphabet(num)

Convert an integer number to an alphabetic representation.

Numbers of 0 to 25 are mapped to A-Z, higher numbers ‘count’ like AA, AB, …, AZ, BA. There is no upper limit on the converted number.

Parameters:num – Number to convert
Returns:Converted string.
Return type:str
gdshelpers.helpers.small.normalize_phase(phase, zero_to_two_pi=False)

Normalize a phase to be within +/- pi.

Parameters:
  • phase (float) – Phase to normalize.
  • zero_to_two_pi (bool) – True -> 0 to 2*pi, False -> +/- pi
Returns:

Normalized phase within +/- pi or 0 to 2*pi

Return type:

float

gdshelpers.helpers.small.raith_eline_dosefactor_to_datatype(dose_factor)

Convert a dose factor to a GDS datatype for Raith E-Beam writer.

Parameters:dose_factor (float) – The dose factor.
Returns:GDS datatype number
Return type:int

gdshelpers.helpers.under_etching module

gdshelpers.helpers.under_etching.create_holes_for_under_etching(underetch_parts, complete_structure, hole_radius, hole_distance, hole_spacing, hole_length=0, cap_style='round')

Creates holes around given parts which can be used for underetching processes

Parameters:
  • underetch_parts – List of gdshelpers parts around which the holes shall be placed
  • complete_structure – geometric union of the complete structure, needed to avoid collisions between underetching holes and other structures, e.g. waveguides
  • hole_radius – Radius of the holes in microns
  • hole_distance – Distance between the holes edges from the the structures in microns
  • hole_spacing – Distance between the holes in microns
  • hole_length – Length of the holes (if 0 creates circles, else rectangle like)
  • cap_style – CAP_STYLE of the holes (i.e. ‘round’ or ‘square’, see Shapely Docs)
Returns:

Geometric union of the created holes

gdshelpers.helpers.vortex_traps module

gdshelpers.helpers.vortex_traps.fill_waveguide_with_holes_in_honeycomb_lattice(waveguide, spacing, padding, hole_radius)

Fills a given waveguide with holes which are arranged in a honeycomb structure This can be used for generating vortex traps like presented in https://doi.org/10.1103/PhysRevApplied.11.064053

Parameters:
  • waveguide – Waveguide to be filled
  • spacing – Spacing between the holes
  • padding – Minimum distance from the edge of the waveguide to the holes
  • hole_radius – Radius of the holes
Returns:

Shapely object, which describes the holes

gdshelpers.helpers.vortex_traps.surround_with_holes(geometry, hole_spacing, hole_radius, padding, max_distance)

Surrounds the given geometry with holes, which are arranged in a square lattice around the structure. This can be used for generating vortex traps like presented in https://doi.org/10.1103/PhysRevApplied.11.064053

Parameters:
  • geometry – The geometry around which the holes are generated
  • hole_spacing – Spacing between the holes
  • hole_radius – Radius of the holes
  • padding – Padding around the geometry
  • max_distance – Maximum distance of a hole from the geometry
Returns:

Shapely object, which describes the holes

Module contents

gdshelpers.helpers.int_to_alphabet(num)

Convert an integer number to an alphabetic representation.

Numbers of 0 to 25 are mapped to A-Z, higher numbers ‘count’ like AA, AB, …, AZ, BA. There is no upper limit on the converted number.

Parameters:num – Number to convert
Returns:Converted string.
Return type:str
gdshelpers.helpers.id_to_alphanumeric(column, row)

Convert a column, row pair to an alphanumeric representation.

Parameters:
  • column (int) – Column
  • row (int) – Row
Returns:

Alphanumeric representation.

Return type:

str

gdshelpers.helpers.normalize_phase(phase, zero_to_two_pi=False)

Normalize a phase to be within +/- pi.

Parameters:
  • phase (float) – Phase to normalize.
  • zero_to_two_pi (bool) – True -> 0 to 2*pi, False -> +/- pi
Returns:

Normalized phase within +/- pi or 0 to 2*pi

Return type:

float

gdshelpers.helpers.find_line_intersection(r1, angle1, r2, angle2)

Find intersection between two lines defined by point and direction.

Parameters:
  • r1 – Origin of the first line.
  • angle1 – Angle of the first line.
  • r2 – Origin of the second line.
  • angle2 – Angle of the second line.
Returns:

Tuple of point of intersection and distances from the origins.

Return type:

tuple

gdshelpers.helpers.raith_eline_dosefactor_to_datatype(dose_factor)

Convert a dose factor to a GDS datatype for Raith E-Beam writer.

Parameters:dose_factor (float) – The dose factor.
Returns:GDS datatype number
Return type:int