qibocal.protocols.two_qubit_interaction.chsh package#

Submodules#

qibocal.protocols.two_qubit_interaction.chsh.circuits module#

Auxiliary functions to run CHSH using circuits.

qibocal.protocols.two_qubit_interaction.chsh.circuits.create_bell_circuit(nqubits, qubits, theta=0.7853981633974483, bell_state=0)[source]#

Creates the circuit to generate the bell states and with a theta-measurement bell_state chooses the initial bell state for the test: 0 -> |00>+|11> 1 -> |00>-|11> 2 -> |10>-|01> 3 -> |10>+|01> Native defaults to only using GPI2 and GPI gates.

qibocal.protocols.two_qubit_interaction.chsh.circuits.create_bell_circuit_native(nqubits, qubits, theta=0.7853981633974483, bell_state=0)[source]#

Creates the circuit to generate the bell states and with a theta-measurement bell_state chooses the initial bell state for the test: 0 -> |00>+|11> 1 -> |00>-|11> 2 -> |10>-|01> 3 -> |10>+|01> Native defaults to only using GPI2 and GPI gates.

qibocal.protocols.two_qubit_interaction.chsh.circuits.create_chsh_circuits(platform, qubits, theta=0.7853981633974483, bell_state=0, native=True, readout_basis=['ZZ', 'ZX', 'XZ', 'XX'])[source]#

Creates the circuits needed for the 4 measurement settings for chsh. Native defaults to only using GPI2 and GPI gates. rerr adds a readout bitflip error to the simulation.

qibocal.protocols.two_qubit_interaction.chsh.protocol module#

Protocol for CHSH experiment using both circuits and pulses.

qibocal.protocols.two_qubit_interaction.chsh.protocol.CLASSICAL_BOUND = 2#

Classical limit of CHSH,

qibocal.protocols.two_qubit_interaction.chsh.protocol.QUANTUM_BOUND = 2.8284271247461903#

Quantum limit of CHSH.

qibocal.protocols.two_qubit_interaction.chsh.protocol.MITIGATION_MATRIX_FILE = 'mitigation_matrix'#

File where readout mitigation matrix is stored.

class qibocal.protocols.two_qubit_interaction.chsh.protocol.CHSHParameters(bell_states: list, ntheta: int, native: Optional[bool] = False, apply_error_mitigation: Optional[bool] = False)[source]#

Bases: Parameters

CHSH runcard inputs.

bell_states: list#

List with Bell states to compute CHSH. The following notation it is used: 0 -> |00>+|11> 1 -> |00>-|11> 2 -> |10>-|01> 3 -> |10>+|01>

ntheta: int#

Number of angles probed linearly between 0 and 2 pi.

native: Optional[bool] = False#

If True a circuit will be created using only GPI2 and CZ gates.

apply_error_mitigation: Optional[bool] = False#

Error mitigation model

class qibocal.protocols.two_qubit_interaction.chsh.protocol.CHSHData(bell_states: list, thetas: list, data: dict[typing.Union[str, int], typing.Union[str, int], int, tuple, str] = <factory>, mitigation_matrix: dict[tuple[typing.Union[str, int], ...], numpy.ndarray[typing.Any, numpy.dtype[+_ScalarType_co]]] = <factory>)[source]#

Bases: Data

CHSH Data structure.

bell_states: list#

Bell states list.

thetas: list#

Angles probed.

data: dict[Union[str, int], Union[str, int], int, tuple, str]#

Raw data acquired.

mitigation_matrix: dict[tuple[typing.Union[str, int], ...], numpy.ndarray[typing.Any, numpy.dtype[+_ScalarType_co]]]#

Mitigation matrix computed using the readout_mitigation_matrix protocol.

save(path: Path)[source]#

Saving data including mitigation matrix.

classmethod load(path: Path)[source]#

Custom loading to acco modate mitigation matrix

register_basis(pair, bell_state, basis, frequencies)[source]#

Store output for single qubit.

merge_frequencies(pair, bell_state)[source]#

Merge frequencies with different measurement basis.

property params#

Convert non-arrays attributes into dict.

class qibocal.protocols.two_qubit_interaction.chsh.protocol.CHSHResults(chsh: dict[tuple[typing.Tuple[typing.Union[str, int], typing.Union[str, int]], int], float] = <factory>, chsh_mitigated: dict[tuple[typing.Tuple[typing.Union[str, int], typing.Union[str, int]], int], float] = <factory>)[source]#

Bases: Results

CHSH Results class.

chsh: dict[tuple[Tuple[Union[str, int], Union[str, int]], int], float]#

Raw CHSH value.

chsh_mitigated: dict[tuple[Tuple[Union[str, int], Union[str, int]], int], float]#

Mitigated CHSH value.

qibocal.protocols.two_qubit_interaction.chsh.protocol.chsh_circuits = Routine(acquisition=<function _acquisition_circuits>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=True)#

CHSH experiment using circuits.

qibocal.protocols.two_qubit_interaction.chsh.protocol.chsh_pulses = Routine(acquisition=<function _acquisition_pulses>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=True)#

CHSH experiment using pulses.

qibocal.protocols.two_qubit_interaction.chsh.pulses module#

Auxialiary functions to run CHSH using pulses.

qibocal.protocols.two_qubit_interaction.chsh.pulses.create_bell_sequence(platform, qubits, theta=0.7853981633974483, bell_state=0)[source]#

Creates the pulse sequence to generate the bell states and with a theta-measurement bell_state chooses the initial bell state for the test: 0 -> |00>+|11> 1 -> |00>-|11> 2 -> |10>-|01> 3 -> |10>+|01>

qibocal.protocols.two_qubit_interaction.chsh.pulses.create_chsh_sequences(platform, qubits, theta=0.7853981633974483, bell_state=0, readout_basis=['ZZ', 'ZX', 'XZ', 'XX'])[source]#

Creates the pulse sequences needed for the 4 measurement settings for chsh.

qibocal.protocols.two_qubit_interaction.chsh.utils module#

Auxiliary functions to run CHSH protocol.

qibocal.protocols.two_qubit_interaction.chsh.utils.compute_chsh(frequencies, basis, i)[source]#

Computes the chsh inequality out of the frequencies of the 4 circuits executed.