State Tomography

class lightworks.tomography.StateTomography(n_qubits: int, base_circuit: PhotonicCircuit)

Bases: _Tomography

Generates the required circuit and performs data processing for the calculation of the density matrix of a state.

Parameters:
  • n_qubits (int) – The number of qubits that will be used as part of the tomography.

  • base_circuit (PhotonicCircuit) – An initial circuit which produces the required output state and can be modified for performing tomography. It is required that the number of circuit input modes equals 2 * the number of qubits.

fidelity(rho_exp: ndarray[tuple[int, ...], dtype[complex128]]) float

Calculates the fidelity of the calculated quantum state against the expected density matrix for the state.

Parameters:

rho_exp (np.ndarray) – The expected density matrix.

Returns:

The calculated fidelity value.

Return type:

float

get_experiments() StateTomographyList

Generates all required tomography experiments for performing a process tomography algorithm.

process(data: list[dict[State, int]] | dict[str, dict[State, int]]) ndarray[tuple[int, ...], dtype[complex128]]

Performs the state tomography process with the configured elements to calculate the density matrix of the output state.

Returns:

The calculated density matrix from the state tomography

process.

Return type:

np.ndarray

property rho: ndarray[tuple[int, ...], dtype[complex128]]

The most recently calculated density matrix.