From 1a873c099fc7b5349c3ad09478fdb71c7a534368 Mon Sep 17 00:00:00 2001 From: Niko Savola Date: Thu, 4 Apr 2024 17:05:46 +0300 Subject: [PATCH] Rename `networkx_from_file` to `network_from_spice` --- gplugins/klayout/netlist_graph.py | 9 ++------- gplugins/klayout/plot_nets.py | 5 +++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/gplugins/klayout/netlist_graph.py b/gplugins/klayout/netlist_graph.py index 017d2d82..13e1e72d 100644 --- a/gplugins/klayout/netlist_graph.py +++ b/gplugins/klayout/netlist_graph.py @@ -47,7 +47,6 @@ def netlist_to_networkx( next(c for c in top_circuits if c.name.casefold() == top_cell.casefold()), ) - # unique_net_counter = Counter() all_used_nets = set() for circuit in top_circuits: for device in circuit.each_device(): @@ -77,11 +76,7 @@ def netlist_to_networkx( # Create NetworkX representation G.add_node(device_name, **parameters) for net in nets: - # unique_net_counter.update([net.expanded_name()]) - # net_name = ( - # f"{net.expanded_name()}_{unique_net_counter[net.expanded_name()]}" - # ) - net_name = f"{net.expanded_name()}" + net_name = net.expanded_name() G.add_edge(device_name, net_name) all_used_nets.add(net_name) @@ -94,7 +89,7 @@ def netlist_to_networkx( return G -def networkx_from_file( +def networkx_from_spice( filepath: PathType, include_labels: bool = True, top_cell: str | None = None, diff --git a/gplugins/klayout/plot_nets.py b/gplugins/klayout/plot_nets.py index 562b0010..eb4e48b9 100644 --- a/gplugins/klayout/plot_nets.py +++ b/gplugins/klayout/plot_nets.py @@ -5,7 +5,8 @@ import networkx as nx from gdsfactory.typings import PathType -from gplugins.klayout.netlist_graph import networkx_from_file +from gplugins.klayout.netlist_graph import networkx_from_spice +from gplugins.klayout.netlist_spice_reader import CalibreSpiceReader def plot_nets( @@ -27,7 +28,7 @@ def plot_nets( Helpful for reducing trivial waveguide elements. """ - G_connectivity = networkx_from_file(**locals()) + G_connectivity = networkx_from_spice(**locals()) if nodes_to_reduce: