qibocal.protocols.twpa package¶
Submodules¶
qibocal.protocols.twpa.frequency_offset module¶
Protocol to sweep TWPA signal control parameters (frequency and offset) using sweepers.
- class qibocal.protocols.twpa.frequency_offset.TwpaFrequencyOffsetParameters(amplitude: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int], frequency: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int], probes: list[float] | None = None, probe_duration: float = 4000.0, probe_amplitude: float = 1.0)[source]¶
Bases:
Parameters- amplitude: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int]¶
Range of amplitude (offset) values for TWPA sweep.
- frequency: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int]¶
Range of TWPA frequency values for sweep.
- class qibocal.protocols.twpa.frequency_offset.TwpaFrequencyOffsetResults(frequency: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float], offset: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float], gain: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float])[source]¶
Bases:
Results- frequency: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]¶
Pump frequency [Hz].
- offset: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]¶
Pump offset [a.u.].
- gain: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]¶
TWPA gain [dB].
- class qibocal.protocols.twpa.frequency_offset.TwpaFrequencyOffsetData(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[~_ScalarT]]] = <factory>, frequency: dict[typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, offset: dict[typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, reference_value: dict[typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[list[float]]] = <factory>, probes: list[float] | None = None, power: dict[typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float] = <factory>)[source]¶
Bases:
Data- data: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ndarray[tuple[Any, ...], dtype[_ScalarT]]]¶
Raw data acquired.
- frequency: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]]¶
List with twpa frequency values swept.
- _to_npz(path: Path, filename: str)¶
Helper function to use np.savez while converting keys into strings.
- property pairs: list[~typing.Annotated[tuple[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~types.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)]]¶
Access qubit pairs from data structure.
- property qubits: list[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]]¶
Access qubits from data structure.
- register_qubit(dtype, data_keys, data_dict)¶
Store output for single qubit.
- offset: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]]¶
List with twpa offset values swept.
- reference_value: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[list[float]]]¶
Reference values with TWPA off for each probe frequency.
Reference measurements are I/Q points themselves, as the acquired data.
- probes: list[float] | None = None¶
List of probe frequencies evaluated.
Noneif native readout frequencies were used.
- power: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]¶
Configured base pump power [dB] for each target.
- reference_value_array(qubit: Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]¶
Return reference value as a numpy array.
The shape is
(nprobes, 2), withnprobesthe number of probes used, and 2 for the I/Q measurements.
- qibocal.protocols.twpa.frequency_offset._acquisition(params: TwpaFrequencyOffsetParameters, platform: CalibrationPlatform, targets: list[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]]) TwpaFrequencyOffsetData[source]¶
Acquire reference scan and 2D gain landscape, for each probe.
First perform a scan over the readout probe with the TWPA off, then sweep the TWPA amplitude (offset) and frequency concurrently using a 2D sweeper.
Note on the probe frequencies handling: The TWPA gain oscillates quite fast in the probe frequency. Instead of obtaining the best gain on average across an arbitrary continuous frequency range, we optimize specifically for the frequencies of the expected readout resonators. When params.probes is omitted (None), the protocol performs a single acquisition run where each target qubit is updated and probed exclusively at its own calibrated readout frequency. When params.probes is provided as a discrete list of frequencies, the protocol iterates over each probe frequency in software, applying it to all targets across successive runs. Because not all control electronics support sweeping an arbitrary on-board list of values, this multi-probe evaluation is implemented as a software loop. The primary speed-up is achieved through the on-board 2D hardware sweep over the TWPA pump signal parameters (amplitude and frequency).
- qibocal.protocols.twpa.frequency_offset._fit(data: TwpaFrequencyOffsetData) TwpaFrequencyOffsetResults[source]¶
Maximize measured gain.
After computing the averaged gain across evaluated probes, select the corresponding TWPA frequency and offset that maximizes the gain for each qubit.
- qibocal.protocols.twpa.frequency_offset._plot(data: TwpaFrequencyOffsetData, fit: TwpaFrequencyOffsetResults | None, target: Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])])[source]¶
Plot average gain, and report fit results - if any.
The visualization displays the averaged TWPA gain across evaluated probe frequencies as a 2D heatmap versus pump frequency (horizontal axis) and pump amplitude/offset (primary vertical axis). If fit results are available, the optimal working point is highlighted with a marker in the plot and legend.
To relate the dimensionless amplitude offset to the effective pump power in dB, a secondary vertical axis is rendered on the right edge. Its tick positions and labels are generated dynamically from the platform pump power and the logarithmic offset scaling. Because Plotly requires an associated trace to render secondary layout axes, an invisible dummy scatter trace is attached to this secondary scale.
- qibocal.protocols.twpa.frequency_offset.twpa_frequency_offset = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=None, two_qubit_gates=False)¶
Resonator TWPA Frequency and Offset Sweeper Protocol object.
- qibocal.protocols.twpa.frequency_offset.twpa_sweep = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=None, two_qubit_gates=False)¶
Alias for twpa_frequency_offset.
qibocal.protocols.twpa.twpa module¶
Protocol to calibrate TWPA power and frequency for a specific probe frequency.
- class qibocal.protocols.twpa.twpa.TwpaCalibrationParameters(freq_width: float, freq_step: float, twpa_freq_width: int, twpa_freq_step: int, twpa_pow_width: int, twpa_pow_step: int, nshots: int | None = None, relaxation_time: int | None = None)[source]¶
Bases:
ParametersTwpaCalibration runcard inputs.
- class qibocal.protocols.twpa.twpa.TwpaCalibrationResults(data: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ndarray[tuple[Any, ...], dtype[_ScalarT]]], twpa_frequency: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float], twpa_power: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float])[source]¶
Bases:
ResultsTwpaCalibration outputs.
- data: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ndarray[tuple[Any, ...], dtype[_ScalarT]]]¶
Array with average gain for each qubit.
- twpa_frequency: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]¶
TWPA frequency [GHz].
- class qibocal.protocols.twpa.twpa.TwpaCalibrationData(data: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[~numpy._typing._array_like._ScalarT]]] = <factory>, twpa_frequency: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <class 'list'>, twpa_power: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <class 'list'>, reference_value: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <class 'list'>)[source]¶
Bases:
DataTwpaCalibration data acquisition.
- _to_npz(path: Path, filename: str)¶
Helper function to use np.savez while converting keys into strings.
- property pairs: list[~typing.Annotated[tuple[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~types.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)]]¶
Access qubit pairs from data structure.
- property qubits: list[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]]¶
Access qubits from data structure.
- register_qubit(dtype, data_keys, data_dict)¶
Store output for single qubit.
- qibocal.protocols.twpa.twpa._acquisition(params: TwpaCalibrationParameters, platform: Platform, targets: list[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]]) TwpaCalibrationData[source]¶
Acquisition function for TwpaCalibration.
First perform a scan over the readout probe with the TWPA off, then we sweep the TWPA power and frequency. The gain is computed as the norm of the complex readout signal divided the norm of the complex readout signal without TWPA.
- qibocal.protocols.twpa.twpa._fit(data: TwpaCalibrationData) TwpaCalibrationResults[source]¶
Post-processing function for TwpaCalibration.
After computing the averaged gain we select the corresponding twpa frequency and power that maximizes the gain for each qubit.
- qibocal.protocols.twpa.twpa._plot(data: TwpaCalibrationData, fit: TwpaCalibrationResults, target)[source]¶
Plotting for TwpaCalibration.
- qibocal.protocols.twpa.twpa.twpa_calibration = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=None, two_qubit_gates=False)¶
Resonator TWPA Frequency Protocol object.