qibocal.protocols.two_qubit_interaction package#

Subpackages#

Submodules#

qibocal.protocols.two_qubit_interaction.optimize module#

virtual correction experiment for two qubit gates, tune landscape.

class qibocal.protocols.two_qubit_interaction.optimize.OptimizeTwoQubitGateParameters(theta_start: float, theta_end: float, theta_step: float, flux_pulse_amplitude_min: float, flux_pulse_amplitude_max: float, flux_pulse_amplitude_step: float, duration_min: int, duration_max: int, duration_step: int, dt: Optional[float] = 20, parking: bool = True, native: str = 'CZ')[source]#

Bases: Parameters

OptimizeTwoQubitGate 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_min: float#

Minimum amplitude of flux pulse swept.

flux_pulse_amplitude_max: float#

Maximum amplitude of flux pulse swept.

flux_pulse_amplitude_step: float#

Step amplitude of flux pulse swept.

duration_min: int#

Minimum duration of flux pulse swept.

duration_max: int#

Maximum duration of flux pulse swept.

duration_step: int#

Step duration of flux pulse swept.

dt: Optional[float] = 20#

Time delay between flux pulses and readout.

parking: bool = True#

Wether to park non interacting qubits or not.

native: str = 'CZ'#

Two qubit interaction to be calibrated.

iSWAP and CZ are the possible options.

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.optimize.OptimizeTwoQubitGateResults(fitted_parameters: dict[tuple[str, Union[str, int], float], list], native: str, angles: dict[tuple[Tuple[Union[str, int], Union[str, int]], float], float], virtual_phases: dict[tuple[Tuple[Union[str, int], Union[str, int]], float], dict[Union[str, int], float]], leakages: dict[tuple[Tuple[Union[str, int], Union[str, int]], float], dict[Union[str, int], float]], best_amp: dict[Tuple[Union[str, int], Union[str, int]]], best_dur: dict[Tuple[Union[str, int], Union[str, int]]], best_virtual_phase: dict[Tuple[Union[str, int], Union[str, int]]])[source]#

Bases: Results

CzVirtualZ outputs when fitting will be done.

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

Fitted parameters

native: str#

Native two qubit gate.

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

Two qubit gate angle.

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

Virtual Z phase correction.

leakages: dict[tuple[Tuple[Union[str, int], Union[str, int]], float], 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.

best_amp: dict[Tuple[Union[str, int], Union[str, int]]]#

Flux pulse amplitude of best configuration.

best_dur: dict[Tuple[Union[str, int], Union[str, int]]]#

Flux pulse duration of best configuration.

best_virtual_phase: dict[Tuple[Union[str, int], Union[str, int]]]#

Virtual phase to correct best configuration.

class qibocal.protocols.two_qubit_interaction.optimize.OptimizeTwoQubitGateData(data: dict[tuple, numpy.ndarray[typing.Any, numpy.dtype[dtype([('amp', '<f8'), ('theta', '<f8'), ('duration', '<f8'), ('prob_target', '<f8'), ('prob_control', '<f8')])]]] = <factory>, thetas: list = <factory>, native: str = 'CZ', 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

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

save(path: Path)#

Store data to file.

data: dict[tuple, numpy.ndarray[typing.Any, numpy.dtype[dtype([('amp', '<f8'), ('theta', '<f8'), ('duration', '<f8'), ('prob_target', '<f8'), ('prob_control', '<f8')])]]]#

Raw data.

thetas: list#

Angles swept.

native: str = 'CZ'#

Native two qubit gate.

amplitudes: dict[tuple[Union[str, int], Union[str, int]], float]#

“Amplitudes swept.

durations: dict[tuple[Union[str, int], Union[str, int]], float]#

Durations swept.

register_qubit(target, control, setup, theta, amp, duration, prob_control, prob_target)[source]#

Store output for single pair.

qibocal.protocols.two_qubit_interaction.optimize._acquisition(params: OptimizeTwoQubitGateParameters, platform: Platform, targets: list[Tuple[Union[str, int], Union[str, int]]]) OptimizeTwoQubitGateData[source]#

Repetition of correct virtual phase experiment for several amplitude and duration values.

qibocal.protocols.two_qubit_interaction.optimize._fit(data: OptimizeTwoQubitGateData) OptimizeTwoQubitGateResults[source]#

Repetition of correct virtual phase fit for all configurations.

qibocal.protocols.two_qubit_interaction.optimize._plot(data: OptimizeTwoQubitGateData, fit: OptimizeTwoQubitGateResults, target: Tuple[Union[str, int], Union[str, int]])[source]#

Plot routine for OptimizeTwoQubitGate.

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

Optimize two qubit gate protocol

qibocal.protocols.two_qubit_interaction.utils module#

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 standard deviation, indicating that there are oscillation along the z axis.

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)

qibocal.protocols.two_qubit_interaction.virtual_z_phases module#

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

class qibocal.protocols.two_qubit_interaction.virtual_z_phases.VirtualZPhasesParameters(theta_start: float, theta_end: float, theta_step: float, native: str = 'CZ', flux_pulse_amplitude: Optional[float] = None, flux_pulse_duration: Optional[float] = None, dt: Optional[float] = 20, parking: bool = True)[source]#

Bases: Parameters

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

native: str = 'CZ'#

Two qubit interaction to be calibrated.

iSWAP and CZ are the possible options.

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.virtual_z_phases.VirtualZPhasesResults(fitted_parameters: dict[tuple[str, Union[str, int]]], native: str, 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]], flux_pulse_amplitude: dict[Tuple[Union[str, int], Union[str, int]], float], flux_pulse_duration: dict[Tuple[Union[str, int], Union[str, int]], int])[source]#

