qibocal.protocols.resonator_spectroscopies package

Submodules

qibocal.protocols.resonator_spectroscopies.resonator_punchout module

qibocal.protocols.resonator_spectroscopies.resonator_punchout.resonator_punchout = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)

ResonatorPunchout Routine object.

class qibocal.protocols.resonator_spectroscopies.resonator_punchout.ResonatorPunchoutData(resonator_type: str, amplitudes: dict[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float] = <factory>, data: dict[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[dtype([('freq', '<f8'), ('amp', '<f8'), ('signal', '<f8'), ('phase', '<f8')])]]] = <factory>)[source]

Bases: Data

ResonatorPunchout data acquisition.

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

resonator_type: str

Resonator type.

amplitudes: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Amplitudes provided by the user.

data: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ndarray[tuple[Any, ...], dtype[dtype(['freq', '<f8', 'amp', '<f8', 'signal', '<f8', 'phase', '<f8'])]]]

Raw data acquired.

register_qubit(qubit, freq, amp, signal, phase)[source]

Store output for single qubit.

qibocal.protocols.resonator_spectroscopies.resonator_spectroscopy module

qibocal.protocols.resonator_spectroscopies.resonator_spectroscopy.resonator_spectroscopy = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)

ResonatorSpectroscopy Routine object.

class qibocal.protocols.resonator_spectroscopies.resonator_spectroscopy.ResonatorSpectroscopyData(resonator_type: str, amplitudes: dict[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float], fit_function: str = 'lorentzian', phase_sign: bool = False, data: dict[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[dtype([('freq', '<f8'), ('signal', '<f8'), ('phase', '<f8'), ('error_signal', '<f8'), ('error_phase', '<f8')])]]] = <factory>, power_level: ~qibocal.protocols.utils.PowerLevel | None = None)[source]

Bases: Data

Data structure for resonator spectroscopy with attenuation.

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

resonator_type: str

Resonator type.

amplitudes: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Amplitudes provided by the user.

fit_function: str = 'lorentzian'

Fit function (optional) used for the resonance.

phase_sign: bool = False

Several instruments have their convention about the sign of the phase. If True, the routine will apply a minus to the phase data.

data: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ndarray[tuple[Any, ...], dtype[dtype(['freq', '<f8', 'signal', '<f8', 'phase', '<f8', 'error_signal', '<f8', 'error_phase', '<f8'])]]]

Raw data acquired.

power_level: PowerLevel | None = None

Power regime of the resonator.

qibocal.protocols.resonator_spectroscopies.resonator_spectroscopy.ResSpecType = dtype([('freq', '<f8'), ('signal', '<f8'), ('phase', '<f8'), ('error_signal', '<f8'), ('error_phase', '<f8')])

Custom dtype for resonator spectroscopy.

qibocal.protocols.resonator_spectroscopies.resonator_utils module

qibocal.protocols.resonator_spectroscopies.resonator_utils.PHASES_THRESHOLD_PERCENTAGE = 80

pi circle.

Type:

Threshold percentage to ensure the phase data covers a significant portion of the full 2

Type:

math

qibocal.protocols.resonator_spectroscopies.resonator_utils.STD_DEV_GAUSSIAN_KERNEL = 30

Standard deviation for the Gaussian kernel.

qibocal.protocols.resonator_spectroscopies.resonator_utils.PHASE_ELEMENTS = 5

Number of values to better guess :math:` heta` (in rad) in the phase fit function.

qibocal.protocols.resonator_spectroscopies.resonator_utils.s21(frequencies: ndarray[tuple[Any, ...], dtype[_ScalarT]], resonance: float, q_loaded: float, q_coupling: float, phi: float = 0.0, amplitude: float = 1.0, alpha: float = 0.0, tau: float = 0.0) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]

