API#

Geometry Construction#

Classes and functions for construction and manipulation of geometric objects.

Component definition

Component([name, with_uuid, max_name_length])

A Component is an empty canvas where you add polygons, references and ports (to connect to other components).

ComponentReference(component[, origin, ...])

Pointer to a Component with x, y, rotation, mirror.

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

Returns a Component from a GDS file.

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])

Path object for smooth Paths.

straight([length, npoints, snap_to_grid])

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(*[, sections, ...])

Waveguide information to extrude a path between two CrossSection.

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

Return CrossSection.

strip([width, offset, layer, sections, ...])

Return CrossSection.

heater_metal(*[, width, offset, layer, ...])

Return CrossSection.

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.

geometry

boolean(A, B, operation[, precision, layer])

Performs boolean operations between 2 Component/Reference/list objects.

boolean_klayout(gdspath1, gdspath2[, ...])

Returns a boolean operation between two components Uses KLayout python API.

boolean_polygons(operand1, operand2, operation)

Perform a boolean operation and return the list of resulting Polygons.

fillet(operand, radius[, tolerance])

Perform a fillet operation and return the list of resulting Polygons.

functions

invert(elements[, border, precision, layer])

Returns inverted version of input shapes with additional border around the edges.

layer_priority(component, layer_high_order, ...)

Returns new component after removing one layer from another.

offset(elements[, distance, use_union, ...])

Returns new Component with polygons eroded or dilated by an offset.

outline(elements[, distance, precision, ...])

Returns Component containing the outlined polygon(s).

trim(component, domain[, precision, ...])

Trim a component by another geometry, preserving the component's layers and ports.

union(component[, by_layer, precision, ...])

Returns new Component with inverted union of Component polygons.

xor_diff(A, B[, precision])

Given two Components A and B, performs the layer-by-layer XOR difference between A and B and returns polygons representing the differences between A and B.

decorators

cell()

Parametrized Decorator for Component functions.

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

Component([name, with_uuid, max_name_length])

A Component is an empty canvas where you add polygons, references and ports (to connect to other components).

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

Waveguide information to extrude a path.

CrossSectionFactory

alias of Callable[..., CrossSection]

CrossSectionSpec

Represent a PEP 604 union type

Layer

alias of tuple[int, int]

LayerSpec

Represent a PEP 604 union type

LayerSpecs

Represent a PEP 604 union type

LayerLevel(*[, name, layer, thickness, ...])

Level for 3D LayerStack.

Label

MaterialSpec

Represent a PEP 604 union type

MultiCrossSectionAngleSpec

alias of list[tuple[Callable[..., CrossSection] | CrossSection | dict[str, Any] | str | Transition, tuple[int, ...]]]

PathType

Represent a PEP 604 union type

Route(*, references[, labels])

RouteFactory

alias of Callable[..., Route]

Routes(*, references, lengths[, ports, ...])

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

CrossSection to extrude a path with a waveguide.

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

Manhattan Step.

StepAllAngle([x, y, dx, dy, ds, exit_angle, ...])

Pack#

pack

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

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

grid([components, spacing, separation, ...])

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[, tolerance, ...])

Returns instances, connections and placements from Component as a dict.

get_netlist_flat(component, **kwargs)

Parses a recursive netlist for a component as if it was a single netlist with its lowest-level instances.