LogicalQ.Visualization.LogicalMatplotlibDrawer

mpl circuit visualization backend.

Attributes

WID

HIG

PORDER_REGLINE

PORDER_FLOW

PORDER_MASK

PORDER_LINE

PORDER_LINE_PLUS

PORDER_BARRIER

PORDER_GATE

PORDER_GATE_PLUS

PORDER_TEXT

INFINITE_FOLD

Classes

LogicalMatplotlibDrawer

Matplotlib drawer class called from circuit_drawer

NodeData

Class containing drawing data on a per node basis

Functions

_logical_matplotlib_circuit_drawer(circuit[, scale, ...])

Module Contents

LogicalQ.Visualization.LogicalMatplotlibDrawer.WID = 0.65
LogicalQ.Visualization.LogicalMatplotlibDrawer.HIG = 0.65
LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_REGLINE = 1
LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_FLOW = 3
LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_MASK = 4
LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_LINE = 6
LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_LINE_PLUS = 7
LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_BARRIER = 8
LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_GATE = 10
LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_GATE_PLUS = 11
LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_TEXT = 13
LogicalQ.Visualization.LogicalMatplotlibDrawer.INFINITE_FOLD = 10000000
LogicalQ.Visualization.LogicalMatplotlibDrawer._logical_matplotlib_circuit_drawer(circuit, scale=None, filename=None, style=None, plot_barriers=True, reverse_bits=False, justify=None, idle_wires=True, with_layout=True, fold=None, ax=None, initial_state=False, cregbundle=None, wire_order=None, expr_len=30, fold_qec=True, fold_qed=True, fold_logicalop=True)
class LogicalQ.Visualization.LogicalMatplotlibDrawer.LogicalMatplotlibDrawer(qubits, clbits, nodes, circuit, scale=None, style=None, reverse_bits=False, plot_barriers=True, fold=25, ax=None, initial_state=False, cregbundle=None, with_layout=False, expr_len=30, fold_qec=True, fold_qed=True, fold_logicalop=True)

Matplotlib drawer class called from circuit_drawer

_mathmode_regex
_circuit
_qubits
_clbits
_nodes
_scale = 1.0
_style = None
_plot_barriers = True
_reverse_bits = False
_fold = 25
_ax = None
_initial_state = False
_global_phase
_expr_len = 30
_cregbundle = None
_lwidth1 = 1.0
_lwidth15 = 1.5
_lwidth2 = 2.0
_lwidth3 = 3.0
_lwidth4 = 4.0
_flow_drawers
_flow_parent = None
_flow_wire_map
fold_qec = True
fold_qed = True
fold_logicalop = True
_char_list
draw(filename=None, verbose=False)

Main entry point to ‘matplotlib’ (‘mpl’) drawer. Called from visualization.circuit_drawer and from QuantumCircuit.draw through circuit_drawer.

_get_layer_widths(node_data, wire_map, outer_circuit, glob_data)

Compute the layer_widths for the layers

_set_bit_reg_info(wire_map, qubits_dict, clbits_dict, glob_data)

Get all the info for drawing bit/reg names and numbers

_get_coords(node_data, wire_map, outer_circuit, layer_widths, qubits_dict, clbits_dict, glob_data, flow_parent=None)

Load all the coordinate info needed to place the gates on the drawing.

_get_text_width(text, glob_data, fontsize, param=False, reg_remove_under=None)

Compute the width of a string in the default font

_draw_regs_wires(num_folds, xmax, max_x_index, qubits_dict, clbits_dict, glob_data)

Draw the register names and numbers, wires, and vertical lines at the ends

_add_nodes_and_coords(nodes, node_data, wire_map, outer_circuit, layer_widths, qubits_dict, clbits_dict, glob_data)

Add the nodes from ControlFlowOps and their coordinates to the main circuit

_draw_ops(nodes, node_data, wire_map, outer_circuit, layer_widths, qubits_dict, clbits_dict, glob_data, verbose=False)

Draw the gates in the circuit

_get_colors(node, node_data)

Get all the colors needed for drawing the circuit

_condition(node, node_data, wire_map, outer_circuit, cond_xy, glob_data)

Add a conditional to a gate

_measure(node, node_data, outer_circuit, glob_data)

Draw the measure symbol and the line to the clbit

_barrier(node, node_data, glob_data)

Draw a barrier

_gate(node, node_data, glob_data, xy=None)

Draw a 1-qubit gate

_multiqubit_gate(node, node_data, glob_data, xy=None)

Draw a gate covering more than one qubit

_flow_op_gate(node, node_data, glob_data)

Draw the box for a flow op circuit

_control_gate(node, node_data, glob_data, mod_control)

Draw a controlled gate

_set_ctrl_bits(ctrl_state, num_ctrl_qubits, qbit, glob_data, ec=None, tc=None, text='', qargs=None)

Determine which qubits are controls and whether they are open or closed

_ctrl_qubit(xy, glob_data, fc=None, ec=None, tc=None, text='', text_top=None)

Draw a control circle and if top or bottom control, draw control label

_x_tgt_qubit(xy, glob_data, ec=None, ac=None)

Draw the cnot target symbol

_symmetric_gate(node, node_data, base_type, glob_data)

Draw symmetric gates for cz, cu1, cp, and rzz

_swap(xy, color=None)

Draw a Swap gate

_swap_cross(xy, color=None)

Draw the Swap cross symbol

_sidetext(node, node_data, xy, tc=None, text='')

Draw the sidetext for symmetric gates

_line(xy0, xy1, lc=None, ls=None, zorder=PORDER_LINE)

Draw a line from xy0 to xy1

_plot_coord(x_index, y_index, gate_width, glob_data, flow_op=False)

Get the coord positions for an index

class LogicalQ.Visualization.LogicalMatplotlibDrawer.NodeData

Class containing drawing data on a per node basis

width = 0.0
x_index = 0
q_xy = []
c_xy = []
gate_text = ''
raw_gate_text = ''
ctrl_text = ''
param_text = ''
nest_depth = 0
expr_width = 0.0
expr_text = ''
inside_flow = False
indexset = ()
jump_values = []
circ_num = 0