circuit_diagram#

Plotting functions used in the visualization backend of the sequencer.

Module Contents#

Classes#

_ControlFlowEnd

Identifer for end of a control-flow scope.

Functions#

gate_box(→ None)

A box for a single gate containing a label.

pulse_baseband(→ None)

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

pulse_modulated(→ None)

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

meter(→ None)

A simple meter to depict a measurement.

acq_meter(→ None)

Variation of the meter to depict a acquisition.

acq_meter_text(→ None)

Same as acq_meter, but also displays text.

cnot(→ None)

Markers to denote a CNOT gate between two qubits.

cz(→ None)

Markers to denote a CZ gate between two qubits.

reset(→ None)

A broken line to denote qubit initialization.

_walk_schedule(→ Iterator[tuple[int, ...)

_walk_schedule_only_operations(...)

_draw_operation(→ None)

_get_indices(→ set[int])

_draw_loop(→ None)

_draw_conditional(→ None)

_get_qubit_and_port_map_from_schedule(...)

_get_feedback_label_and_qubit_idx(→ tuple[str, int] | None)

Check if the operation is an acquisition/measure gate with a feedback trigger label.

circuit_diagram_matplotlib(...)

gate_box(ax: matplotlib.axes.Axes, time: float, qubit_idxs: list[int], text: str, **kw) None[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) None[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) None[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) None[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) None[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) None[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) None[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) None[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) None[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.

class _ControlFlowEnd[source]#

Bases: enum.Enum

Identifer for end of a control-flow scope.

LOOP_END[source]#
CONDI_END[source]#
_walk_schedule(sched_or_op: quantify_scheduler.schedules.schedule.Schedule | quantify_scheduler.operations.operation.Operation, time_offset: int = 0) Iterator[tuple[int, quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule | _ControlFlowEnd]][source]#
_walk_schedule_only_operations(sched_or_op: quantify_scheduler.schedules.schedule.Schedule | quantify_scheduler.operations.operation.Operation) Iterator[quantify_scheduler.operations.operation.Operation][source]#
_draw_operation(operation: quantify_scheduler.operations.operation.Operation, qubit_map: dict[str, int], port_map: dict[str, int], ax: matplotlib.axes.Axes, time: int, schedule_resources: dict[str, quantify_scheduler.resources.Resource]) None[source]#
_get_indices(sched_or_op: quantify_scheduler.schedules.schedule.Schedule | quantify_scheduler.operations.operation.Operation, qubit_map: dict[str, int], port_map: dict[str, int]) set[int][source]#
_draw_loop(ax: matplotlib.axes.Axes, qubit_map: dict[str, int], port_map: dict[str, int], operation: quantify_scheduler.operations.control_flow_library.LoopOperation, start_time: int, end_time: int, x_offset: float = 0.35, y_offset: float = 0.3, fraction: float = 0.2) None[source]#
_draw_conditional(ax: matplotlib.axes.Axes, measure_time: int, measure_qubit_idx: int, body: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule, body_start: int, body_end: int, qubit_map: dict[str, int], port_map: dict[str, int]) None[source]#
_get_qubit_and_port_map_from_schedule(schedule: quantify_scheduler.schedules.schedule.Schedule) tuple[dict[str, int], dict[str, int]][source]#
_get_feedback_label_and_qubit_idx(operation: quantify_scheduler.operations.operation.Operation, port_map: dict[str, int], qubit_map: dict[str, int]) tuple[str, int] | None[source]#

Check if the operation is an acquisition/measure gate with a feedback trigger label.

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