PhilippAumann / circuitq

Toolbox for the simulation and analysis of superconducting circuits.
MIT License
39 stars 9 forks source link

visualization of a circuit #12

Closed MarjanFani closed 1 year ago

MarjanFani commented 1 year ago

Hi, I have issue with using the visualization function:

`import circuitq as cq import networkx as nx import matplotlib.pyplot as plt

Create the graph

graph = nx.MultiGraph() graph.add_edge(0, 1, element='C') graph.add_edge(0, 1, element='J')

Create a CircuitQ object

circuit = cq.CircuitQ(graph)

Visualize the circuit

circuitq.functions_file.visualize_circuit_general(circuit, "Macintosh HD/Users/fani/Desktop/circuit.png")`

here is the Error:


AttributeError Traceback (most recent call last) Cell In[14], line 14 11 circuit = cq.CircuitQ(graph) 13 # Visualize the circuit ---> 14 circuitq.functions_file.visualize_circuit_general(circuit, "Macintosh HD/Users/fani/Desktop/circuit.png")

File /opt/anaconda3/envs/circuitQ1/lib/python3.9/site-packages/circuitq-1.2.1-py3.9.egg/circuitq/functions_file.py:17, in visualize_circuit_general(graph, save_as) 6 """ 7 Visualises a circuit by creating a figure to an arbitrary path. 8 (...) 14 Arbitrary figure path 15 """ 16 circuit_func = copy.deepcopy(graph) ---> 17 for e in circuit_func.edges.data(): 18 e[2]['label'] = e[2]['element'] 19 circuit_vis = nx.nx_agraph.to_agraph(circuit_func)

AttributeError: 'CircuitQ' object has no attribute 'edges'