qibocal.protocols.two_qubit_interaction.chsh package¶
Submodules¶
qibocal.protocols.two_qubit_interaction.chsh.circuits module¶
- qibocal.protocols.two_qubit_interaction.chsh.circuits.create_bell_circuit(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(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(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 = np.float64(2.8284271247461903)¶
Quantum limit of CHSH.
- class qibocal.protocols.two_qubit_interaction.chsh.protocol.CHSHParameters(bell_states: list[int], ntheta: int, native: bool | None = True)[source]¶
Bases:
Parameters
CHSH runcard inputs.
- qibocal.protocols.two_qubit_interaction.chsh.protocol.merge_frequencies(data: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], int, tuple, str], pair: tuple[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], bell_state: int)[source]¶
Merge frequencies with different measurement basis.
- qibocal.protocols.two_qubit_interaction.chsh.protocol.mitigated_frequencies(frequencies, mitigation_matrix, thetas)[source]¶
- class qibocal.protocols.two_qubit_interaction.chsh.protocol.CHSHData(bell_states: list[int], thetas: list, data: dict[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], int, tuple, str] = <factory>, frequencies: dict[int, list[dict[str, list[int]]]] = <factory>, mitigated_frequencies: dict[int, list[dict[str, list[int]]]] = <factory>)[source]¶
Bases:
Data
CHSH Data structure.
- data: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], int, tuple, str]¶
Raw data acquired.
- _to_npz(path: Path, filename: str)¶
Helper function to use np.savez while converting keys into strings.
- property pairs¶
Access qubit pairs ordered alphanumerically from data structure.
- property qubits¶
Access qubits from data structure.
- register_qubit(dtype, data_keys, data_dict)¶
Store output for single qubit.
- class qibocal.protocols.two_qubit_interaction.chsh.protocol.CHSHResults(chsh: dict[tuple[~typing.Annotated[tuple[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], ~pydantic.functional_validators.BeforeValidator(func=~qibocal.calibration.calibration.<lambda>, json_schema_input_type=PydanticUndefined), ~pydantic.functional_serializers.PlainSerializer(func=~qibocal.calibration.calibration.<lambda>, return_type=PydanticUndefined, when_used=always)], int], float] = <factory>, chsh_mitigated: dict[tuple[~typing.Annotated[tuple[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], ~pydantic.functional_validators.BeforeValidator(func=~qibocal.calibration.calibration.<lambda>, json_schema_input_type=PydanticUndefined), ~pydantic.functional_serializers.PlainSerializer(func=~qibocal.calibration.calibration.<lambda>, return_type=PydanticUndefined, when_used=always)], int], float] = <factory>)[source]¶
Bases:
Results
CHSH Results class.
- _to_npz(path: Path, filename: str)¶
Helper function to use np.savez while converting keys into strings.
- chsh: dict[tuple[~typing.Annotated[tuple[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], ~pydantic.functional_validators.BeforeValidator(func=~qibocal.calibration.calibration.<lambda>, json_schema_input_type=PydanticUndefined), ~pydantic.functional_serializers.PlainSerializer(func=~qibocal.calibration.calibration.<lambda>, return_type=PydanticUndefined, when_used=always)], int], float]¶
Raw CHSH value.
- chsh_mitigated: dict[tuple[~typing.Annotated[tuple[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], ~pydantic.functional_validators.BeforeValidator(func=~qibocal.calibration.calibration.<lambda>, json_schema_input_type=PydanticUndefined), ~pydantic.functional_serializers.PlainSerializer(func=~qibocal.calibration.calibration.<lambda>, return_type=PydanticUndefined, when_used=always)], int], float]¶
Mitigated CHSH value.
- qibocal.protocols.two_qubit_interaction.chsh.protocol._acquisition(params: CHSHParameters, platform: Platform, targets: list[list[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]]]) CHSHData [source]¶
Data acquisition for CHSH protocol using pulse sequences.
- qibocal.protocols.two_qubit_interaction.chsh.protocol._plot(data: ~qibocal.protocols.two_qubit_interaction.chsh.protocol.CHSHData, fit: ~qibocal.protocols.two_qubit_interaction.chsh.protocol.CHSHResults, target: ~typing.Annotated[tuple[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], ~pydantic.functional_validators.BeforeValidator(func=~qibocal.calibration.calibration.<lambda>, json_schema_input_type=PydanticUndefined), ~pydantic.functional_serializers.PlainSerializer(func=~qibocal.calibration.calibration.<lambda>, return_type=PydanticUndefined, when_used=always)])[source]¶
Plotting function for CHSH protocol.
- qibocal.protocols.two_qubit_interaction.chsh.protocol._fit(data: CHSHData) CHSHResults [source]¶
Fitting for CHSH protocol.
- qibocal.protocols.two_qubit_interaction.chsh.protocol.chsh = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=True)¶
CHSH experiment using pulses.
qibocal.protocols.two_qubit_interaction.chsh.utils module¶
Auxiliary functions to run CHSH protocol.