qibocal.protocols.two_qubit_interaction package#

Subpackages#

Submodules#

qibocal.protocols.two_qubit_interaction.cz_virtualz module#

CZ virtual correction experiment for two qubit gates, tune landscape.

class qibocal.protocols.two_qubit_interaction.cz_virtualz.CZVirtualZParameters(theta_start: float, theta_end: float, theta_step: float, flux_pulse_amplitude: Optional[float] = None, flux_pulse_duration: Optional[float] = None, dt: Optional[float] = 20, parking: bool = True)[source]#

Bases: Parameters

CzVirtualZ runcard inputs.

theta_start: float#

Initial angle for the low frequency qubit measurement in radians.

theta_end: float#

Final angle for the low frequency qubit measurement in radians.

theta_step: float#

Step size for the theta sweep in radians.

flux_pulse_amplitude: Optional[float] = None#

Amplitude of flux pulse implementing CZ.

flux_pulse_duration: Optional[float] = None#

Duration of flux pulse implementing CZ.

dt: Optional[float] = 20#

Time delay between flux pulses and readout.

parking: bool = True#

Wether to park non interacting qubits or not.

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.cz_virtualz.CZVirtualZResults(fitted_parameters: dict[tuple[str, Union[str, int]]], cz_angle: dict[Tuple[Union[str, int], Union[str, int]], float], virtual_phase: dict[Tuple[Union[str, int], Union[str, int]], dict[Union[str, int], float]], leakage: dict[Tuple[Union[str, int], Union[str, int]], dict[Union[str, int], float]])[source]#

Bases: Results

CzVirtualZ outputs when fitting will be done.

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

Fitted parameters

cz_angle: dict[Tuple[Union[str, int], Union[str, int]], float]#

CZ angle.

virtual_phase: dict[Tuple[Union[str, int], Union[str, int]], dict[Union[str, int], float]]#

Virtual Z phase correction.

leakage: dict[Tuple[Union[str, int], Union[str, int]], dict[Union[str, int], float]]#

Leakage on control qubit for pair.

_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.

class qibocal.protocols.two_qubit_interaction.cz_virtualz.CZVirtualZData(data: dict[tuple, numpy.ndarray[typing.Any, numpy.dtype[dtype([('target', '<f8'), ('control', '<f8')])]]] = <factory>, thetas: list = <factory>, vphases: dict[typing.Tuple[typing.Union[str, int], typing.Union[str, int]], dict[typing.Union[str, int], float]] = <factory>, amplitudes: dict[tuple[typing.Union[str, int], typing.Union[str, int]], float] = <factory>, durations: dict[tuple[typing.Union[str, int], typing.Union[str, int]], float] = <factory>)[source]#

Bases: Data

CZVirtualZ data.

data: dict[tuple, numpy.ndarray[typing.Any, numpy.dtype[dtype([('target', '<f8'), ('control', '<f8')])]]]#
thetas: list#
_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.

vphases: dict[Tuple[Union[str, int], Union[str, int]], dict[Union[str, int], float]]#
amplitudes: dict[tuple[Union[str, int], Union[str, int]], float]#
durations: dict[tuple[Union[str, int], Union[str, int]], float]#
qibocal.protocols.two_qubit_interaction.cz_virtualz.create_sequence(platform: Platform, setup: str, target_qubit: Union[str, int], control_qubit: Union[str, int], ordered_pair: list[Union[str, int], Union[str, int]], parking: bool, dt: float, amplitude: Optional[float] = None, duration: Optional[float] = None) tuple[qibolab.pulses.PulseSequence, dict[Union[str, int], qibolab.pulses.Pulse], dict[Union[str, int], qibolab.pulses.Pulse], dict[Union[str, int], qibolab.pulses.Pulse], dict[Union[str, int], qibolab.pulses.Pulse]][source]#

Create the experiment PulseSequence.

qibocal.protocols.two_qubit_interaction.cz_virtualz._acquisition(params: CZVirtualZParameters, platform: Platform, targets: list[Tuple[Union[str, int], Union[str, int]]]) CZVirtualZData[source]#

Acquisition for CZVirtualZ.

Check the two-qubit landscape created by a flux pulse of a given duration and amplitude. The system is initialized with a Y90 pulse on the low frequency qubit and either an Id or an X gate on the high frequency qubit. Then the flux pulse is applied to the high frequency qubit in order to perform a two-qubit interaction. The Id/X gate is undone in the high frequency qubit and a theta90 pulse is applied to the low frequency qubit before measurement. That is, a pi-half pulse around the relative phase parametereized by the angle theta. Measurements on the low frequency qubit yield the 2Q-phase of the gate and the remnant single qubit Z phase aquired during the execution to be corrected. Population of the high frequency qubit yield the leakage to the non-computational states during the execution of the flux pulse.

qibocal.protocols.two_qubit_interaction.cz_virtualz.fit_function(x, amplitude, offset, phase)[source]#

Sinusoidal fit function.

qibocal.protocols.two_qubit_interaction.cz_virtualz._fit(data: CZVirtualZData) CZVirtualZResults[source]#

Fitting routine for the experiment.

The used model is

\[y = p_0 sin\Big(x + p_2\Big) + p_1.\]
qibocal.protocols.two_qubit_interaction.cz_virtualz._plot(data: CZVirtualZData, fit: CZVirtualZResults, target: Tuple[Union[str, int], Union[str, int]])[source]#

Plot routine for CZVirtualZ.

qibocal.protocols.two_qubit_interaction.cz_virtualz._update(results: CZVirtualZResults, platform: Platform, target: Tuple[Union[str, int], Union[str, int]])[source]#
qibocal.protocols.two_qubit_interaction.cz_virtualz.cz_virtualz = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=True)#

