module documentation

Undocumented

Function plot Contour plot the given data array
Function plot_wigner Produce a Matplotlib figure for the Wigner function on the given state vector.
Function plot_wigner_projection Plot the projection onto 0, 1, +, - for the given circuit.
Function plot_wigner_snapshot Undocumented
Function simulate_wigner Simulate the circuit, optionally partial trace the results, and calculate the Wigner function.
Function simulate_wigner_multiple_statevectors Simulate the circuit, optionally partial trace the results, and calculate the Wigner function on each statevector starting with the given label.
Function wigner Calculate the Wigner function on the given state vector.
Function wigner_mle Find the maximum likelihood estimation for the given state vectors and calculate the Wigner function on the result.
Function _add_contourf Add a matplotlib contourf plot with color levels based on min/max values in z.
Function _wigner Undocumented
def plot(data, axes_min: int = -6, axes_max: int = 6, axes_steps: int = 200, file: str = None, num_colors: int = 100, draw_grid: bool = False, dpi=100): (source)

Contour plot the given data array

def plot_wigner(circuit: CVCircuit, state_vector: Statevector, trace: bool = True, file: str = None, axes_min: int = -6, axes_max: int = 6, axes_steps: int = 200, num_colors: int = 100, draw_grid: bool = False, dpi: int = 100, g=sqrt(2), method: str = 'clenshaw'): (source)

Produce a Matplotlib figure for the Wigner function on the given state vector.

Optionally perform partial trace.

Parameters
circuit:CVCircuitcircuit with results to trace (to find Qubit index)
state_vector:Statevectorsimulation results to trace over and plot
trace:bool, optionalTrue if qubits should be traced. Defaults to True.
file:str, optionalFile path to save plot. If none, return plot. Defaults to None.
axes_min:int, optionalMinimum axes plot value. Defaults to -6.
axes_max:int, optionalMaximum axes plot value. Defaults to 6.
axes_steps:int, optionalSteps between axes ticks. Defaults to 200.
num_colors:int, optionalNumber of color gradients in legend. Defaults to 100.
draw_grid:bool, optionalTrue if grid lines should be drawn on plot. Defaults to False.
dpi:intUndocumented
gUndocumented
method:strUndocumented
def plot_wigner_projection(circuit: CVCircuit, qubit, file: str = None, draw_grid: bool = False, g=sqrt(2), method: str = 'clenshaw'): (source)

Plot the projection onto 0, 1, +, - for the given circuit.

This is limited to CVCircuit with only one qubit, also provided as a parameter.

Parameters
circuit:CVCircuitcircuit to simulate and plot
qubit:Qubitqubit to measure
file:str, optionalFile path to save file, if None return plot. Defaults to None.
draw_grid:bool, optionalTrue if gridlines should be drawn on plots. Defaults to False.
gUndocumented
method:strUndocumented
def plot_wigner_snapshot(circuit: CVCircuit, result: Result, folder: Path = None, trace: bool = True, axes_min: int = -6, axes_max: int = 6, axes_steps: int = 200, num_colors: int = 100, g=sqrt(2), method: str = 'clenshaw'): (source)

Undocumented

def simulate_wigner(circuit: CVCircuit, xvec: np.ndarray, shots: int, noise_passes=None, conditional: bool = True, trace: bool = False, g=sqrt(2), method: str = 'clenshaw'): (source)

Simulate the circuit, optionally partial trace the results, and calculate the Wigner function.

def simulate_wigner_multiple_statevectors(circuit: CVCircuit, xvec: np.ndarray, shots: int, statevector_label: str, num_statevectors: int, noise_passes=None, trace: bool = False, g=sqrt(2), method: str = 'clenshaw'): (source)

Simulate the circuit, optionally partial trace the results, and calculate the Wigner function on each statevector starting with the given label.

def wigner(state, axes_min: int = -6, axes_max: int = 6, axes_steps: int = 200, g=sqrt(2), method: str = 'clenshaw'): (source)

Calculate the Wigner function on the given state vector.

Parameters
state:array-likestate vector to calculate Wigner function
axes_min:int, optionalMinimum axes plot value. Defaults to -6.
axes_max:int, optionalMaximum axes plot value. Defaults to 6.
axes_steps:int, optionalSteps between axes ticks. Defaults to 200.
gUndocumented
method:strUndocumented
cutoff:intcutoff used during simulation
hbar:int, optionalhbar value to use in Wigner function calculation. Defaults to 2.
Returns
array-likeResults of Wigner function calculation
def wigner_mle(states, axes_min: int = -6, axes_max: int = 6, axes_steps: int = 200, g=sqrt(2), method: str = 'clenshaw'): (source)

Find the maximum likelihood estimation for the given state vectors and calculate the Wigner function on the result.

Parameters
states:array-like of array-likestate vectors to calculate MLE and Wigner function
axes_min:int, optionalMinimum axes plot value. Defaults to -6.
axes_max:int, optionalMaximum axes plot value. Defaults to 6.
axes_steps:int, optionalSteps between axes ticks. Defaults to 200.
gUndocumented
method:strUndocumented
cutoff:intcutoff used during simulation
hbar:int, optionalhbar value to use in Wigner function calculation. Defaults to 2.
Returns
array-likeResults of Wigner function calculation
def _add_contourf(ax, fig, title, x, y, z, draw_grid: bool = False): (source)

Add a matplotlib contourf plot with color levels based on min/max values in z.

def _wigner(state, xvec, yvec=None, g=sqrt(2), method: str = 'clenshaw'): (source)

Undocumented