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/b82608d9855bf6beb02aedf9f154506ac199334772e2d132368eaded1933b299.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.drotate(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/ccc3b7bdf19f96a4de7f283e7e27c41e0fe35ba219a6f5193f1b7d8791e3dd4a.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/922d10a718fafde5398fdd1229681fa000c4f1f092b05ca4830c0d461bb2fd5c.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/a564cb2aa6a42d34dfd08acd479c9ffbec1633cace43f72a88c09871f88bff75.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/1acf5b7ac495a87a8f3aa529ddd4c609f8be416247dc3166b4f26ee037298d64.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/8fe8da2bf7b2762d16a870f0eaf501fbc79bdf16112a6bbdafe26ed137d25865.png
c = gf.components.ring_single(gap=0.2, radius=10, length_x=4, length_y=2)
c.plot()
../_images/ca1ed23e009ed8d8997bc7d7614567ccaa91d0d91c16ae74828f51b1c8e96dc9.png
import gdsfactory as gf

c = gf.components.ring_double(gap=0.2, radius=10, length_x=4, length_y=2)
c.plot()
../_images/63f117e1bff348a1c08a4ad7894c21516b4077686e875299e2e881f652bcf9aa.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/fad9f727a183abaf81ca41e0e77767fdaa53d4629fdb33a7dfc962e5fd2f970c.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/148b94d283af2a958889ce6b6668ab8e6c17727faa19102d3fd52650b47ab50a.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/dfd45431ae8f124bb0b2d843c8698e3ea84314580c06f30392410e4958f59faf.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/cd35756592ee5c624345f960318dc5387c4905234fccdbedb1e5a1876eead860.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/d692feb044e1d56fc65246aca48463ec164f2c88c6ccd03160806d04009302ab.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/a94db93bf6d5724443cb244f352711f762d74712db7a77d2420986b445bcd103.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/a49e3b6e4ab4460d7dce784141c129bfe712323102783bc58f63fcafaa2562b0.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/be3108681fb355d0384f4f9c42fbe573d8688df940660ad26c2da7b8ba52278c.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/f4cae073ec8fef5e26e1bddaab5572753b5dcb2e9599196f9262460655faed97.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/e81d38e1808fa8912d0e2904b4865aa9e7dee48f5e3f7aa5c4d648232499b235.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/d717a8b919256c3d60a34e19a8f7160c9d99dc6c515f5d20494ff42a150900a9.png

Straight#

import gdsfactory as gf

P = gf.path.straight(length=5, npoints=100)
f = P.plot()
../_images/cc444ae0953c69ef178f0f080ac97b217c0464f84aa087f326d83971a3dc5423.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/c5eb1e0ec2e1de2a52c5cd5616e96b5abe2f97673315dbdfc346cb988c49ea86.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/87ba8fe78fb6da3747d770002e3d1820e06d3131d6a42ca338c98b20fc91b63c.png

Delay spiral#

c = gf.components.spiral_double()
c.plot()
../_images/9dff29ba0b882784eac011b2a55e5a54da173c0bdbfe1edfefd0e37dfa851ef1.png
c = gf.components.spiral()
c.plot()
../_images/709b6d7df16f1694ce34ad739f38896bc6fefbe2af3e55e802c9d51b76fa7359.png
c = gf.components.spiral_racetrack_fixed_length()
c.plot()
../_images/969931871536d59d5939f67ee5a49517eaad67a2fd30dfa274523fa18c60803b.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/f2a3a5c666c27a8ef315a9d5eef85272f8d0732727c31559da336aade785f5b6.png
c = gf.components.nxn(north=3, south=4, east=0, west=0)
c.plot()
../_images/c3a2d899003a538de46a94df0e7709193fb7c9c77aa5a6b607bad20a7b7e4228.png
c = gf.components.pad()
c.plot()
../_images/0e2f31c1da9b9888a3b0445c37f5daa71e14538ac77f2881043cefb229217be1.png
c = gf.components.pad_array90(columns=3)
c.plot()
../_images/e97a008791d7b564e29e8f7a6bf9b16f1fa057ed2778541dff709a04c785aa39.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/7c5b99f12afd73b6294acef1cff374a4101aa67178f3a887592cadfab18ff08a.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/0af6ddd4f340880ba4da325f3777fbcd82c6e06d9444f252dbbe7dc2ba5f6990.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/03626b758ef03d2a561323a07f1a3f9fb42193b385e54d1e2f8f36d1c076fbf5.png
c = gf.components.optimal_90deg(width=100.0, num_pts=15, length_adjust=1, layer=(2, 0))
c.plot()
../_images/348f84ed6fc8edc94c11e4f7eaca74f8536f2f9e537043b72b8e02b5212a793b.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/45f3650352323726ac3dc011f6c1f58d6047ac50072eb4ff0ccfc948d939552d.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.