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/86aba491a6a098c732fe4046ca8fddf2c08b2b3bc81382d1bec114955bfb422b.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/acbd2319e37399d3a66a6e45c2555a37e09fa5d58e97cd713096b98d345ab03d.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/73437c83fdbe7fdc6e87345e8bfe447ef8ddb65f4e84024b63628f190c066c7a.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/2ef67949dfbe841d94d7cae1abd91f14b9905e96965b1af5dcc5839d8fff9cf6.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/0b092679f6fa5a3803b570e84718a4732f7064dd19826c53c6f8f3669224fe35.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/0b49347931b746bf1a46571631368991959c9de485e381c0030c9d5e7711fe39.png
c = gf.components.ring_single(gap=0.2, radius=10, length_x=4, length_y=2)
c.plot()
../_images/45b1cb2b814b76ab0a9c64bab530ce2843988c1871dfefdd74857ef281fa1b95.png
import gdsfactory as gf

c = gf.components.ring_double(gap=0.2, radius=10, length_x=4, length_y=2)
c.plot()
../_images/564401fdc786e7bb141cb8be367962a26a8fe89a57faf65b891c2db6a9046534.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/24269def2b4ef5c3253b2725c14195f0c5c22893d893167e665d6607cd8202ac.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/c094207eb820e77425efed96a6cf94cdd8512b7d62d2b25c792e3e435e5a47c0.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/10cd00b87ce3afa513fea8c27aad82e40572db5686d54909b8dc44f450d988eb.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/796888f94b90a87e5212e22622c65ab2ad699d4be55194182cadb6f1be79abe5.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/53e2ad187674a2ec9cde8f0c6d6b595f39495031cf767a84bad1d0a70eff97b9.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/871264f48089fc6df714d889973d825443d12cf98143a26d0175e8a510c8fb58.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/54dd74c8646c9d191e1f610b5549b5fa90ac07bca54dd4220fa1b4cda2b5a286.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/9fb2d0ed59bc98e09c31c6f65b2644babd32e1145b5dfc8622234055d1ea1387.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/3ca31928f8fbda84c79e67a5dfd8547d0b2d3bd85d8d9446d2efd43e22a81328.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/67417c3e1aa7e9edbd269e207734766fa6222d5228c8982ab0bd878e1e89aeaf.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/683f008a1d4056492f85a6f703bb5c240db8ba024d02ba2b5456538223f53e38.png

Straight#

import gdsfactory as gf

P = gf.path.straight(length=5, npoints=100)
f = P.plot()
../_images/b7f743587cf5c67d1779b76c5915d1e788dff469868a7ff7cb2e47946d99965c.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/d063cb969abb21517fcbbfd6b6f64bf39ba5cf4a4bfe5e15d3551c8a3ee0a3bb.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/8a6f79dc4ed53cef8d078fc6f9d011efcc16c850c2e2e91b40628cc8ff9c376f.png

Delay spiral#

c = gf.components.spiral_double()
c.plot()
../_images/413bf77f7db512b9ac7a66e450c062ecfae3f5e7ca93af414a49ac466e8b10cf.png
c = gf.components.spiral()
c.plot()
../_images/c122609ff16ff1cf13487aaa405b7a63d4c6b6299bbce58d7c5e19a38c2e1b4c.png
c = gf.components.spiral_racetrack_fixed_length()
c.plot()
../_images/8772e092796d5f8676826cfa8df26847bfbdb5e4706847fac650e34facebd0c4.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/4585138c195281132a2020cbffc20eab088b99d2723885e3d7081941290dde2c.png
c = gf.components.nxn(north=3, south=4, east=0, west=0)
c.plot()
../_images/94e8c160ae7f50643f114c3895ca47acfd2a74055d3ec3e9fc17248c00821c76.png
c = gf.components.pad()
c.plot()
../_images/70087d810e169dc9c9f454fe5d6d56881b6aef4274b92fb10a0b30e87019d997.png
c = gf.components.pad_array90(columns=3)
c.plot()
../_images/81e10587ad65ba05a8c13d73f4f492be3b287dbfea86c31506ceb34134c24949.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/4498667e8fe2c2ca6536846f353b23c38d95fa17d6d12e923ee47166d2832098.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/849f8d49eeabf6e4b114951b7759c91790821d8df27e45dc72424e41cc3938a6.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/041ce4a6d0f19ba8f3273f91d8bfad581dece971cdb6580923b574e29789e435.png
c = gf.components.optimal_90deg(width=100.0, num_pts=15, length_adjust=1, layer=(2, 0))
c.plot()
../_images/9c3a145dba8c08bdc98d307ef9609cab6a2850fc22d9787398c48ba74cd891db.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/7cd3e9d5b4b48dd833b2bb0721c3386229281a5116c50d2b7387cbe699c07b44.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.