Shapes and generic cells#

gdsfactory provides some generic parametric cells in gf.components that you can customize for your application.

Basic shapes#

Rectangle#

To create a simple rectangle, there are two functions:

gf.components.rectangle() can create a basic rectangle:

import gdsfactory as gf

r1 = gf.components.rectangle(size=(4.5, 2), layer=(1, 0))
r1.plot()
../_images/eb7cfc947aee559cccc487bce8a8bd9bff586dd6643d25d8958ae1eb4c5f1544.png

gf.components.bbox() can also create a rectangle based on a bounding box. This is useful if you want to create a rectangle which exactly surrounds a piece of existing geometry. For example, if we have an arc geometry and we want to define a box around it, we can use gf.components.bbox():

c = gf.Component()
arc = c << gf.components.bend_circular(radius=10, width=0.5, angle=90, layer=(1, 0))
arc.rotate(90)

# Draw a rectangle around the arc we created by using the arc's bounding box
rect = c << gf.components.bbox(arc, layer=(2, 0))
c.plot()
../_images/766df6c51cf8425f82f65734fab10a4251e5de0fda2d47cb2bd9ce8ab0e9ac2c.png

Cross#

The gf.components.cross() function creates a cross structure:

c = gf.components.cross(length=10, width=0.5, layer=(1, 0))
c.plot()
../_images/cef9757ebae64c9ddb8cd8b39122d780e4c6c6e29a0f7243ac9a80c09df3059e.png

Ellipse#

The gf.components.ellipse() function creates an ellipse by defining the major and minor radii:

c = gf.components.ellipse(radii=(10, 5), angle_resolution=2.5, layer=(1, 0))
c.plot()
../_images/c6aada8665e9f8c2f567b6d25bad3b99d16def1cee3924861c6c56f6de270afc.png

Circle#

The gf.components.circle() function creates a circle:

c = gf.components.circle(radius=10, angle_resolution=2.5, layer=(1, 0))
c.plot()
../_images/70c918560b9642ce13a07f0444730e8dd4035a779ebc8326e9b208343e524459.png

Ring#

The gf.components.ring() function creates a ring. The radius refers to the center radius of the ring structure (halfway between the inner and outer radius).

c = gf.components.ring(radius=5, width=0.5, angle_resolution=2.5, layer=(1, 0))
c.plot()
../_images/84e33a6ecf19a8048d7d4959e7e595180deca409f3fecef2064b5d40c91ea9d7.png
c = gf.components.ring_single(gap=0.2, radius=10, length_x=4, length_y=2)
c.plot()
../_images/dbfdbca4b5d9e4cb038f0c551c04dddab805cdd59c253990fd675c57624f3053.png
import gdsfactory as gf

c = gf.components.ring_double(gap=0.2, radius=10, length_x=4, length_y=2)
c.plot()
../_images/5ca71bad64f6af15d710294d943a0c94a469e466c46c0732c6f192d162f9b43a.png
c = gf.components.ring_double(
    gap=0.2,
    radius=10,
    length_x=4,
    length_y=2,
    bend=gf.components.bend_circular,
)
c.plot()
../_images/fdd793d0eab4efafe6ba9a3565895071e15ae2398065bd33ed32b20913b98fc6.png

Bend circular#

The gf.components.bend_circular() function creates an arc. The radius refers to the center radius of the arc (halfway between the inner and outer radius).

c = gf.components.bend_circular(
    radius=5.0, width=0.5, angle=90, npoints=720, layer=(1, 0)
)
c.plot()
../_images/50f9603a0cc37830a952488160d3eecd6bd33869ed7f2123f0d9dae23f6b4f21.png

Bend euler#

The gf.components.bend_euler() function creates an adiabatic bend in which the bend radius changes gradually. Euler bends have lower loss than circular bends.

c = gf.components.bend_euler(radius=5.0, width=0.5, angle=90, npoints=720, layer=(1, 0))
c.plot()
../_images/cc81bd70cf06e049d98bc3f93d9cfbde29a64d39e159da10aee66771e75121c6.png

Tapers#

gf.components.taper()is defined by setting its length and its start and end length. It has two ports, 1 and 2, on either end, allowing you to easily connect it to other structures.

