Process Tomography¶
- class lightworks.tomography.LIProcessTomography(n_qubits: int, base_circuit: PhotonicCircuit)¶
Bases:
_ProcessTomography
Runs quantum process tomography using the linear inversion estimation method.
- Parameters:
n_qubits (int) – The number of qubits that will be used as part of the tomography.
base_circuit (PhotonicCircuit) – An initial circuit which realises the required operation and can be modified for performing tomography. It is required that the number of circuit input modes equals 2 * the number of qubits.
- property base_circuit: PhotonicCircuit¶
The base circuit which the tomography experiment will be performed on.
- property choi: ndarray[tuple[int, ...], dtype[complex128]]¶
Returns the calculate choi matrix for a circuit.
- fidelity(choi_exp: ndarray[tuple[int, ...], dtype[complex128]]) float ¶
Calculates fidelity of the calculated choi matrix compared to the expected one.
- get_experiments() ProcessTomographyList ¶
Generates all required tomography experiments for performing a process tomography algorithm.
- property n_qubits: int¶
The number of qubits within the system.
- process(data: list[dict[State, int]] | dict[tuple[str, str], dict[State, int]]) ndarray[tuple[int, ...], dtype[complex128]] ¶
Performs process tomography with the configured elements and calculates the choi matrix using linear inversion.
- Parameters:
data (list | dict) – The collected measurement data. If a list then this should match the order the experiments were provided, and if a dictionary, then each key should be tuple of the input and measurement basis.
- Returns:
The calculated choi matrix for the process.
- Return type:
np.ndarray
- class lightworks.tomography.MLEProcessTomography(n_qubits: int, base_circuit: PhotonicCircuit)¶
Bases:
_ProcessTomography
Runs quantum process tomography using the maximum likelihood estimation method.
- Parameters:
n_qubits (int) – The number of qubits that will be used as part of the tomography.
base_circuit (PhotonicCircuit) – An initial circuit which realises the required operation and can be modified for performing tomography. It is required that the number of circuit input modes equals 2 * the number of qubits.
- property base_circuit: PhotonicCircuit¶
The base circuit which the tomography experiment will be performed on.
- property choi: ndarray[tuple[int, ...], dtype[complex128]]¶
Returns the calculate choi matrix for a circuit.
- fidelity(choi_exp: ndarray[tuple[int, ...], dtype[complex128]]) float ¶
Calculates fidelity of the calculated choi matrix compared to the expected one.
- get_experiments() ProcessTomographyList ¶
Generates all required tomography experiments for performing a process tomography algorithm.
- property n_qubits: int¶
The number of qubits within the system.
- process(data: list[dict[State, int]] | dict[tuple[str, str], dict[State, int]]) ndarray[tuple[int, ...], dtype[complex128]] ¶
Performs process tomography with the configured elements and calculates the choi matrix using maximum likelihood estimation.
- Parameters:
data (list | dict) – The collected measurement data. If a list then this should match the order the experiments were provided, and if a dictionary, then each key should be tuple of the input and measurement basis.
- Returns:
The calculated choi matrix for the process.
- Return type:
np.ndarray
- class lightworks.tomography.process_tomography_mle.MLETomographyAlgorithm(n_qubits: int, input_basis: list[str])¶
Bases:
object
Implements the pgdB algorithm for maximum likelihood estimation from https://arxiv.org/abs/1803.10062 for calculation of a physical choi matrix from the tomography measurement data.
- Parameters:
n_qubits (int) – The number of qubits used within the tomography.
- pgdb(data: dict[tuple[str, str], float], max_iter: int = 1000, stop_threshold: float = 1e-10) ndarray[tuple[int, ...], dtype[complex128]] ¶
Runs the pgdB algorithm on the provided data set.
- Parameters:
data (dict) – The measured tomography experiment data. The keys of this dictionary should be the input/measurement basis and the values should be the calculated expectation values.
max_iter (int, optional) – Sets the maximum number of iterations that the algorithm can do, defaults to 1000.
stop_threshold (float, optional) – Sets the stopping threshold for the gradient descent algorithm. Defaults to 1e-10.
- Returns:
The calculated choi matrix
- Return type:
np.ndarray