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/059673a7b10a8c8888b5b2b7af29abb8c365aef936222c229b21b0eece94ebf7.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/57526b6749cf60cac9b8f5d97c4cdaae99d9f512e54998b30f91fc499f509b37.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/e5744c1ecca37ac9b5039c066be0c97845247649325cd95d768f0bbb869a4963.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/fe6ae953457e806ed9333e9ddc1c6bd58e08e671d3616aecaa81bd6e2b7c2a65.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/840f5f0687c145ad4431feb5f33628bc315bbdeb2dd3d8f275258d164db9d714.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/9c3ba6a08664d3668e46e31e3b07d1d930dda495218bf5eede0bbce79eadbf83.png
c = gf.components.ring_single(gap=0.2, radius=10, length_x=4, length_y=2)
c.plot()
../_images/2e87453a700820879bdfbac263e43a859f74cfeb830bcef8a1bb974d85727188.png
import gdsfactory as gf

c = gf.components.ring_double(gap=0.2, radius=10, length_x=4, length_y=2)
c.plot()
../_images/2ff929509b8a8fe9dd4f71de73cd9b93eafac5757780d0f6a843814a88f865ea.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/88fbd8fad96ca41a0c63552a5613e214eccd725868fc81b167c67250ace1e675.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/8586ab25443dae5b4e48a582c723b2a3aba5f31c67bb2bb684d72041177a8c02.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/c9e035f463854393b18fd20ab79c8121f26ada401b91847e032554e2338d1305.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/743884cb8e88f876aa42e575d9fd5c4c6a87dd7a1b0d28350e6fea7f3b548805.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/6441f16c86dcc2b20e52bc3edc680a7e6a54329fec3a070a774bbe8a35bb712b.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/962e3b7f377a9d89f36d6b81e7c98f6065eda48e93ed822684e08e6f3e500b6d.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/ac039121d36aa9db367471349c6d81d4281867ee65378bc86eb205e223196e71.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/a24e4f28155185ffbb58feb30d024f3dd14170d2700bee69101defc1acfd8d7b.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/e18bd1c872fb70ffbfc2786d3758fac1c7302b89e6976ea3545406c13925ab40.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/c4c1f54b934a15b7780cea64a37a73b4f011a0d907aef713bce5a32df4674f3f.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/30b3879076f10989f22271017d24cc75f286c8e9ba8e24f096c3636d6bff39d3.png

Straight#

import gdsfactory as gf

P = gf.path.straight(length=5, npoints=100)
f = P.plot()
../_images/848fdff0141df9c33c676a3a5f23954472f6deea30274075118979dd5c942564.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/2a74ac0005b42b8c9558c871f54d622a4e981744301510bc59f405f3aea074ac.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/e70045dd22a1839a9ac2c2aa81abc18949fcba2c1a40c262620296e30fb61b32.png

Delay spiral#

c = gf.components.spiral_double()
c.plot()
../_images/606c32e722e5d69b758809f856999b632aae7f8a581058ef8717803ef8298938.png
c = gf.components.spiral()
c.plot()
../_images/68be5e057f93a678e95530a32181524e9241f87798ccbaca389756da6e8d39b5.png
c = gf.components.spiral_racetrack_fixed_length()
c.plot()
/home/runner/work/gdsfactory/gdsfactory/gdsfactory/components/bends/bend_circular.py:84: UserWarning: {'width': 0.5} ignored for cross_section 'strip'
  x = gf.get_cross_section(cross_section, width=width or x.width)
../_images/d7adcb35723df942068d95a1ce44e5b2a749481879fd5cebd1a50585a35acc67.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/7b3e2450e785609ebc2b1e761f93bbf818f4e2d8fc7dd253de4a305bd927c784.png
c = gf.components.nxn(north=3, south=4, east=0, west=0)
c.plot()
../_images/b1e3daa1dec35247ae16ae0d0b29a649b115ef7f8a62bd8cb316c895b9af2550.png
c = gf.components.pad()
c.plot()
../_images/709d57314d86b016ada60356b6065b62d430fbd2a6b684860c157996770378a5.png
c = gf.components.pad_array90(columns=3)
c.plot()
../_images/ae19f2406a7406a1a970dc63912651ed87b2c4908796f829a5327bcde119f2fe.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/8792af466826a14f94b1d29846aa2bb48e9c528fededc683379ce58654807026.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/0ea108d517617dd6bd023d1510d4546b8c5ebe058951e4b5a4dfd0f4bf141b79.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/daa05a6b0b3d455102bf2f9811e844c18c08f1ab9527f2f024e1c0ae4072f39e.png
c = gf.components.optimal_90deg(width=100.0, num_pts=15, length_adjust=1, layer=(2, 0))
c.plot()
../_images/598d68d2ec589b9ab175cbbe0c297fdc4e69c60fe436b205f8fac2c2863e92a9.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/ad10e1bb05b732914ce84184fe56bf0152601c29d891088857920e055264374a.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.