CZ virtual Z correction routine.

qibocal.protocols.two_qubit_interaction.cz_virtualz_signal module#

CZ virtual correction experiment for two qubit gates, tune landscape.

class qibocal.protocols.two_qubit_interaction.cz_virtualz_signal.CZVirtualZSignalParameters(theta_start: float, theta_end: float, theta_step: float, flux_pulse_amplitude: Optional[float] = None, flux_pulse_duration: Optional[float] = None, dt: Optional[float] = 20, parking: bool = True)[source]#

Bases: CZVirtualZParameters

CzVirtualZ runcard inputs.

dt: Optional[float] = 20#

Time delay between flux pulses and readout.

flux_pulse_amplitude: Optional[float] = None#

Amplitude of flux pulse implementing CZ.

flux_pulse_duration: Optional[float] = None#

Duration of flux pulse implementing CZ.

hardware_average: bool = False#

By default hardware average will be performed.

parking: bool = True#

Wether to park non interacting qubits or not.

theta_start: float#

Initial angle for the low frequency qubit measurement in radians.

theta_end: float#

Final angle for the low frequency qubit measurement in radians.

theta_step: float#

Step size for the theta sweep in radians.

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.cz_virtualz_signal.CZVirtualZSignalResults(fitted_parameters: dict[tuple[str, Union[str, int]]], cz_angle: dict[Tuple[Union[str, int], Union[str, int]], float], virtual_phase: dict[Tuple[Union[str, int], Union[str, int]], dict[Union[str, int], float]], leakage: dict[Tuple[Union[str, int], Union[str, int]], dict[Union[str, int], float]])[source]#

Bases: CZVirtualZResults

CzVirtualZ outputs when fitting will be done.

_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.

fitted_parameters: dict[tuple[str, QubitId]]#

Fitted parameters

cz_angle: dict[QubitPairId, float]#

CZ angle.

virtual_phase: dict[QubitPairId, dict[QubitId, float]]#

Virtual Z phase correction.

leakage: dict[QubitPairId, dict[QubitId, float]]#

Leakage on control qubit for pair.

class qibocal.protocols.two_qubit_interaction.cz_virtualz_signal.CZVirtualZSignalData(data: dict[tuple, numpy.ndarray[typing.Any, numpy.dtype[dtype([('target', '<f8'), ('control', '<f8')])]]] = <factory>, thetas: list = <factory>, vphases: dict[typing.Tuple[typing.Union[str, int], typing.Union[str, int]], dict[typing.Union[str, int], float]] = <factory>, amplitudes: dict[tuple[typing.Union[str, int], typing.Union[str, int]], float] = <factory>, durations: dict[tuple[typing.Union[str, int], typing.Union[str, int]], float] = <factory>)[source]#

Bases: CZVirtualZData

CZVirtualZ data.

_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.

data: dict[tuple, npt.NDArray[CZVirtualZType]]#
thetas: list#
vphases: dict[QubitPairId, dict[QubitId, float]]#
amplitudes: dict[tuple[QubitId, QubitId], float]#
durations: dict[tuple[QubitId, QubitId], float]#
qibocal.protocols.two_qubit_interaction.cz_virtualz_signal._acquisition(params: CZVirtualZSignalParameters, platform: Platform, targets: list[Tuple[Union[str, int], Union[str, int]]]) CZVirtualZSignalData[source]#

Acquisition for CZVirtualZ. See https://arxiv.org/pdf/1904.06560.pdf

Check the two-qubit landscape created by a flux pulse of a given duration and amplitude. The system is initialized with a Y90 pulse on the low frequency qubit and either an Id or an X gate on the high frequency qubit. Then the flux pulse is applied to the high frequency qubit in order to perform a two-qubit interaction. The Id/X gate is undone in the high frequency qubit and a theta90 pulse is applied to the low frequency qubit before measurement. That is, a pi-half pulse around the relative phase parametereized by the angle theta. Measurements on the low frequency qubit yield the 2Q-phase of the gate and the remnant single qubit Z phase aquired during the execution to be corrected. Population of the high frequency qubit yield the leakage to the non-computational states during the execution of the flux pulse.

qibocal.protocols.two_qubit_interaction.cz_virtualz_signal._plot(data: CZVirtualZSignalData, fit: CZVirtualZSignalResults, target: Tuple[Union[str, int], Union[str, int]])[source]#

Plot routine for CZVirtualZ.

qibocal.protocols.two_qubit_interaction.cz_virtualz_signal.cz_virtualz_signal = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=True)#

CZ virtual Z correction routine.

qibocal.protocols.two_qubit_interaction.utils module#

qibocal.protocols.two_qubit_interaction.utils.RANDOM_HIGH_VALUE = 1000000.0#

High value to avoid None when computing FFT.

qibocal.protocols.two_qubit_interaction.utils.order_pair(pair: Tuple[Union[str, int], Union[str, int]], platform: Platform) tuple[Union[str, int], Union[str, int]][source]#

Order a pair of qubits by drive frequency.

qibocal.protocols.two_qubit_interaction.utils.fit_flux_amplitude(matrix, amps, times)[source]#

Estimate amplitude for CZ gate.

Given the pattern of a chevron plot (see for example Fig. 2 here https://arxiv.org/pdf/1907.04818.pdf). This function estimates the CZ amplitude by finding the amplitude which gives the highest oscillation period. In case there are multiple values with the same period, given the symmetry, the median value is chosen. The FFT also gives a first estimate for the duration of the CZ gate.

Parameters:
  • matrix (np.ndarray) – signal matrix

  • amps (np.ndarray) – amplitudes swept

  • times (np.ndarray) – duration swept

Returns:

estimated amplitude index (int): amplitude index delta (float): omega for estimated amplitude

Return type:

amplitude (float)