mirror of https://github.com/Qiskit/qiskit.git
Omit QuantumCircuit as a parameter when drawing ControlFlowOps. (#7345)
Most ControlFlowOps have at least one param of type QuantumCircuit which qiskit.visualization.utils.get_param_str will attempt to stringify and display as an instruction parameter. This largely doesn't work, since the circuit's string will contain newlines, so instead draw ControlFlowOps with only their name. Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
This commit is contained in:
parent
9ba51b5cc9
commit
e77acc6aaf
|
@ -25,6 +25,7 @@ from qiskit.circuit import (
|
|||
Gate,
|
||||
Instruction,
|
||||
Measure,
|
||||
ControlFlowOp,
|
||||
)
|
||||
from qiskit.circuit.library import PauliEvolutionGate
|
||||
from qiskit.circuit.tools import pi_check
|
||||
|
@ -129,6 +130,9 @@ def get_param_str(op, drawer, ndigits=3):
|
|||
if not hasattr(op, "params") or any(isinstance(param, np.ndarray) for param in op.params):
|
||||
return ""
|
||||
|
||||
if isinstance(op, ControlFlowOp):
|
||||
return ""
|
||||
|
||||
if isinstance(op, Delay):
|
||||
param_list = [f"{op.params[0]}[{op.unit}]"]
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue