qibocal.protocols.two_qubit_interaction.mermin package#

Submodules#

qibocal.protocols.two_qubit_interaction.mermin.protocol module#

class qibocal.protocols.two_qubit_interaction.mermin.protocol.MerminParameters(ntheta: int, native: Optional[bool] = False, apply_error_mitigation: Optional[bool] = False)[source]#

Bases: Parameters

Mermin experiment input parameters.

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

hardware_average: bool = False#

By default hardware average will be performed.

nshots: int#

Number of executions on hardware.

relaxation_time: float#

Wait time for the qubit to decohere back to the gnd state.

class qibocal.protocols.two_qubit_interaction.mermin.protocol.MerminData(thetas: list, data: dict[list[typing.Union[str, int]], numpy.ndarray[typing.Any, numpy.dtype[dtype([('theta', '<f8'), ('basis', '<U100'), ('state', '<i8'), ('frequency', '<i8')])]]] = <factory>, mitigation_matrix: dict[list[typing.Union[str, int]], numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]] = <factory>)[source]#

Bases: Data

Mermin Data structure.

thetas: list#

Angles probed.

data: dict[list[typing.Union[str, int]], numpy.ndarray[typing.Any, numpy.dtype[dtype([('theta', '<f8'), ('basis', '<U100'), ('state', '<i8'), ('frequency', '<i8')])]]]#

Raw data acquired.

mitigation_matrix: dict[list[Union[str, int]], numpy.ndarray[Any, numpy.dtype[numpy.float64]]]#

Mitigation matrix computed using the readout_mitigation_matrix protocol.

property targets#
_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property pairs#

Access qubit pairs ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

property qubits#

Access qubits from data structure.

register_qubit(dtype, data_keys, data_dict)#

Store output for single qubit.

Parameters:
  • data_keys (tuple) – Keys of Data.data.

  • data_dict (dict) – The keys are the fields of dtype and

  • arrays. (the values are the related) –

save(path: Path)#

Store data to file.

class qibocal.protocols.two_qubit_interaction.mermin.protocol.MerminResults(mermin: dict[tuple[typing.Union[str, int], ...], numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]] = <factory>, mermin_mitigated: dict[tuple[typing.Union[str, int], ...], numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]] = <factory>)[source]#

Bases: Results

Mermin Results class.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property params: dict#

Convert non-arrays attributes into dict.

save(path: Path)#

Store results to file.

mermin: dict[tuple[Union[str, int], ...], numpy.ndarray[Any, numpy.dtype[numpy.float64]]]#

Raw Mermin value.

mermin_mitigated: dict[tuple[Union[str, int], ...], numpy.ndarray[Any, numpy.dtype[numpy.float64]]]#

Mitigated Mermin value.

qibocal.protocols.two_qubit_interaction.mermin.protocol._acquisition(params: MerminParameters, platform: Platform, targets: list[list[Union[str, int]]]) MerminData[source]#

Data acquisition for Mermin protocol using pulse sequences.

qibocal.protocols.two_qubit_interaction.mermin.protocol._fit(data: MerminData) MerminResults[source]#

Fitting for Mermin protocol.

qibocal.protocols.two_qubit_interaction.mermin.protocol._plot(data: MerminData, fit: MerminResults, target)[source]#

Plotting function for Mermin protocol.

qibocal.protocols.two_qubit_interaction.mermin.pulses module#

qibocal.protocols.two_qubit_interaction.mermin.pulses.create_mermin_sequence(platform, qubits, theta=None)[source]#

Creates the pulse sequence to generate the bell states and with a theta-measurement

qibocal.protocols.two_qubit_interaction.mermin.pulses.create_mermin_sequences(platform, qubits, readout_basis, theta)[source]#

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

qibocal.protocols.two_qubit_interaction.mermin.utils module#

qibocal.protocols.two_qubit_interaction.mermin.utils.compute_mermin(frequencies, mermin_coefficients)[source]#

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

qibocal.protocols.two_qubit_interaction.mermin.utils.get_mermin_polynomial(n)[source]#
qibocal.protocols.two_qubit_interaction.mermin.utils.get_readout_basis(mermin_polynomial)[source]#
qibocal.protocols.two_qubit_interaction.mermin.utils.get_mermin_coefficients(mermin_polynomial)[source]#