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/c3eb6c5440f1f4828844003c367607cfaee1b1e61f565e4d23c961d80884a63e.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/ff17c296e5d43b7056ee12e42d575b8a2104d98132a5c58f67bc1e16668a77ef.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/86432f8d4b45e41405975a2e0623a9195d5396b7cdd930d9375bfbb6af71905d.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/acf0465b3b545496f264efb40f983c2824cf786e61962115ab1eec75cf2ab2ca.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/e44b865059587a275a79cff22e1dc02d8dc1b8ad53fe768ab0be4d757c7bec50.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/35ff66f647ea7724eb4adb9bf7e3133e5ebecb07e7be0c2bf331c2f34929538c.png
c = gf.components.ring_single(gap=0.2, radius=10, length_x=4, length_y=2)
c.plot()
../_images/c45499d061288848e5f8e138a29a428906fb56cc283c6bf1698c7953dda9de36.png
import gdsfactory as gf

c = gf.components.ring_double(gap=0.2, radius=10, length_x=4, length_y=2)
c.plot()
../_images/2dd54ba49027c1fb10739e853a6bf12be9733b162be5a8c2653d9ae73739bb77.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/ffcb4e6a4b1034f1f4b780d0be8daa9389ee14dbbb9880a19d94bbf57f08f526.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/96bcc3502b1d7c0682d8e7bb1c1503281e3cd8977b9d4b96d45d44cf40611566.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/cfc263637c0df4b6173d73ecb70ea5584653fa9f38c2488106c026e847942594.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/194442534e8f658529787d2ab265848b68b76d6741d4775c9b7d47ab932c24ed.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/ae9a687b7424b356f7fbfc5ff75fbd599217a95577dae23a2a459ea5fc3295c7.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/e78792d6bef73a57034949687a07568235938e5301040a02368a5c1ac9b008d7.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/c7f56ab7fe522a873a37eaed22a33362fb4a1e88903176cf79f9125f8a55af03.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/8c4dc4e77710e6750bcc4a6c1f4c1dd956c76d31a49aa6a7c15cd99c43d11b5c.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/76a33d4009e331a35ab1784ee2e4b82028928a1b16b6cabf0a8260faceb919ca.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/abb86eb9765389f7089262449cf50fb7953c1365b07e771bc84648ad667c4de7.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/b939faa2413edaf690cf53374820fa325f03eb341d51155b6a206fc3da618d0d.png

Straight#

import gdsfactory as gf

P = gf.path.straight(length=5, npoints=100)
f = P.plot()
../_images/557b255caf61d69c670160ad9ac36dc1f427a9f5cb819980bc551f7c3e0eab84.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/0eb904a880aa0d70e6c7a1e29126219645a825b45efa465f191545c2149b97e7.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/cff60cdfbf84a5508027585d2a8de485bcc852111955a23966010b572f96ee0f.png

Delay spiral#

c = gf.components.spiral_double()
c.plot()
../_images/d420900cb9bbed8d724c2f39a54458c32c70c7931e441ea57f59d1d09f80c75b.png
c = gf.components.spiral()
c.plot()
../_images/ff75ec07385a1ed6726922194b42fcc1a2ac44de45a38d9563755d41f1aeca00.png
c = gf.components.spiral_racetrack_fixed_length()
c.plot()
/home/runner/work/gdsfactory/gdsfactory/gdsfactory/components/bends/bend_circular.py:80: UserWarning: {'width': 0.5} ignored for cross_section 'strip'
  x = gf.get_cross_section(cross_section, width=width or x.width)
../_images/10db4753a811493739a11bc67738c162a647ce312a17ef8ee6e5681312802288.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/be5e4a892a7fe9b8cc50325117f4a5033647e5fc11de730fc956a283e4742c03.png
c = gf.components.nxn(north=3, south=4, east=0, west=0)
c.plot()
../_images/0531701b8ee7862fe2c5d3929684239ec6e4996779cbed24ee6daf0b1f950491.png
c = gf.components.pad()
c.plot()
../_images/01c7f48e24b2906f03ade973368b1f9c928b3141ccd8aecebd400e709a4b7e74.png
c = gf.components.pad_array90(columns=3)
c.plot()
../_images/a69dab579aaa844d04200388b93524bb812808ce0f3557378f9c8b9bfb6fa7c4.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/5d8ef5107b12315a9121cdd37454c304a2324db99a290068c3cbc192ce28b395.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/6662b9bb1e2366ceef6ac785893e65f551ff8d8116540473ec2c3e6006824111.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/d30d283b0eed97751672743ad032d46452b94cbf7007766329f694ec799a1793.png
c = gf.components.optimal_90deg(width=100.0, num_pts=15, length_adjust=1, layer=(2, 0))
c.plot()
../_images/bdb495155c78db3cdca7164d5bd5faf079e37c29cd048dff00b7a3ea33bc028e.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/a916b84a7ed33060ba07021c792cfb811eb9eed3a1b81437f78f0d9ebd2747cf.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.