API#

Geometry Construction#

Classes and functions for construction and manipulation of geometric objects.

Component definition

Component([name, kcl, kdb_cell, ports])

Canvas where you add polygons, instances and ports.

ComponentReference(inst)

Shadows dbu attributes of Instance for backward compatibility.

read.import_gds(gdspath[, cellname, ...])

Reads a GDS file and returns a Component.

read.from_yaml(yaml_str[, routing_strategy, ...])

Returns Component from YAML string or file.

read.from_np(ndarray[, nm_per_pixel, layer, ...])

Returns Component from a np.ndarray.

paths

Path([path])

You can extrude a Path with a CrossSection to create a Component.

straight([length, npoints])

Returns a straight path.

euler([radius, angle, p, use_eff, npoints])

Returns an euler bend that adiabatically transitions from straight to curved.

arc([radius, angle, npoints, start_angle])

Returns a radial arc.

spiral_archimedean(min_bend_radius, ...)

Returns an Archimedean spiral.

smooth(points[, radius, bend])

Returns a smooth Path from a series of waypoints.

cross_section functions

CrossSection(*, sections, ...] =, ...)

Waveguide information to extrude a path.

Transition(*, cross_section1, cross_section2)

Waveguide information to extrude a path between two CrossSection.

Section(*, width[, offset, insets, ...])

CrossSection to extrude a path with a waveguide.

cross_section([width, offset, layer, ...])

Return CrossSection.

strip([width, layer, radius, radius_min])

Return Strip cross_section.

heater_metal([width, layer, radius, ...])

Return Metal Strip cross_section.

pin([width, layer, layer_slab, ...])

Rib PIN doped cross_section.

pn([width, layer, layer_slab, ...])

Rib PN doped cross_section.

pn_with_trenches([width, layer, ...])

Rib PN doped cross_section.

strip_heater_metal_undercut([width, layer, ...])

Returns strip cross_section with top metal and undercut trenches on both.

strip_heater_metal([width, layer, ...])

Returns strip cross_section with top heater metal.

strip_heater_doped([width, layer, ...])

Returns strip cross_section with N++ doped heaters on both sides.

rib_heater_doped([width, layer, ...])

Returns rib cross_section with N++ doped heaters on both sides.

rib_heater_doped_via_stack([width, layer, ...])

Returns rib cross_section with N++ doped heaters on both sides.

transitions

transition(cross_section1, cross_section2[, ...])

Returns a smoothly-transitioning between two CrossSections.

boolean

boolean(A, B, operation[, layer1, layer2, layer])

Performs boolean operations between 2 Component or Instance objects.

decorators

cell(, register_factory=True, ...)

Decorator to convert a function into a Component.

typings

Anchor

alias of Literal['ce', 'cw', 'nc', 'ne', 'nw', 'sc', 'se', 'sw', 'center', 'cc']

CellSpec

Represent a PEP 604 union type

ComponentFactory

alias of Callable[[...], Component]

ComponentSpec

Represent a PEP 604 union type

CrossSectionFactory

alias of Callable[[...], CrossSection]

CrossSectionSpec

Represent a PEP 604 union type

Layer

Built-in immutable sequence.

LayerSpec

Represent a PEP 604 union type

LayerSpecs

All the operations on a read-only sequence.

MaterialSpec

Represent a PEP 604 union type

MultiCrossSectionAngleSpec

All the operations on a read-only sequence.

PathType

Represent a PEP 604 union type

Step([x, y, dx, dy])

Manhattan Step.

technology

AbstractLayer(*[, sizings_xoffsets, ...])

Generic design layer.

DerivedLayer(*[, sizings_xoffsets, ...])

Physical "derived layer", resulting from a combination of GDS design layers.

LayerLevel(*, name, layer, ...)

Level for 3D LayerStack.

LayerMap([value, names, module, qualname, ...])

You will need to create a new LayerMap with your specific foundry layers.

LayerStack(*, layers, ...)

For simulation and 3D rendering.

LayerView(gds_layer, gds_datatype, color, ...)

KLayout layer properties.

LayerViews(filepath, layers, *, layer_views, ...)

A container for layer properties for KLayout layer property (.lyp) files.

LogicalLayer(*[, sizings_xoffsets, ...])

GDS design layer.

lyp_to_dataclass(lyp_filepath[, overwrite])

Returns python LayerMap script from a klayout layer properties file lyp.

Pack#

pack

pack(component_list[, spacing, ...])

Pack a list of components into as few Components as possible.

grid([components, spacing, shape, align_x, ...])

Returns Component with a 1D or 2D grid of components.

grid_with_text([components, text_prefix, ...])

Returns Component with 1D or 2D grid of components with text labels.

Netlist#

get_netlist

get_netlist(component[, exclude_port_types, ...])

From Component returns a dict with instances, connections and placements.