draw#

Draw photonic quantum circuit

Classes

DrawCircuit(circuit_name, circuit_nmode, ...)

Draw the photonic quantum circuit.

DrawClements(nmode, mzi_info[, cl, fs, method])

Draw the n-mode Clements architecture.

class DrawCircuit(circuit_name: str, circuit_nmode: int, circuit_operators: Sequential, measurements: ModuleList)[source]#

Bases: object

Draw the photonic quantum circuit.

Parameters:
  • circuit_name (str) – The name of the circuit.

  • circuit_nmode (int) – The number of modes in the circuit.

  • circuit_operators (Sequential) – The operators of the circuit.

  • measurements (ModuleList) – The measurements of the circuit.

barrier(order, wires, cl='black')[source]#
draw(depth=None, ops=None, measurements=None)[source]#

Draw circuit.

draw_any(order, wires, name, para_dict=None)[source]#

Draw arbitrary unitary gate.

draw_bs(name, order, wires, theta, phi=None)[source]#

Draw beamsplitter.

draw_delay(order, wires, inputs=None)[source]#

Draw delay loop.

draw_homodyne(order, wire, phi, name=None)[source]#

Draw homodyne measurement.

draw_lines(order, wires)[source]#

Act nothing.

draw_loss(order, wires, name, t)[source]#

Draw loss gate.

draw_mode_num()[source]#
draw_ps(order, wires, theta=0, name=None)[source]#

Draw phaseshift (rotation) gate.

draw_sq(order, wires, para_dic, name=None)[source]#

Draw squeezing gate, displacement gate.

save(filename)[source]#

Save the circuit as svg.

class DrawClements(nmode: int, mzi_info: dict, cl: str = 'dodgerblue', fs: int = 30, method: str = 'cssr')[source]#

Bases: object

Draw the n-mode Clements architecture.

Parameters:
  • nmode (int) – The number of modes of the Clements architecture.

  • mzi_info (dict) – The dictionary for mzi parameters, resulting from the decompose function.

  • cl (str) – The color for plotting. Default: 'dodgerblue'

  • fs (int) – The fontsize. Default: 30

  • method (str) – The way for Clements decomposition, 'cssr' or 'cssl'. Default: 'cssr'

static connect1(coordinate, ax, cl, wid=0.1, height=0.08, a=-0.05, b=-0.05, c=0.7, d=-0.05)[source]#

Connect odd column.

static connect2(coordinate, cl)[source]#

Connect even column.

static plot_paras(sort_mzi_dic, nmode, fs=20)[source]#

Plot mzi parameters for 'cssl' case.

static plot_paras_1(sort_mzi_dic, fs=20)[source]#

Plot mzi parameters for 'cssr' case.

plotting_clements()[source]#

Plot Clements structure with 'cssr' or 'cssl' type.

plotting_clements_1()[source]#

Plot 'cssr' with left to right order.

plotting_clements_2()[source]#

Plot cssl with right to left order.

ps_pos()[source]#

Label the position of each phaseshifter for 'cssr' case.

sort_mzi()[source]#

Sort mzi parameters in the same array for plotting.