From 6a3cbae3a450a0a10c9c3071325f1a94601c0c1c Mon Sep 17 00:00:00 2001 From: Jay Gambetta Date: Mon, 19 Nov 2018 09:51:48 -0500 Subject: [PATCH] Fixing examples with new features (#1292) * Fixing examples with new features * Fixing print * Update --- .../python/{visualizing_circuits.py => circuit_draw.py} | 9 ++------- examples/python/qft.py | 6 +++--- 2 files changed, 5 insertions(+), 10 deletions(-) rename examples/python/{visualizing_circuits.py => circuit_draw.py} (69%) diff --git a/examples/python/visualizing_circuits.py b/examples/python/circuit_draw.py similarity index 69% rename from examples/python/visualizing_circuits.py rename to examples/python/circuit_draw.py index e215645491..ffe9db359b 100644 --- a/examples/python/visualizing_circuits.py +++ b/examples/python/circuit_draw.py @@ -11,7 +11,6 @@ Example showing how to draw a quantum circuit using Qiskit Terra. """ from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister -from qiskit.tools.visualization import circuit_drawer def build_bell_circuit(): @@ -27,9 +26,5 @@ def build_bell_circuit(): # Create the circuit bell_circuit = build_bell_circuit() -# Provide a name to write the diagram to the filesystem -circuit_drawer(bell_circuit, filename='./bell_circuit.png') - -# Use the return value with show() to display the diagram -diagram = circuit_drawer(bell_circuit) -diagram.show() +# Use the internal .draw() to print the circuit +print(bell_circuit) diff --git a/examples/python/qft.py b/examples/python/qft.py index f606c6e724..8cfc97977f 100644 --- a/examples/python/qft.py +++ b/examples/python/qft.py @@ -63,9 +63,9 @@ qft5.barrier() for j in range(5): qft5.measure(q[j], c[j]) -print(qft3.qasm()) -print(qft4.qasm()) -print(qft5.qasm()) +print(qft3) +print(qft4) +print(qft5) ############################################################### # Set up the API and execute the program.