gdsfactory.Component

gdsfactory.Component#

class gdsfactory.Component(*, base: TKCell)[source]#
class gdsfactory.Component(name: str | None = None, kcl: KCLayout | None = None, kdb_cell: Cell | None = None, ports: Iterable[ProtoPort[Any]] | None = None, info: dict[str, Any] | None = None, settings: dict[str, Any] | None = None)

Canvas where you add polygons, instances and ports.

  • stores settings that you use to build the component

  • stores info that you want to use

  • can return ports by type (optical, electrical …)

  • can return netlist for circuit simulation

  • can write to GDS, OASIS

  • can show in KLayout, matplotlib or 3D

Properties:

info: dictionary that includes derived properties, simulation_settings, settings (test_protocol, docs, …)

__init__(name: str | None = None, kcl: KCLayout | None = None, kdb_cell: kdb.Cell | None = None, ports: Iterable[ProtoPort[Any]] | None = None, info: dict[str, Any] | None = None, settings: dict[str, Any] | None = None, *, base: TKCell | None = None) None#

Constructor of KCell.

Parameters:
  • base – If not None, a KCell will be created from and existing KLayout Cell

  • name – Name of the cell, if None will autogenerate name to “Unnamed_<cell_index>”.

  • kcl – KCLayout the cell should be attached to.

  • kdb_cell – If not None, a KCell will be created from and existing KLayout Cell

  • ports – Attach an existing [Ports][kfactory.kcell.Ports] object to the KCell, if None create an empty one.

  • info – Info object to attach to the KCell.

  • settings – KCellSettings object to attach to the KCell.

Methods

__init__([name, kcl, kdb_cell, ports, info, ...])

Constructor of KCell.

absorb(reference)

Absorbs polygons from ComponentReference into Component.

add(instances)

add_label([text, position, layer])

Adds Label to the Component.

add_polygon(points, layer)

Adds a Polygon to the Component and returns a klayout Shape.

add_port([name, port, center, width, ...])

Adds a Port to the Component.

add_ports(ports[, prefix, suffix, keep_mirror])

Add a sequence of ports to the cell.

add_ref(component[, name, columns, rows, ...])

Adds a component instance reference to a Component.

add_route_info(cross_section, length[, ...])

Adds route information to a component.

area(layer)

Returns the area of the Component in um2.

auto_rename_ports([rename_func])

Rename the ports with the schema angle -> "NSWE" and sort by x and y.

bbox([layer])

bbox_np()

Returns the bounding box of the Component as a numpy array.

cell_index()

Gets the cell index.

circuit(l2n[, port_types])

Create the circuit of the KCell in the given netlist.

connectivity_check([port_types, layers, db, ...])

Create a ReportDatabase for port problems.

convert_to_static([recursive])

Convert the KCell to a static cell if it is pdk KCell.

copy()

Copy the full cell.

copy_child_info(component)

Copy and settings info from child component into parent.

copy_layers(layer_map[, recursive])

Remaps a list of layers and returns the same Component.

create_inst(cell[, trans, a, b, na, nb, ...])

create_port(**kwargs)

Create a port in the cell.

create_vinst(cell)

Insert the KCell as a VInstance into a VKCell or KCell.

dbbox([layer])

dcreate_inst(cell[, trans, a, b, na, nb, ...])

Add an instance of another KCell.

delete()

Delete the cell.

destroyed()

dmirror([p1, p2])

Mirror self at a line.

dmirror_x([x])

Mirror self at an y-axis at position x.

dmirror_y([y])

Mirror self at an x-axis at position y.

dmove(origin[, destination])

Move self in um.

dmovex(origin[, destination])

Move self in x-direction in um.

dmovey(origin[, destination])

Move self in y-direction in um.

draw_ports()

Draw all the ports on their respective layer.

drotate(angle[, center])

Rotate self by a given angle in degrees.

dup()

Copy the full cell.

each_inst()

Iterates over all child instances (which may actually be instance arrays).

each_overlapping_inst(b)

Gets the instances overlapping the given rectangle.

each_touching_inst(b)

Gets the instances overlapping the given rectangle.

extract(layers[, recursive])

Extracts a list of layers and adds them to a new Component.

flatten([merge])

Flatten the cell.

get_boxes(layer[, recursive])

Returns a list of boxes.

get_cross_section(cross_section, ...)

get_labels(layer[, recursive])

Returns a list of labels from the Component.

get_meta_data([meta_format])

Read metadata from the KLayout Layout object.

get_netlist([recursive])

Returns a place-aware netlist for circuit simulation.

get_paths(layer[, recursive])

Returns a list of paths.

get_polygons([merge, by, layers])

Returns a dict of Polygons per layer.

get_polygons_points([merge, scale, by, layers])

Returns a dict with list of points per layer.

get_ports_list(**kwargs)

Returns list of ports.

ibbox([layer])

icreate_inst(cell[, trans, a, b, na, nb, ...])

Add an instance of another KCell.

