Display : a console displayer plugin

Quantum circuits have a graphical representation often more explicit than instances of the class Circuit. This module provides tools to display a quantum circuit in a terminal.


No tools of this module will work in a Jupyter notebook. If you are using Jupyter, please use %qatdisplay magic

A function display() and a plugin Display are defined in this module. The function is used to display a single circuit in the console and the plugin is used to display all circuits composing a Batch.

For instance, the following code will display a Bell pair circuit in a console:

from qat.lang.AQASM import Program, H, CNOT
from qat.core.console import display

# Define Bell pair
prog = Program()
qubits = prog.qalloc(2)
prog.apply(H, qubits[0])
prog.apply(CNOT, qubits)
circ = prog.to_circ()

# Display circuit

The output of this code is:

Circuit (Press Q to quit)

 └─┘ │

If the circuit is too big to be displayed entirely in the terminal, please use arrows on your keyboard to display another part of your circuit. To leave the display mode, press “Q”.

class qat.core.console.Display(batchmode=False)

This plugin will display all circuits of a Batch. Circuits will be printed one by one.


batchmode (bool, optional) – if set to True, each circuit will be displayed in the console without waiting for a user input Default: False

compile(batch, specs)

“Compiles” the batch. All circuits of this batch are displayed. To display the next circuit, press “Q” To stop display, press “Ctrl + C”.

  • batch (Batch) – all circuits of this batch are displayed

  • specs (HardwareSpecs) – hardware specifications




Checks if this plugin have to post process results. The result of this function is always “False”.




Post processes results


results (BatchResult) – post processed result