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.
Type Alias WignerMethods Undocumented
Type Alias WignerResult Undocumented
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 | Path | None = None, num_colors: int = 100, draw_grid: bool = False, dpi: int = 100): (source)

Contour plot the given data array

def plot_wigner(circuit: CVCircuit, state_vector: Statevector, trace: bool = True, file: str | Path | None = None, axes_min: int = -6, axes_max: int = 6, axes_steps: int = 200, num_colors: int = 100, draw_grid: bool = False, dpi: int = 100, **wigner_kwargs): (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
**wigner_kwargsUndocumented
def plot_wigner_projection(circuit: CVCircuit, qubit: Qubit, file: str | Path | None = None, draw_grid: bool = False, **wigner_kwargs): (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.
**wigner_kwargsUndocumented
def plot_wigner_snapshot(circuit: CVCircuit, result: Result, folder: str | Path | None = None, trace: bool = True, axes_min: int = -6, axes_max: int = 6, axes_steps: int = 200, num_colors: int = 100, **wigner_kwargs): (source)

Undocumented

def simulate_wigner(circuit: CVCircuit, xvec: np.ndarray, shots: int, noise_passes: NoisePassLike | None = None, conditional_state: str | None = None, trace: bool = False, method: WignerMethods = 'clenshaw', g: float = np.sqrt(2)) -> tuple[WignerResult, Statevector]: (source)

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

Parameters
circuit:CVCircuitThe circuit to simulate
xvec:np.ndarrayThe grid points to evaluate on. This will also be used to define the grid in the y direction
shots:intThe number of shots to execute
noise_passes:NoisePassLike | NoneOptional noise passes to apply to the simulation
conditional_state:str | NoneAn optional state to select
trace:boolWhether or not to trace out all qubits, leaving the qumodes
method:WignerMethodsThe method used to calculate the wigner function.
g:floatUndocumented
Returns
tuple[WignerResult, Statevector]A tuple containing the wigner function and the statevector
def simulate_wigner_multiple_statevectors(circuit: CVCircuit, xvec: ArrayLike, shots: int, statevector_label: str, num_statevectors: int, noise_passes: NoisePassLike | None = None, trace: bool = False, g: float = np.sqrt(2), method: WignerMethods = 'clenshaw') -> list[WignerResult]: (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: ArrayLike | Statevector | DensityMatrix, axes_min: int = -6, axes_max: int = 6, axes_steps: int = 200, g: float = np.sqrt(2), method: WignerMethods = '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.
g:floatUndocumented
method:WignerMethodsUndocumented
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: Sequence[Statevector], axes_min: int = -6, axes_max: int = 6, axes_steps: int = 200, g: float = np.sqrt(2), method: WignerMethods = '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.
g:floatUndocumented
method:WignerMethodsUndocumented
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
WignerMethods = (source)

Undocumented

Value
Literal['clenshaw', 'iterative', 'laguerre', 'fft']
WignerResult = (source)

Undocumented

Value
tuple[np.ndarray, ...]
def _add_contourf(ax: Axes, fig: Figure, title: str, x: Sequence[int | float], y: Sequence[int | float], z: Sequence[int | float], draw_grid: bool = False): (source)

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

def _wigner(state: DensityMatrix, xvec: ArrayLike, yvec: ArrayLike | None = None, g: float = np.sqrt(2), method: WignerMethods = 'clenshaw') -> WignerResult: (source)

Undocumented