LogicalQ.Visualization.LogicalMatplotlibDrawer ============================================== .. py:module:: LogicalQ.Visualization.LogicalMatplotlibDrawer .. autoapi-nested-parse:: mpl circuit visualization backend. Attributes ---------- .. autoapisummary:: LogicalQ.Visualization.LogicalMatplotlibDrawer.WID LogicalQ.Visualization.LogicalMatplotlibDrawer.HIG LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_REGLINE LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_FLOW LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_MASK LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_LINE LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_LINE_PLUS LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_BARRIER LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_GATE LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_GATE_PLUS LogicalQ.Visualization.LogicalMatplotlibDrawer.PORDER_TEXT LogicalQ.Visualization.LogicalMatplotlibDrawer.INFINITE_FOLD Classes ------- .. autoapisummary:: LogicalQ.Visualization.LogicalMatplotlibDrawer.LogicalMatplotlibDrawer LogicalQ.Visualization.LogicalMatplotlibDrawer.NodeData Functions --------- .. autoapisummary:: LogicalQ.Visualization.LogicalMatplotlibDrawer._logical_matplotlib_circuit_drawer Module Contents --------------- .. py:data:: WID :value: 0.65 .. py:data:: HIG :value: 0.65 .. py:data:: PORDER_REGLINE :value: 1 .. py:data:: PORDER_FLOW :value: 3 .. py:data:: PORDER_MASK :value: 4 .. py:data:: PORDER_LINE :value: 6 .. py:data:: PORDER_LINE_PLUS :value: 7 .. py:data:: PORDER_BARRIER :value: 8 .. py:data:: PORDER_GATE :value: 10 .. py:data:: PORDER_GATE_PLUS :value: 11 .. py:data:: PORDER_TEXT :value: 13 .. py:data:: INFINITE_FOLD :value: 10000000 .. py:function:: _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_logicalop=True) .. py:class:: 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_logicalop=True) Matplotlib drawer class called from circuit_drawer .. py:attribute:: _mathmode_regex .. py:attribute:: _circuit .. py:attribute:: _qubits .. py:attribute:: _clbits .. py:attribute:: _nodes .. py:attribute:: _scale :value: 1.0 .. py:attribute:: _style :value: None .. py:attribute:: _plot_barriers :value: True .. py:attribute:: _reverse_bits :value: False .. py:attribute:: _fold :value: 25 .. py:attribute:: _ax :value: None .. py:attribute:: _initial_state :value: False .. py:attribute:: _global_phase .. py:attribute:: _expr_len :value: 30 .. py:attribute:: _cregbundle :value: None .. py:attribute:: _lwidth1 :value: 1.0 .. py:attribute:: _lwidth15 :value: 1.5 .. py:attribute:: _lwidth2 :value: 2.0 .. py:attribute:: _lwidth3 :value: 3.0 .. py:attribute:: _lwidth4 :value: 4.0 .. py:attribute:: _flow_drawers .. py:attribute:: _flow_parent :value: None .. py:attribute:: _flow_wire_map .. py:attribute:: fold_qec :value: True .. py:attribute:: fold_logicalop :value: True .. py:attribute:: _char_list .. py:method:: draw(filename=None, verbose=False) Main entry point to 'matplotlib' ('mpl') drawer. Called from ``visualization.circuit_drawer`` and from ``QuantumCircuit.draw`` through circuit_drawer. .. py:method:: _get_layer_widths(node_data, wire_map, outer_circuit, glob_data) Compute the layer_widths for the layers .. py:method:: _set_bit_reg_info(wire_map, qubits_dict, clbits_dict, glob_data) Get all the info for drawing bit/reg names and numbers .. py:method:: _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. .. py:method:: _get_text_width(text, glob_data, fontsize, param=False, reg_remove_under=None) Compute the width of a string in the default font .. py:method:: _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 .. py:method:: _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 .. py:method:: _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 .. py:method:: _get_colors(node, node_data) Get all the colors needed for drawing the circuit .. py:method:: _condition(node, node_data, wire_map, outer_circuit, cond_xy, glob_data) Add a conditional to a gate .. py:method:: _measure(node, node_data, outer_circuit, glob_data) Draw the measure symbol and the line to the clbit .. py:method:: _barrier(node, node_data, glob_data) Draw a barrier .. py:method:: _gate(node, node_data, glob_data, xy=None) Draw a 1-qubit gate .. py:method:: _multiqubit_gate(node, node_data, glob_data, xy=None) Draw a gate covering more than one qubit .. py:method:: _flow_op_gate(node, node_data, glob_data) Draw the box for a flow op circuit .. py:method:: _control_gate(node, node_data, glob_data, mod_control) Draw a controlled gate .. py:method:: _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 .. py:method:: _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 .. py:method:: _x_tgt_qubit(xy, glob_data, ec=None, ac=None) Draw the cnot target symbol .. py:method:: _symmetric_gate(node, node_data, base_type, glob_data) Draw symmetric gates for cz, cu1, cp, and rzz .. py:method:: _swap(xy, color=None) Draw a Swap gate .. py:method:: _swap_cross(xy, color=None) Draw the Swap cross symbol .. py:method:: _sidetext(node, node_data, xy, tc=None, text='') Draw the sidetext for symmetric gates .. py:method:: _line(xy0, xy1, lc=None, ls=None, zorder=PORDER_LINE) Draw a line from xy0 to xy1 .. py:method:: _plot_coord(x_index, y_index, gate_width, glob_data, flow_op=False) Get the coord positions for an index .. py:class:: NodeData Class containing drawing data on a per node basis .. py:attribute:: width :value: 0.0 .. py:attribute:: x_index :value: 0 .. py:attribute:: q_xy :value: [] .. py:attribute:: c_xy :value: [] .. py:attribute:: gate_text :value: '' .. py:attribute:: raw_gate_text :value: '' .. py:attribute:: ctrl_text :value: '' .. py:attribute:: param_text :value: '' .. py:attribute:: nest_depth :value: 0 .. py:attribute:: expr_width :value: 0.0 .. py:attribute:: expr_text :value: '' .. py:attribute:: inside_flow :value: False .. py:attribute:: indexset :value: () .. py:attribute:: jump_values :value: [] .. py:attribute:: circ_num :value: 0