qnet.visualization.circuit_pyx module¶
Circuit visualization via the pyx package
This requires a working LaTeX installation.
Summary¶
Functions:
draw_circuit |
Generate a graphic representation of circuit and store them in a file. |
draw_circuit_canvas |
Generate a PyX graphical representation of a circuit expression object. |
__all__: draw_circuit, draw_circuit_canvas
Reference¶
-
qnet.visualization.circuit_pyx.draw_circuit_canvas(circuit, hunit=4, vunit=-1.0, rhmargin=0.1, rvmargin=0.2, rpermutation_length=0.4, draw_boxes=True, permutation_arrows=False)[source]¶ Generate a PyX graphical representation of a circuit expression object.
Parameters: - circuit (ca.Circuit) – The circuit expression
- hunit (float) – The horizontal length unit, default =
HUNIT - vunit (float) – The vertical length unit, default =
VUNIT - rhmargin (float) – relative horizontal margin, default =
RHMARGIN - rvmargin (float) – relative vertical margin, default =
RVMARGIN - rpermutation_length (float) – the relative length of a permutation circuit, default =
RPLENGTH - draw_boxes (bool) – Whether to draw indicator boxes to denote subexpressions (Concatenation, SeriesProduct, etc.), default =
True - permutation_arrows (bool) – Whether to draw arrows within the permutation visualization, default =
False
Returns: A PyX canvas object that can be further manipulated or printed to an output image.
Return type: pyx.canvas.canvas
-
qnet.visualization.circuit_pyx.draw_circuit(circuit, filename, direction='lr', hunit=4, vunit=-1.0, rhmargin=0.1, rvmargin=0.2, rpermutation_length=0.4, draw_boxes=True, permutation_arrows=False)[source]¶ Generate a graphic representation of circuit and store them in a file. The graphics format is determined from the file extension.
Parameters: - circuit (ca.Circuit) – The circuit expression
- filename (str) – A filepath to store the output image under. The file name suffix determines the output graphics format
- direction – The horizontal direction of laying out series products. One of
'lr'and'rl'. This option overrides a negative value forhunit, default ='lr' - hunit (float) – The horizontal length unit, default =
HUNIT - vunit (float) – The vertical length unit, default =
VUNIT - rhmargin (float) – relative horizontal margin, default =
RHMARGIN - rvmargin (float) – relative vertical margin, default =
RVMARGIN - rpermutation_length (float) – the relative length of a permutation circuit, default =
RPLENGTH - draw_boxes (bool) – Whether to draw indicator boxes to denote subexpressions (Concatenation, SeriesProduct, etc.), default =
True - permutation_arrows (bool) – Whether to draw arrows within the permutation visualization, default =
False
Returns: Trueif printing was successful,Falseif not.Return type: