circuit_diagram#

Plotting functions used in the visualization backend of the sequencer.

Module Contents#

Functions#

gate_box(ax, time, qubit_idxs, text, **kw)

A box for a single gate containing a label.

pulse_baseband(ax, time, qubit_idxs, text, **kw)

Adds a visual indicator for a Baseband pulse to the matplotlib.axes.Axis

pulse_modulated(ax, time, qubit_idxs, text, **kw)

Adds a visual indicator for a Modulated pulse to the matplotlib.axes.Axis

meter(ax, time, qubit_idxs, text, **kw)

A simple meter to depict a measurement.

acq_meter(ax, time, qubit_idxs, text, **kw)

Variation of the meter to depict a acquisition.

acq_meter_text(ax, time, qubit_idxs, text, **kw)

Same as acq_meter, but also displays text.

cnot(ax, time, qubit_idxs, text, **kw)

Markers to denote a CNOT gate between two qubits.

cz(ax, time, qubit_idxs, text, **kw)

Markers to denote a CZ gate between two qubits.

reset(ax, time, qubit_idxs, text, **kw)

A broken line to denote qubit initialization.

_locate_qubit_in_address(qubit_map, address)

Returns the name of a qubit in a pulse address.

circuit_diagram_matplotlib(...)

Creates a circuit diagram visualization of a schedule using matplotlib.

gate_box(ax: matplotlib.axes.Axes, time: float, qubit_idxs: List[int], text: str, **kw)[source]#

A box for a single gate containing a label.

Parameters:
  • ax – The matplotlib Axes.

  • time – The time of the gate.

  • qubit_idxs – The qubit indices.

  • text – The gate name.

  • kw – Additional keyword arguments to be passed to drawing the gate box.

pulse_baseband(ax: matplotlib.axes.Axes, time: float, qubit_idxs: List[int], text: str, **kw)[source]#

Adds a visual indicator for a Baseband pulse to the matplotlib.axes.Axis instance.

Parameters:
  • ax – The matplotlib Axes.

  • time – The time of the pulse.

  • qubit_idxs – The qubit indices.

  • text – The pulse name.

  • kw – Additional keyword arguments to be passed to drawing the pulse.

pulse_modulated(ax: matplotlib.axes.Axes, time: float, qubit_idxs: List[int], text: str, **kw)[source]#

Adds a visual indicator for a Modulated pulse to the matplotlib.axes.Axis instance.

Parameters:
  • ax – The matplotlib Axes.

  • time – The time of the pulse.

  • qubit_idxs – The qubit indices.

  • text – The pulse name.

  • kw – Additional keyword arguments to be passed to drawing the pulse.

meter(ax: matplotlib.axes.Axes, time: float, qubit_idxs: List[int], text: str, **kw)[source]#

A simple meter to depict a measurement.

Parameters:
  • ax – The matplotlib Axes.

  • time – The time of the measurement.

  • qubit_idxs – The qubit indices.

  • text – The measurement name.

  • kw – Additional keyword arguments to be passed to drawing the meter.

acq_meter(ax: matplotlib.axes.Axes, time: float, qubit_idxs: List[int], text: str, **kw)[source]#

Variation of the meter to depict a acquisition.

Parameters:
  • ax – The matplotlib Axes.

  • time – The time of the measurement.

  • qubit_idxs – The qubit indices.

  • text – The measurement name.

  • kw – Additional keyword arguments to be passed to drawing the acq meter.

acq_meter_text(ax: matplotlib.axes.Axes, time: float, qubit_idxs: List[int], text: str, **kw)[source]#

Same as acq_meter, but also displays text.

Parameters:
  • ax – The matplotlib Axes.

  • time – The time of the measurement.

  • qubit_idxs – The qubit indices.

  • text – The measurement name.

  • kw – Additional keyword arguments to be passed to drawing the acq meter.

cnot(ax: matplotlib.axes.Axes, time: float, qubit_idxs: List[int], text: str, **kw)[source]#

Markers to denote a CNOT gate between two qubits.

Parameters:
  • ax – The matplotlib Axes.

  • time – The time of the CNOT.

  • qubit_idxs – The qubit indices.

  • text – The CNOT name.

  • kw – Additional keyword arguments to be passed to drawing the CNOT.

cz(ax: matplotlib.axes.Axes, time: float, qubit_idxs: List[int], text: str, **kw)[source]#

Markers to denote a CZ gate between two qubits.

Parameters:
  • ax – The matplotlib Axes.

  • time – The time of the CZ.

  • qubit_idxs – The qubit indices.

  • text – The CZ name.

  • kw – Additional keyword arguments to be passed to drawing the CZ.

reset(ax: matplotlib.axes.Axes, time: float, qubit_idxs: List[int], text: str, **kw)[source]#

A broken line to denote qubit initialization.

Parameters:
  • ax – matplotlib axis object.

  • time – x position to draw the reset on

  • qubit_idxs – indices of the qubits that the reset is performed on.

  • text – The reset name.

  • kw – Additional keyword arguments to be passed to drawing the reset.

_locate_qubit_in_address(qubit_map, address)[source]#

Returns the name of a qubit in a pulse address.

circuit_diagram_matplotlib(schedule: quantify_scheduler.Schedule, figsize: Tuple[int, int] = None, ax: matplotlib.axes.Axes | None = None) Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes | List[matplotlib.axes.Axes]][source]#

Creates a circuit diagram visualization of a schedule using matplotlib.

Parameters:
  • schedule – the schedule to render.

  • figsize – matplotlib figsize.

  • ax – Axis handle to use for plotting.

Returns:

  • fig – matplotlib figure object.

  • ax – matplotlib axis object.