c = gf.components.taper(length=10, width1=6, width2=4, port=None, layer=(1, 0))
c.plot()
../_images/96edf1f3e3ee5212aeb674e955471493ba778dc9d8b5fd6af8988de6c400229b.png

gf.components.ramp() is a structure is similar to taper() except it is asymmetric. It also has two ports, 1 and 2, on either end.

c = gf.components.ramp(length=10, width1=4, width2=8, layer=(1, 0))
c.plot()
../_images/284a0a66df70adb808fccfb7e6c7c04b6a856589e2ca7425f26a81d030a8bf2c.png

Common compound shapes#

The gf.components.L() function creates a “L” shape with ports on either end named 1 and 2.

c = gf.components.L(width=7, size=(10, 20), layer=(1, 0))
c.plot()
../_images/8563b979777a9770092ba185ee6ddac6e05240cf79678d9fe1543c73c20f52cb.png

The gf.components.C() function creates a “C” shape with ports on either end named 1 and 2.

c = gf.components.C(width=7, size=(10, 20), layer=(1, 0))
c.plot()
../_images/54a19b77e0d818aa2f51e19c0459ba877279ab6c69401f3577c73ffffdecf0c2.png

Text#

Gdsfactory has an implementation of the DEPLOF font with the majority of english ASCII characters represented (thanks to phidl)

c = gf.components.text(
    text="Hello world!\nMultiline text\nLeft-justified",
    size=10,
    justify="left",
    layer=(1, 0),
)
c.plot()
# `justify` should be either 'left', 'center', or 'right'
../_images/b781ee87674bb0fb759b8fb0d7c098aeb96bc949ef6264a9d2dfd237c8868fd7.png

Lithography structures#

Step-resolution#

The gf.components.litho_steps() function creates lithographic test structure that is useful for measuring resolution of photoresist or electron-beam resists. It provides both positive-tone and negative-tone resolution tests.

c = gf.components.litho_steps(
    line_widths=(1, 2, 4, 8, 16), line_spacing=10, height=100, layer=(1, 0)
)
c.plot()
../_images/91fc85ecd9da4a5bb615c635fab32d667361654d2dab27086e38cdafbf4af5ad.png

Calipers (inter-layer alignment)#

The gf.components.litho_calipers() function is used to detect offsets in multilayer fabrication. It creates a two sets of notches on different layers. When an fabrication error/offset occurs, it is easy to detect how much the offset is because both center-notches are no longer aligned.

D = gf.components.litho_calipers(
    notch_size=(1, 5),
    notch_spacing=2,
    num_notches=7,
    offset_per_notch=0.1,
    row_spacing=0,
    layer1=(1, 0),
    layer2=(2, 0),
)
D.plot()
../_images/980238743473f62613d0f9dc93aead1b84f9759fb867f436223506323d888177.png

Paths#

See Path tutorial for more details – this is just an enumeration of the available built-in Path functions

Circular arc#

P = gf.path.arc(radius=10, angle=135, npoints=720)
f = P.plot()
../_images/e38832d5353abf81d2201bda8d2eac8c542ba4cd0b22aa43e0ba40c1c318babd.png

Straight#

import gdsfactory as gf

P = gf.path.straight(length=5, npoints=100)
f = P.plot()
../_images/10e9cb4db6c2f5adeeb8b1d7b4bc5b0a9ad760f957a07e830f112c2ae37cb8b8.png

Euler curve#

Also known as a straight-to-bend, clothoid, racetrack, or track transition, this Path tapers adiabatically from straight to curved. Often used to minimize losses in photonic straights. If p < 1.0, will create a “partial euler” curve as described in Vogelbacher et. al. https://dx.doi.org/10.1364/oe.27.031394. If the use_eff argument is false, radius corresponds to minimum radius of curvature of the bend. If use_eff is true, radius corresponds to the “effective” radius of the bend– The curve will be scaled such that the endpoints match an arc with parameters radius and angle.

P = gf.path.euler(radius=3, angle=90, p=1.0, use_eff=False, npoints=720)
f = P.plot()
../_images/80e4dd580deac9c00079d87fcec2a074c3145f4bb534a0de8828432e91cf2824.png

Smooth path from waypoints#

