kqcircuits.util.netlist_graph

kqcircuits.util.netlist_graph.network_as_graph(network)[source]

Import KQC netlist as networkx graph.

Each element is added as a node, identified by the subcircuit id used in the netlist. For each node, the data dictionary contains the following items:

  • cell_name: identifies the PCell, for example Waveguide Coplanar$1.

    Multiple nodes can point to the same PCell, if it has identical parameters.

  • cell_type: The PCell full name, for example Waveguide Coplanar

  • location: A list [x, y] specifying the element coordinates in um.

  • instance_name: The instance name of the PCell instance, may be an empty string

  • name: A unique name for this instance. Equal to instance_name if that exists, made

    unique by appending a numbered suffix if needed. If the instance name is empty, a string containing the subcircuit_id.

  • properties: A dictionary containing the PCell properties associated with this instance

Parameters:

network – dictionary of netlist data obtained by loading the netlist json file

Returns. Networkx Graph

kqcircuits.util.netlist_graph.draw_graph(graph, with_labels=True, with_position=True, figsize=(8, 8), export_path=None)[source]

Draw a netlist graph

Parameters:
  • graph – Networkx Graph with data structures as loaded by network_as_graph

  • with_labels – if True, the unique name of each node will be shown as label

  • with_position – if True, the nodes will be positioned as they are physically located on the chip. If False, a spring layout will be used to position the nodes.

  • figsize – Figure size to pass to matplotlib, default (8, 8)

  • export_path – Path to export image to, or None to show interactive plot

../_images/kqcircuits.util.netlist_graph.png