imirror([p1, p2])

Mirror self at a line.

imirror_x([x])

Mirror self at an y-axis at position x.

imirror_y([y])

Mirror self at an x-axis at position y.

imove(origin[, destination])

Move self in dbu.

imovex(origin[, destination])

Move self in x-direction in dbu.

imovey(origin[, destination])

Move self in y-direction in dbu.

insert(inst[, property_id])

Inserts a cell instance given by another reference.

insert_vinsts([recursive])

Insert all virtual instances and create Instances of real KCells.

irotate(angle[, center])

Rotate self in increments of 90°.

l2n([port_types])

Generate a LayoutToNetlist object from the port types.

layer(*args, **kwargs)

Get the layer info, convenience for klayout.db.Layout.layer.

layout()

library()

lock()

mirror([p1, p2])

Mirror self at a line.

mirror_x([x])

Mirror self at an y-axis at position x.

mirror_y([y])

Mirror self at an x-axis at position y.

move(origin[, destination])

Move self in dbu.

movex(origin[, destination])

Move self in x-direction in dbu.

movey(origin[, destination])

Move self in y-direction in dbu.

offset(layer, distance)

Offsets a Component layer by a distance in um.

over_under(layer[, distance, remove_old_layer])

Returns a Component over-under on a layer in the Component.

plot()

Plots the Component using klayout.

plot_netlist([recursive, with_labels, ...])

Plots a netlist graph with networkx.

plot_netlist_graphviz([recursive, ...])

Plots a netlist graph with graphviz.

pprint_ports(**kwargs)

Pretty prints ports.

read(filename[, options, register_cells, ...])

Read a GDS file into the existing KCell.

remap_layers(layer_map[, recursive])

Remaps a list of layers and returns the same Component.

remove_layers(layers[, recursive])

Removes a list of layers and returns the same Component.

rotate(angle[, center])

Rotate self.

set_meta_data()

Set metadata of the Cell.

shapes(layer)

show([lyrdb, l2n, keep_position, ...])

Stream the gds to klive.

to_3d([layer_views, layer_stack, exclude_layers])

Return Component 3D trimesh Scene.

to_dict([with_ports])

Returns a dictionary representation of the Component.

to_dtype()

Convert the kcell to a um kcell.

to_graphviz([recursive])

Returns a netlist graph with graphviz.

to_itype()

Convert the kcell to a dbu kcell.

transform(inst_or_trans[, trans, ...])

Transforms the instance or cell with the transformation given.

trim(left, bottom, right, top[, flatten])

Trims the Component to a bounding box.

write(filename[, save_options, ...])

Write a KCell to a GDS.

write_gds([gdspath, gdsdir, save_options, ...])

Write component to GDS and returns gdspath.

write_netlist(netlist[, filepath])

Returns netlist as YAML string.

Attributes

base

basename

boundary

center

Returns the coordinate center of the bounding box.

dcenter

Coordinate of the center of the bounding box in um.

dsize_info

dx

X coordinate of the center of the bounding box in um.

dxmax

Returns the x-coordinate of the right edge of the bounding box.

dxmin

Returns the x-coordinate of the left edge of the bounding box.

dxsize

Returns the width of the bounding box.

dy

Y coordinate of the center of the bounding box in um.

dymax

Returns the y-coordinate of the top edge of the bounding box.

dymin

Returns the y-coordinate of the bottom edge of the bounding box.

dysize

Returns the height of the bounding box.

factory_name

Return the name under which the factory was registered.

function_name

ghost_cell

Returns a value indicating whether the cell is a "ghost cell".

icenter

Returns the coordinate center of the bounding box.

info

insts

Instances associated with the cell.

isize_info

ix

Returns the x-coordinate of the center of the bounding box.

ixmax

Returns the x-coordinate of the right edge of the bounding box.

ixmin

Returns the x-coordinate of the left edge of the bounding box.

ixsize

Returns the width of the bounding box.

iy

Returns the y-coordinate of the center of the bounding box.

iymax

Returns the y-coordinate of the top edge of the bounding box.

iymin

Returns the y-coordinate of the bottom edge of the bounding box.

iysize

Returns the height of the bounding box.

kcl

kdb_cell

layers

locked

name

ports

Ports associated with the cell.

prop_id

Gets the properties ID associated with the cell.

routes

settings

Settings dictionary set by the [@vcell][kfactory.kcell.vcell] decorator.

settings_units

Dictionary containing the units of the settings.

size_info

vinsts

x

Returns the x-coordinate of the center of the bounding box.

xmax

Returns the x-coordinate of the right edge of the bounding box.

xmin

Returns the x-coordinate of the left edge of the bounding box.

xsize

Returns the width of the bounding box.

y

Returns the y-coordinate of the center of the bounding box.

yaml_tag

ymax

Returns the y-coordinate of the top edge of the bounding box.

ymin

Returns the y-coordinate of the bottom edge of the bounding box.

ysize

Returns the height of the bounding box.