import numpy as np

import gdsfactory as gf

points = np.array([(20, 10), (40, 10), (20, 40), (50, 40), (50, 20), (70, 20)])

P = gf.path.smooth(
    points=points,
    radius=2,
    bend=gf.path.euler,
    use_eff=False,
)
f = P.plot()
../_images/9945dd6149a36bcb7c174608e6baa9908fae56327be64fcc0c9bd7ac312a240a.png

Delay spiral#

c = gf.components.spiral_double()
c.plot()
../_images/65f3beff215560b7a56f262f26ae04194f0856d2522a033ae5d80b4543733fdd.png
c = gf.components.spiral()
c.plot()
../_images/84fc0ec43afeb0358bc52a48e64e2b17247430b14b5c55680a36c37941c1e720.png
c = gf.components.spiral_racetrack_fixed_length()
c.plot()
../_images/8ff425068d4c9fbf570f8777870a70f46ff4de0aa5295739cbcf48da307462e5.png

Useful contact pads / connectors#

These functions are common shapes with ports, often used to make contact pads

c = gf.components.compass(size=(4, 2), layer=(1, 0))
c.plot()
../_images/9a87fc849b47a60e87e51eabb4f50cc7ceafbba75005f1a010c06dcb9028fbaf.png
c = gf.components.nxn(north=3, south=4, east=0, west=0)
c.plot()
../_images/bb2717c776c777cae80bcfcd6f5057138a14ddef7391e8764924b1b9dbad364c.png
c = gf.components.pad()
c.plot()
../_images/2742f24bf26e95a7b503399d5872dbfc4e3bd87cfba80893aaffb5141b3b93f3.png
c = gf.components.pad_array90(columns=3)
c.plot()
../_images/27b80a6176a29cef57794a12d8a55552b3ece391a1b7862dee1981f0ee79a07d.png

Chip / die template#

import gdsfactory as gf

c = gf.components.die(
    size=(10000, 5000),  # Size of die
    street_width=100,  # Width of corner marks for die-sawing
    street_length=1000,  # Length of corner marks for die-sawing
    die_name="chip99",  # Label text
    text_size=500,  # Label text size
    text_location="SW",  # Label text compass location e.g. 'S', 'SE', 'SW'
    layer=(2, 0),
    bbox_layer=(3, 0),
)
c.plot()
../_images/571d249ea6a24cadec5c747857514b3b5e7f55382524a40ab9ab8ccae941efc0.png

Optimal superconducting curves#

The following structures are meant to reduce “current crowding” in superconducting thin-film structures (such as superconducting nanowires). They are the result of conformal mapping equations derived in Clem, J. & Berggren, K. “Geometry-dependent critical currents in superconducting nanocircuits.” Phys. Rev. B 84, 1–27 (2011).

import gdsfactory as gf

c = gf.components.optimal_hairpin(
    width=0.2, pitch=0.6, length=10, turn_ratio=4, num_pts=50, layer=(2, 0)
)
c.plot()
../_images/2378da6b7bd6d91b671b5b07018718ab4f868a3848785455ea44c56967f56e5c.png
c = gf.components.optimal_step(
    start_width=10,
    end_width=22,
    num_pts=50,
    width_tol=1e-3,
    anticrowding_factor=1.2,
    symmetric=False,
    layer=(2, 0),
)
c.plot()
../_images/2f686556ad000fe55488edfe925bf8583bbe8c08cb4c148dcb9884a5327f9f82.png
c = gf.components.optimal_90deg(width=100.0, num_pts=15, length_adjust=1, layer=(2, 0))
c.plot()
../_images/d75391fb7c801757c7127919bc3738b2c90d482ae12582c745def6058c3421ac.png
c = gf.components.snspd(
    wire_width=0.2,
    wire_pitch=0.6,
    size=(10, 8),
    num_squares=None,
    turn_ratio=4,
    terminals_same_side=False,
    layer=(2, 0),
)
c.plot()
../_images/50791afcfa645a3604f44c0cd6ddf80e18bf901a03935f7ae7aa0ec1a555b49b.png

Generic library#

gdsfactory comes with a generic library that you can customize it to your needs or even modify the internal code to create the Components that you need.