deltakit.explorer.Client.get_correlation_matrix#
- Client.get_correlation_matrix(detectors: DetectionEvents, stim_circuit: str | Circuit, use_default_noise_model_edges: bool) tuple[ndarray[tuple[Any, ...], dtype[float64]], QubitCoordinateToDetectorMapping]#
Obtain a correlation matrix for a given set of detection events and corresponding circuit. Also returns a qubit-detector mapping that can be used to plot detectors in groups according to the qubit they correspond to. First trims the circuit and detector data.
- Parameters:
detectors (DetectionEvents) – Detectors data.
stim_circuit (str | stim.Circuit) – Clean STIM circuit.
use_default_noise_model_edges (bool) – If set to True, uses noise edges defined in the circuit, otherwise derives noise from detectors data.
- Returns:
The correlation matrix for the given data;
Mapping of a qubit (in coordinates) to the detectors it corresponds to.
- Return type:
Tuple[npt.NDArray, QubitCoordinateToDetectorMapping]
Examples
Getting the matrix and plotting it:
matrix, mapping = client.get_correlation_matrix( detectors, stim_circuit, use_default_noise_model_edges=True, ) plt = visualisation.correlation_matrix(matrix, mapping)