Bases: Results

VirtualZ outputs when fitting will be done.

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

Fitted parameters

native: str#

Native two qubit gate.

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

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

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

Amplitude of flux pulse implementing CZ.

flux_pulse_duration: dict[Tuple[Union[str, int], Union[str, int]], int]#

Duration of flux pulse implementing CZ.

_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.virtual_z_phases.VirtualZPhasesData(data: dict[tuple, numpy.ndarray[typing.Any, numpy.dtype[dtype([('target', '<f8'), ('control', '<f8')])]]] = <factory>, native: str = 'CZ', thetas: list = <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

VirtualZPhases 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, numpy.ndarray[typing.Any, numpy.dtype[dtype([('target', '<f8'), ('control', '<f8')])]]]#
native: str = 'CZ'#
thetas: list#
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.virtual_z_phases.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]], native: str, 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.virtual_z_phases._acquisition(params: VirtualZPhasesParameters, platform: Platform, targets: list[Tuple[Union[str, int], Union[str, int]]]) VirtualZPhasesData[source]#

Acquisition for VirtualZPhases.

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.virtual_z_phases.fit_function(x, amplitude, offset, phase)[source]#

Sinusoidal fit function.

qibocal.protocols.two_qubit_interaction.virtual_z_phases._fit(data: VirtualZPhasesData) VirtualZPhasesResults[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.virtual_z_phases._plot(data: VirtualZPhasesData, fit: VirtualZPhasesResults, target: Tuple[Union[str, int], Union[str, int]])[source]#

Plot routine for VirtualZPhases.

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

Virtual phases correction protocol.

qibocal.protocols.two_qubit_interaction.virtual_z_phases_signal module#

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

class qibocal.protocols.two_qubit_interaction.virtual_z_phases_signal.VirtualZPhasesSignalParameters(theta_start: float, theta_end: float, theta_step: float, native: str = 'CZ', flux_pulse_amplitude: Optional[float] = None, flux_pulse_duration: Optional[float] = None, dt: Optional[float] = 20, parking: bool = True)[source]#

Bases: VirtualZPhasesParameters

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

native: str = 'CZ'#

Two qubit interaction to be calibrated.

iSWAP and CZ are the possible options.

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.virtual_z_phases_signal.VirtualZPhasesSignalResults(fitted_parameters: dict[tuple[str, Union[str, int]]], native: str, 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]], flux_pulse_amplitude: dict[Tuple[Union[str, int], Union[str, int]], float], flux_pulse_duration: dict[Tuple[Union[str, int], Union[str, int]], int])[source]#

Bases: VirtualZPhasesResults

VirtualZ 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

native: str#

Native two qubit gate.

angle: dict[QubitPairId, float]#

Native angle.

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

Virtual Z phase correction.

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

Leakage on control qubit for pair.

flux_pulse_amplitude: dict[QubitPairId, float]#

Amplitude of flux pulse implementing CZ.

flux_pulse_duration: dict[QubitPairId, int]#

Duration of flux pulse implementing CZ.

class qibocal.protocols.two_qubit_interaction.virtual_z_phases_signal.VirtualZPhasesSignalData(data: dict[tuple, numpy.ndarray[typing.Any, numpy.dtype[dtype([('target', '<f8'), ('control', '<f8')])]]] = <factory>, native: str = 'CZ', thetas: list = <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: VirtualZPhasesData

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

native: str = 'CZ'#
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[VirtualZPhasesType]]#
thetas: list#
amplitudes: dict[tuple[QubitId, QubitId], float]#
durations: dict[tuple[QubitId, QubitId], float]#
qibocal.protocols.two_qubit_interaction.virtual_z_phases_signal._acquisition(params: VirtualZPhasesSignalParameters, platform: Platform, targets: list[Tuple[Union[str, int], Union[str, int]]]) VirtualZPhasesSignalData[source]#

Acquisition for VirtualZPhases. 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.virtual_z_phases_signal._plot(data: VirtualZPhasesSignalData, fit: VirtualZPhasesSignalResults, target: Tuple[Union[str, int], Union[str, int]])[source]#

Plot routine for VirtualZPhases.

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

Virtual Z correction routine.