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/43bc69f2e1daececd8d092adf87a73e71cc3ad89813cf2f98da899dd83e53989.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/6590b155e260b5f2aaa4a48d67afe53e1f850c7b6a9696fcb0b3386cd84e75ac.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/1ae26fda5a5cb661ad351357fe294bdb41e9b3691b57dae6e6269c4c0244c806.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/f717d6f0811e063b393b804e105dd67e5176ed3c028a09a9891a3e61578f3faf.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/320ab8d7e842ffd47c901d3d1c29c3695cf1305379c5446cc75eb9495aa62b47.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/1d9739ea5e11819ed473bce4dfc22bc8f3e28925eb0615a7b2aee2ddcc7b1f6b.png
c = gf.components.ring_single(gap=0.2, radius=10, length_x=4, length_y=2)
c.plot()
../_images/6eacbb9003b4326c4bdd213eb6b88a94192c75abbb5cf56f104127fdc434412c.png
import gdsfactory as gf

c = gf.components.ring_double(gap=0.2, radius=10, length_x=4, length_y=2)
c.plot()
../_images/d04795fa9a446f9d913eac837d387772e603357d201d8f4fffb993316bdd670c.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/fdce99d98ec4fb2a8c57c2d429dc13893136504a350377e4ebf8adbf5afebe81.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/62b48f024844ebc3a534775d53b175099e04e9776e4262bbef6585c8f810827d.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/80b719c820c3671ac8a6c0e2c810b9fbf5fc1b551493f8320aff3dbad9fdf01c.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/2220c2f9212459779409ac96f773d05b9ba1c7abae89478239a7eed23ccee930.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/3abcec72ccd977305cf4260f6384bf7ddaca86f85e81c793bb918193a7da8e4a.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/f2953da1300a9d05c7b7f7df893e56633a0cfcffc81e32ce53bdb0f05129e2ec.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/b679a3ffb648689068be7481df4c49b425db30f5717879d2262137002d311a11.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/9927fb142e0c6e78382d0ce6b115faea464700952bef9dede1d43cafd993a79c.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/71aff9a838bd41a5304afc95c0e97a9cf172950e3007418d346e67ae28162d1b.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/4b426a8a551f69b462287e99b922fab1dbdda6409139b2125b6ba7c193dc5396.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/4db35d0fa53f4f83521d198c66bb2a686c7325a68cf059741eb69045dff89b94.png

Straight#

import gdsfactory as gf

P = gf.path.straight(length=5, npoints=100)
f = P.plot()
../_images/3302f4f5d50e8c87faa08bde6e16b8db1319f3e62678598dbcc839401455d18f.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/e7259db631cc904c2374c575452246f6fce7b53e35bcbcbb1aff3de031d47bf6.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/e4f6546d3a77af812e8f54d5c33811129786ee3d2fc85bc4c55002d9e7189cbe.png

Delay spiral#

c = gf.components.spiral_double()
c.plot()
../_images/16b1e5307fd9b7a641d2fcb1d8b530395d82c711cbe6397e389fb75892158c42.png
c = gf.components.spiral()
c.plot()
../_images/1489642d8b1e5087fe52396a48f709e8d8ff4b5920948d28e00e5f2c5b050058.png
c = gf.components.spiral_racetrack_fixed_length()
c.plot()
../_images/ebba2ef794377b1f253f3bb8bba0d9f267aa404d2b4566be9a7be1931d8d35f1.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/1ff516296b9ed95baf072d16e28ab039b6003a5156c27e68c6572b27325207b9.png
c = gf.components.nxn(north=3, south=4, east=0, west=0)
c.plot()
../_images/db749e168db37bf0b823093f47658c9526834cd259366fc49983ef172636e72f.png
c = gf.components.pad()
c.plot()
../_images/46c2b0c96f477d40fd2749ecd9d8ffe963188d97d1a30827d78f5d26906978ca.png
c = gf.components.pad_array90(columns=3)
c.plot()
../_images/6afccbb90c8234a7886914161c054a7f2ee08ab5164aab12ef3d0b856b26d0b0.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/ab2062c2a5f4b47bd079e1fe0e2dadf41e2d98e7b5e63289c6ebeb1a433584ce.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/3e75124ea07401737f08ca7143a14f99e1fa3d8665cc128286f874dd7e2348a6.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/9287c20d54cd18aaea91540b7b3e9a4b204f53ef20ec08a2014a8e04412f3901.png
c = gf.components.optimal_90deg(width=100.0, num_pts=15, length_adjust=1, layer=(2, 0))
c.plot()
../_images/06043fffe9bdecc888e50514f82b2b76bbb7e34dfa4ae5a0777e6f04c6ea00a0.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/99686a48058403a229e63c1420687acdb0e49eb134ee97c63bae88f0e781559d.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.