Skip to content

Commit

Permalink
Merge branch 'remove_flux_amplitude' into flux_fit
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-pasquale committed May 16, 2024
2 parents 6a26b7e + b27799d commit 5f06538
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 453 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from qibocal.auto.operation import Routine

from ..flux_dependence import resonator_flux_dependence
from ..two_qubit_interaction.utils import order_pair
from .coupler_resonator_spectroscopy import _fit, _plot, _update
from .utils import CouplerSpectroscopyData, CouplerSpectroscopyParameters
Expand Down Expand Up @@ -83,31 +82,20 @@ def _acquisition(
type=SweeperType.OFFSET,
)

if params.flux_pulses:
(
delta_bias_flux_range,
sweepers,
sequences,
) = resonator_flux_dependence.create_flux_pulse_sweepers(
params, platform, couplers, sequence
)
sequence = sequences[0]
else:
delta_bias_flux_range = np.arange(
-params.bias_width / 2, params.bias_width / 2, params.bias_step
delta_bias_range = np.arange(
-params.bias_width / 2, params.bias_width / 2, params.bias_step
)
sweepers = [
Sweeper(
Parameter.bias,
delta_bias_range,
qubits=couplers,
type=SweeperType.OFFSET,
)
sweepers = [
Sweeper(
Parameter.bias,
delta_bias_flux_range,
qubits=couplers,
type=SweeperType.OFFSET,
)
]
]

data = CouplerSpectroscopyData(
resonator_type=platform.resonator_type,
flux_pulses=params.flux_pulses,
offset=offset,
)

Expand Down Expand Up @@ -135,7 +123,7 @@ def _acquisition(
signal=result.magnitude,
phase=result.phase,
freq=delta_frequency_range + qd_pulses[qubit].frequency,
bias=delta_bias_flux_range,
bias=delta_bias_range,
)
return data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from qibocal.auto.operation import Routine

from ..flux_dependence import resonator_flux_dependence
from ..flux_dependence.utils import flux_dependence_plot
from ..two_qubit_interaction.utils import order_pair
from .utils import (
Expand Down Expand Up @@ -72,30 +71,20 @@ def _acquisition(
type=SweeperType.OFFSET,
)

if params.flux_pulses:
# TODO: Add delay
(delta_bias_flux_range, sweepers, sequences) = (
resonator_flux_dependence.create_flux_pulse_sweepers(
params, platform, couplers, sequence
)
)
sequence = sequences[0]
else:
delta_bias_flux_range = np.arange(
-params.bias_width / 2, params.bias_width / 2, params.bias_step
delta_bias_range = np.arange(
-params.bias_width / 2, params.bias_width / 2, params.bias_step
)
sweepers = [
Sweeper(
Parameter.bias,
delta_bias_range,
qubits=couplers,
type=SweeperType.OFFSET,
)
sweepers = [
Sweeper(
Parameter.bias,
delta_bias_flux_range,
qubits=couplers,
type=SweeperType.OFFSET,
)
]
]

data = CouplerSpectroscopyData(
resonator_type=platform.resonator_type,
flux_pulses=params.flux_pulses,
offset=offset,
)

Expand Down Expand Up @@ -123,7 +112,7 @@ def _acquisition(
signal=result.magnitude,
phase=result.phase,
freq=delta_frequency_range + ro_pulses[qubit].frequency,
bias=delta_bias_flux_range,
bias=delta_bias_range,
)
return data

Expand Down
2 changes: 0 additions & 2 deletions src/qibocal/protocols/characterization/couplers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ class CouplerSpectroscopyData(Data):

resonator_type: str
"""Resonator type."""
flux_pulses: bool
"""True if sweeping flux pulses, False if sweeping bias."""
offset: dict[QubitId, float] = field(default_factory=dict)
"""Qubit bias offset."""
data: dict[QubitId, npt.NDArray[CouplerSpecType]] = field(default_factory=dict)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
QubitFluxType,
)
from .qubit_flux_dependence import _fit as diagonal_fit
from .resonator_flux_dependence import create_flux_pulse_sweepers


@dataclass
Expand Down Expand Up @@ -73,7 +72,6 @@ def register_qubit(self, qubit, flux_qubit, freq, bias, signal, phase):
def diagonal(self) -> Optional[QubitFluxData]:
instance = QubitFluxData(
resonator_type=self.resonator_type,
flux_pulses=self.flux_pulses,
qubit_frequency=self.qubit_frequency,
)
for qubit in self.qubits:
Expand All @@ -88,7 +86,6 @@ def diagonal(self) -> Optional[QubitFluxData]:
return instance
return QubitFluxData(
resonator_type=self.resonator_type,
flux_pulses=self.flux_pulses,
qubit_frequency=self.qubit_frequency,
)

Expand Down Expand Up @@ -167,32 +164,28 @@ def _acquisition(
flux_qubits = list(platform.qubits)
else:
flux_qubits = params.flux_qubits
if params.flux_pulses:
delta_bias_flux_range, sweepers, sequences = create_flux_pulse_sweepers(
params, platform, flux_qubits, sequence, crosstalk=True
)
else:
delta_bias_flux_range = np.arange(
-params.bias_width / 2, params.bias_width / 2, params.bias_step

delta_bias_range = np.arange(
-params.bias_width / 2, params.bias_width / 2, params.bias_step
)
sequences = [sequence] * len(flux_qubits)
sweepers = [
Sweeper(
Parameter.bias,
delta_bias_range,
qubits=[platform.qubits[flux_qubit]],
type=SweeperType.OFFSET,
)
sequences = [sequence] * len(flux_qubits)
sweepers = [
Sweeper(
Parameter.bias,
delta_bias_flux_range,
qubits=[platform.qubits[flux_qubit]],
type=SweeperType.OFFSET,
)
for flux_qubit in flux_qubits
]
for flux_qubit in flux_qubits
]

data = QubitCrosstalkData(
resonator_type=platform.resonator_type,
sweetspot=sweetspots,
voltage=voltage,
matrix_element=matrix_element,
d=d,
qubit_frequency=qubit_frequency,
flux_pulses=params.flux_pulses,
)

options = ExecutionParameters(
Expand All @@ -216,7 +209,7 @@ def _acquisition(
signal=result.magnitude,
phase=result.phase,
freq=delta_frequency_range + qd_pulses[qubit].frequency,
bias=delta_bias_flux_range + sweetspot,
bias=delta_bias_range + sweetspot,
)

return data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)

from ..utils import GHZ_TO_HZ, HZ_TO_GHZ, extract_feature, table_dict, table_html
from . import resonator_flux_dependence, utils
from . import utils
from .resonator_flux_dependence import ResonatorFluxParameters


Expand Down Expand Up @@ -67,9 +67,6 @@ class QubitFluxData(Data):
resonator_type: str
"""Resonator type."""

flux_pulses: bool
"""True if sweeping flux pulses, False if sweeping bias."""

qubit_frequency: dict[QubitId, float] = field(default_factory=dict)
"""Qubit frequencies."""

Expand Down Expand Up @@ -134,32 +131,24 @@ def _acquisition(
pulses=[qd_pulses[qubit] for qubit in targets],
type=SweeperType.OFFSET,
)
if params.flux_pulses:
(delta_bias_flux_range, sweepers, sequences) = (
resonator_flux_dependence.create_flux_pulse_sweepers(
params, platform, targets, sequence
)
)
sequence = sequences[0]
else:
delta_bias_flux_range = np.arange(
-params.bias_width, params.bias_width, params.bias_step

delta_bias_range = np.arange(
-params.bias_width / 2, params.bias_width / 2, params.bias_step
)
sweepers = [
Sweeper(
Parameter.bias,
delta_bias_range,
qubits=[platform.qubits[qubit] for qubit in targets],
type=SweeperType.OFFSET,
)
sweepers = [
Sweeper(
Parameter.bias,
delta_bias_flux_range,
qubits=[platform.qubits[qubit] for qubit in targets],
type=SweeperType.OFFSET,
)
]
]

data = QubitFluxData(
resonator_type=platform.resonator_type,
charging_energy={
qubit: -platform.qubits[qubit].anharmonicity for qubit in targets
},
flux_pulses=params.flux_pulses,
qubit_frequency=qubit_frequency,
offset=offset,
)
options = ExecutionParameters(
Expand All @@ -179,7 +168,7 @@ def _acquisition(
signal=result.magnitude,
phase=result.phase,
freq=delta_frequency_range + qd_pulses[qubit].frequency,
bias=delta_bias_flux_range + sweetspot,
bias=delta_bias_range + sweetspot,
)
return data

Expand Down Expand Up @@ -266,16 +255,12 @@ def _plot(data: QubitFluxData, fit: QubitFluxResults, target: QubitId):
target,
fit_function=utils.transmon_frequency,
)
if data.flux_pulses:
bias_flux_unit = "a.u."
else:
bias_flux_unit = "V"
if fit is not None:
fitting_report = table_html(
table_dict(
target,
[
f"Sweetspot [{bias_flux_unit}]",
f"Sweetspot [V]",
"Qubit Frequency at Sweetspot [Hz]",
"Flux dependence",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def _acquisition(

data = QubitFluxTrackData(
resonator_type=platform.resonator_type,
flux_pulses=params.flux_pulses,
qubit_frequency=qubit_frequency,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
ResonatorFluxResults,
)
from .resonator_flux_dependence import _fit as diagonal_fit
from .resonator_flux_dependence import create_flux_pulse_sweepers


@dataclass
Expand Down Expand Up @@ -87,7 +86,6 @@ def register_qubit(self, qubit, flux_qubit, freq, bias, signal, phase):
def diagonal(self) -> Optional[ResonatorFluxData]:
instance = ResonatorFluxData(
resonator_type=self.resonator_type,
flux_pulses=self.flux_pulses,
qubit_frequency=self.qubit_frequency,
bare_resonator_frequency=self.bare_resonator_frequency,
)
Expand All @@ -103,7 +101,6 @@ def diagonal(self) -> Optional[ResonatorFluxData]:
return instance
return ResonatorFluxData(
resonator_type=self.resonator_type,
flux_pulses=self.flux_pulses,
qubit_frequency=self.qubit_frequency,
)

Expand Down Expand Up @@ -160,28 +157,23 @@ def _acquisition(

else:
flux_qubits = params.flux_qubits
if params.flux_pulses:
delta_bias_flux_range, sweepers, sequences = create_flux_pulse_sweepers(
params, platform, flux_qubits, sequence, crosstalk=True
)
else:
delta_bias_flux_range = np.arange(
-params.bias_width / 2, params.bias_width / 2, params.bias_step

delta_bias_range = np.arange(
-params.bias_width / 2, params.bias_width / 2, params.bias_step
)
sequences = [sequence] * len(flux_qubits)
sweepers = [
Sweeper(
Parameter.bias,
delta_bias_range,
qubits=[platform.qubits[flux_qubit]],
type=SweeperType.OFFSET,
)
sequences = [sequence] * len(flux_qubits)
sweepers = [
Sweeper(
Parameter.bias,
delta_bias_flux_range,
qubits=[platform.qubits[flux_qubit]],
type=SweeperType.OFFSET,
)
for flux_qubit in flux_qubits
]
for flux_qubit in flux_qubits
]

data = ResCrosstalkData(
resonator_type=platform.resonator_type,
flux_pulses=params.flux_pulses,
qubit_frequency=qubit_frequency,
resonator_frequency=resonator_frequency,
sweetspot=sweetspots,
Expand Down Expand Up @@ -212,7 +204,7 @@ def _acquisition(
signal=result.magnitude,
phase=result.phase,
freq=delta_frequency_range + ro_pulses[qubit].frequency,
bias=delta_bias_flux_range + sweetspot,
bias=delta_bias_range + sweetspot,
)
return data

Expand Down
Loading

0 comments on commit 5f06538

Please sign in to comment.