Full model of the S21 notch resonator based on eq. (1) described in: “Efficient and robust analysis of complex scattering data under noise in microwave resonators” (https://doi.org/10.1063/1.4907935) by S. Probst et al and on eq. (E.1) described in: “The Physics of Superconducting Microwave Resonators” (https://doi.org/10.7907/RAT0-VM75) by J. Gao.

The equation is split into two parts describing the ideal resonator and the environment.

Parameters:
  • frequencies (NDArray[float]) – frequencies (Hz) at which the measurement was taken.

  • resonance (float) – resonance frequency (Hz).

  • q_loaded (float) – loaded quality factor.

  • q_coupling (float) – coupling quality factor.

  • phi (float) – quantifies the impedance mismatch (Fano interference).

  • amplitude (float) – accounts for additional attenuation/amplification present in the setup.

  • alpha (float) – accounts for a additional phase shift.

  • tau (float) – cable delay caused by the length of the cable and finite speed of light.

Returns:

S21 resonance profile array (NDArray) of a notch resonator.

qibocal.protocols.resonator_spectroscopies.resonator_utils.s21_fit(data: ndarray[tuple[Any, ...], dtype[_ScalarT]], resonator_type=None, fit=None) tuple[float, list[float], list[float]][source]

Calibrates the S21 profile of a notch resonator, based on https://github.com/qkitgroup/qkit.

Args:

data (NDArray[complex]): S21 scattering matrix element.

Returns:

Model parameters

qibocal.protocols.resonator_spectroscopies.resonator_utils.spectroscopy_plot(data, qubit, fit: Results = None)[source]
qibocal.protocols.resonator_spectroscopies.resonator_utils.s21_spectroscopy_plot(data, qubit, fit: Results = None)[source]
qibocal.protocols.resonator_spectroscopies.resonator_utils.cable_delay(frequencies: ndarray[tuple[Any, ...], dtype[_ScalarT]], phases: ndarray[tuple[Any, ...], dtype[_ScalarT]], num_points: int) float[source]

Evaluates the cable delay :math:` au` (in s).

The cable delay :math:` au` (in s) is caused by the length of the cable and the finite speed of light. This is estimated fitting a first-grade polynomial fit of the phases (in rad) as a function of the frequencies (in Hz), and extracting the angular coefficient, which is then expressed in seconds.

The num_points is used to select how many points should be fitted, from both the start and the end of the frequency range.

qibocal.protocols.resonator_spectroscopies.resonator_utils.remove_cable_delay(frequencies: ndarray[tuple[Any, ...], dtype[_ScalarT]], z: ndarray[tuple[Any, ...], dtype[_ScalarT]], tau: float) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]

Corrects the cable delay :math:` au` (in s).

The cable delay :math:` au` (in s) is removed from the scattering matrix element array z by performing an exponential product which also depends from the frequencies (in Hz).

qibocal.protocols.resonator_spectroscopies.resonator_utils.circle_fit(z: ndarray[tuple[Any, ...], dtype[_ScalarT]]) tuple[complex, float][source]

Fits the circle of a scattering matrix element array.

The circle fit exploits the algebraic fit described in “Efficient and robust analysis of complex scattering data under noise in microwave resonators” (https://doi.org/10.1063/1.4907935) by S. Probst et al and “The physics of superconducting microwave resonators” (https://doi.org/10.7907/RAT0-VM75) by J. Gao.

The function, from the scattering matrix element array, evaluates the center coordinates x_c and y_c and the radius of the circle r_0.

qibocal.protocols.resonator_spectroscopies.resonator_utils.phase_fit(frequencies: ndarray[tuple[Any, ...], dtype[_ScalarT]], phases: ndarray[tuple[Any, ...], dtype[_ScalarT]]) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]

Fits the phase response of a resonator.

The phase fit firstly ensure the phase data (in rad) covers a significant portion of the full 2 \(\pi\) circle evaluating a roll_off. If the data do not cover a full circle it is possible to increase the frequency span around the resonance. Data are smoothed using a Gaussian filter and the derivative is evaluated while initial guesses for the parameters (resonance_guess (in Hz)), q_loaded_guess, tau_guess (in s) and theta_guess (in rad) are computed with frequencies (in Hz).

The parameter estimation is done through an iterative least squares process to optimize the model parameters. The defined functions: residuals_q_loaded, residuals_resonance_theta residuals_resonance_theta, residuals_tau, residuals_resonance_q_loaded, residuals_full take the parameters to be fitted and return the residuals calculated by subtracting the phase centered model from the phase data (in rad).

qibocal.protocols.resonator_spectroscopies.resonator_utils.phase_dist(phases: ndarray[tuple[Any, ...], dtype[_ScalarT]]) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]

Maps phases (in rad) [-2pi, 2pi] to phase distance on circle [0, pi].

qibocal.protocols.resonator_spectroscopies.resonator_utils.phase_centered(frequencies: ndarray[tuple[Any, ...], dtype[_ScalarT]], resonance: float, q_loaded: float, theta: float, tau: float = 0.0) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]

Evaluates the phase (in rad) response of a resonator.

The phase centered evaluates the phase angle (in rad) of a circle centered around the origin accounting for a phase offset :math:` heta` (in rad), a linear background slope :math: 2pi ` au` (in s) (frequencies (in Hz) - resonance (in Hz)) (if needed) and a dependency on the q_loaded.

qibocal.protocols.resonator_spectroscopies.resonator_utils.periodic_boundary(angle: float) float[source]

Maps arbitrary angle (in rad) to interval [-np.pi, np.pi).