gdsfactory.Component#
- class gdsfactory.Component(name: str | None = None, kcl: KCLayout | None = None, kdb_cell: Cell | None = None, ports: Ports | None = None)[source]#
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: Cell | None = None, ports: Ports | None = None) None [source]#
Initializes a Component.
Methods
__init__
([name, kcl, kdb_cell, ports])Initializes a Component.
absorb
(reference)Absorbs polygons from ComponentReference into Component.
add
(instances)add_array
(component[, columns, rows, ...])Creates a ComponentReference reference to a Component.
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 cells.
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_np
()Returns the bounding box of the Component as a numpy array.
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, ...])Add an instance of another KCell.
create_port
(**kwargs)Proxy for [Ports.create_port][kfactory.kcell.Ports.create_port].
create_vinst
(cell)Insert the KCell as a VInstance into a VKCell or KCell.
delete
()Delete the cell.
draw_ports
()Draw all the ports on their respective layer.
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.
evaluate_insts
()Check all KLayout instances and create kfactory Instances.
extract
(layers[, recursive])Extracts a list of layers and adds them to a new Component.
flatten
([merge])Flatten the cell.
from_kcell
(kcell)Returns a Component from a KCell.
from_yaml
(constructor, node[, verbose])Internal function used by the placer to convert yaml to a KCell.
get_boxes
(layer[, recursive])Returns a list of boxes.
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.
hash
()Provide a unique hash of the cell.
insert
(inst[, property_id])Inserts a cell instance given by another reference.
insert_vinsts
()Insert all virtual instances and create Instances of real KCells.
l2n
([port_types])Generate a LayoutToNetlist object from the port types.
layer
(*args, **kwargs)Get the layer info, convenience for klayout.db.Layout.layer.
over_under
(layer[, distance])Flattens and performs over-under on a layer in the Component.
plot
([show_labels, show_ruler, return_fig])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.
rebuild
()Rebuild the instances of the KCell.
ref
(*args, **kwargs)Returns a Component Instance.
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.
set_meta_data
()Set metadata of the Cell.
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_graphviz
([recursive])Returns a netlist graph with graphviz.
to_yaml
(representer, node)Internal function to convert the cell to yaml.
transform
(inst_or_trans[, trans, no_warn, ...])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
basename
center
Returns the coordinate center of the bounding box.
dcenter
Coordinate of the port in um.
dx
X coordinate of the port in um.
dxmax
Returns the x-coordinate of the left 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 port in um.
dymax
Returns the x-coordinate of the left edge of the bounding box.
dymin
Returns the x-coordinate of the left 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".
layers
name
Name of the KCell.
named_references
Returns a dictionary of named references.
ports
Ports associated with the cell.
prop_id
Gets the properties ID associated with the cell.
references
Returns a list of references.
settings
Settings dictionary.
settings_units
Dictionary containing the units of the settings.
x
Returns the x-coordinate of the center of the bounding box.
xmax
Returns the x-coordinate of the left edge of the bounding box.
xmin
Returns the x-coordinate of the left edge of the bounding box.
xsize
Returns the x-coordinate of the left edge of the bounding box.
y
Returns the y-coordinate of the center of the bounding box.
yaml_tag
ymax
Returns the x-coordinate of the left edge of the bounding box.
ymin
Returns the x-coordinate of the left edge of the bounding box.
ysize
Returns the x-coordinate of the left edge of the bounding box.
info
kcl
boundary
insts
vinsts
size_info
dsize_info