+
{{ report.routine_name(*task_uid) }}
diff --git a/tests/runcards/chi_squared.yml b/tests/runcards/chi_squared.yml
new file mode 100644
index 000000000..dffaf72a3
--- /dev/null
+++ b/tests/runcards/chi_squared.yml
@@ -0,0 +1,20 @@
+actions:
+ - id: t1
+ priority: 0
+ main: single shot
+ operation: t1
+ validator:
+ scheme: chi2
+ parameters:
+ chi2_max_value: 0
+ parameters:
+ delay_before_readout_start: 0
+ delay_before_readout_end: 20_000
+ delay_before_readout_step: 2000
+ nshots: 1024
+
+ - id: single shot
+ priority: 0
+ operation: single_shot_classification
+ parameters:
+ nshots: 10
diff --git a/tests/runcards/protocols.yml b/tests/runcards/protocols.yml
index 1a6be8c12..f71fd9d55 100644
--- a/tests/runcards/protocols.yml
+++ b/tests/runcards/protocols.yml
@@ -234,9 +234,9 @@ actions:
step_amp_factor: 0.1
pulse_length: 30
- - id: rabi msr
+ - id: rabi signal
priority: 0
- operation: rabi_amplitude_msr
+ operation: rabi_amplitude_signal
update: false
parameters:
min_amp_factor: 0.0
@@ -268,9 +268,9 @@ actions:
pulse_amplitude: 0.5
nshots: 1024
- - id: rabi length msr
+ - id: rabi length signal
priority: 0
- operation: rabi_length_msr
+ operation: rabi_length_signal
parameters:
pulse_duration_start: 4
pulse_duration_end: 84
@@ -297,9 +297,9 @@ actions:
delay_before_readout_step: 2000
nshots: 1024
- - id: t1_msr
+ - id: t1_signal
priority: 0
- operation: t1_msr
+ operation: t1_signal
parameters:
delay_before_readout_start: 0
delay_before_readout_end: 20_000
@@ -322,9 +322,9 @@ actions:
readouts: 10
nshots: 10
- - id: zeno_msr
+ - id: zeno_signal
priority: 00
- operation: zeno_msr
+ operation: zeno_signal
parameters:
readouts: 10
nshots: 10
@@ -338,9 +338,9 @@ actions:
delay_between_pulses_step: 100
nshots: 10
- - id: t2_msr
+ - id: t2_signal
priority: 0
- operation: t2_msr
+ operation: t2_signal
parameters:
delay_between_pulses_start: 16
delay_between_pulses_end: 20000
@@ -366,9 +366,9 @@ actions:
n_osc: 2
nshots: 10
- - id: ramsey_msr
+ - id: ramsey_signal
priority: 0
- operation: ramsey_msr
+ operation: ramsey_signal
parameters:
delay_between_pulses_start: 0
delay_between_pulses_end: 50
@@ -376,9 +376,9 @@ actions:
n_osc: 2
nshots: 10
- - id: ramsey_msr_detuned
+ - id: ramsey_signal_detuned
priority: 0
- operation: ramsey_msr
+ operation: ramsey_signal
parameters:
delay_between_pulses_start: 0
delay_between_pulses_end: 50
@@ -432,6 +432,13 @@ actions:
beta_param: null
nshots: 10
+ - id: allXY unrolling
+ priority: 0
+ operation: allxy
+ parameters:
+ beta_param: null
+ unrolling: True
+ nshots: 10
- id: allxy_drag_pulse_tuning
priority: 0
@@ -461,9 +468,9 @@ actions:
delay_between_pulses_step: 1
nshots: 10
- - id: spin_echo_msr
+ - id: spin_echo_sequence
priority: 0
- operation: spin_echo_msr
+ operation: spin_echo_sequence
parameters:
delay_between_pulses_start: 0
delay_between_pulses_end: 5
@@ -677,3 +684,14 @@ actions:
parameters:
nshots: 100
classifiers_list: ["naive_bayes", "decision_tree"]
+
+ - id: avoided crossing
+ priority: 0
+ operation: avoided_crossing
+ qubits: [[2,1],[0,2]]
+ parameters:
+ freq_width: 100_000_000
+ freq_step: 50_000_000
+ bias_width: 0.2
+ bias_step: 0.05
+ drive_amplitude: 0.5
diff --git a/tests/test_protocols.py b/tests/test_protocols.py
index 9d9155880..d94fd7f3f 100644
--- a/tests/test_protocols.py
+++ b/tests/test_protocols.py
@@ -7,6 +7,14 @@
from qibolab import create_platform
from qibocal.cli._base import command
+from qibocal.protocols.characterization.rabi.amplitude import RabiAmplitudeData
+from qibocal.protocols.characterization.rabi.ef import RabiAmplitudeEFData
+from qibocal.protocols.characterization.rabi.length import RabiLengthData
+from qibocal.protocols.characterization.rabi.utils import (
+ extract_rabi,
+ rabi_amplitude_function,
+ rabi_length_function,
+)
PATH_TO_RUNCARD = pathlib.Path(__file__).parent / "runcards/protocols.yml"
PLATFORM = create_platform("dummy")
@@ -14,6 +22,7 @@
def generate_runcard_single_protocol():
+ actions = yaml.safe_load(PATH_TO_RUNCARD.read_text(encoding="utf-8"))
with open(PATH_TO_RUNCARD) as file:
actions = yaml.safe_load(file)
for action in actions["actions"]:
@@ -118,4 +127,19 @@ def test_fit_command(runcard, tmp_path):
assert results_plot.exit_code == 0
+def test_extract_rabi():
+ assert extract_rabi(RabiAmplitudeData()) == (
+ "amp",
+ "Amplitude [dimensionless]",
+ rabi_amplitude_function,
+ )
+ assert extract_rabi(RabiLengthData()) == (
+ "length",
+ "Time [ns]",
+ rabi_length_function,
+ )
+ with pytest.raises(RuntimeError):
+ extract_rabi(RabiAmplitudeEFData)
+
+
# TODO: compare report by calling qq report
diff --git a/tests/test_update.py b/tests/test_update.py
index 591175e38..a3b7f181c 100644
--- a/tests/test_update.py
+++ b/tests/test_update.py
@@ -8,13 +8,10 @@
from qibolab.pulses import Drag
from qibocal import update
-from qibocal.protocols.characterization.utils import GHZ_TO_HZ
PLATFORM = create_platform("dummy")
QUBITS = list(PLATFORM.qubits.values())
PAIRS = list(PLATFORM.pairs)
-FREQUENCIES_GHZ = random.randint(5, 9)
-FREQUENCIES_HZ = int(FREQUENCIES_GHZ * GHZ_TO_HZ)
RANDOM_FLOAT = random.random()
RANDOM_INT = random.randint(0, 10)
@@ -25,20 +22,19 @@ def generate_update_list(length):
@pytest.mark.parametrize("qubit", QUBITS)
def test_readout_frequency_update(qubit):
- update.readout_frequency(FREQUENCIES_GHZ, PLATFORM, qubit.name)
- assert qubit.native_gates.MZ.frequency == FREQUENCIES_HZ
+ update.readout_frequency(RANDOM_INT, PLATFORM, qubit.name)
+ assert qubit.native_gates.MZ.frequency == RANDOM_INT
if qubit.native_gates.MZ.if_frequency is not None:
- assert qubit.readout_frequency == FREQUENCIES_HZ
+ assert qubit.readout_frequency == RANDOM_INT
assert (
- qubit.native_gates.MZ.if_frequency
- == FREQUENCIES_HZ - qubit.readout_frequency
+ qubit.native_gates.MZ.if_frequency == RANDOM_INT - qubit.readout_frequency
)
@pytest.mark.parametrize("qubit", QUBITS)
def test_update_bare_resonator_frequency_update(qubit):
- update.bare_resonator_frequency(FREQUENCIES_GHZ, PLATFORM, qubit.name)
- assert qubit.bare_resonator_frequency == FREQUENCIES_HZ
+ update.bare_resonator_frequency(RANDOM_INT, PLATFORM, qubit.name)
+ assert qubit.bare_resonator_frequency == RANDOM_INT
@pytest.mark.parametrize("qubit", QUBITS)
@@ -55,9 +51,9 @@ def test_readout_attenuation_update(qubit):
@pytest.mark.parametrize("qubit", QUBITS)
def test_drive_frequency_update(qubit):
- update.drive_frequency(FREQUENCIES_GHZ, PLATFORM, qubit.name)
- assert qubit.native_gates.RX.frequency == FREQUENCIES_HZ
- assert qubit.drive_frequency == FREQUENCIES_HZ
+ update.drive_frequency(RANDOM_INT, PLATFORM, qubit.name)
+ assert qubit.native_gates.RX.frequency == RANDOM_INT
+ assert qubit.drive_frequency == RANDOM_INT
@pytest.mark.parametrize("qubit", QUBITS)
@@ -151,12 +147,12 @@ def test_sweetspot_update(qubit):
@pytest.mark.parametrize("qubit", QUBITS[:-1])
def test_12_transition_update(qubit):
update.drive_12_amplitude(RANDOM_FLOAT, PLATFORM, qubit.name)
- update.frequency_12_transition(FREQUENCIES_GHZ, PLATFORM, qubit.name)
- update.anharmonicity(FREQUENCIES_GHZ, PLATFORM, qubit.name)
+ update.frequency_12_transition(RANDOM_INT, PLATFORM, qubit.name)
+ update.anharmonicity(RANDOM_INT, PLATFORM, qubit.name)
assert qubit.native_gates.RX12.amplitude == RANDOM_FLOAT
- assert qubit.native_gates.RX12.frequency == FREQUENCIES_HZ
- assert qubit.anharmonicity == FREQUENCIES_HZ
+ assert qubit.native_gates.RX12.frequency == RANDOM_INT
+ assert qubit.anharmonicity == RANDOM_INT
@pytest.mark.parametrize("qubit", QUBITS)
diff --git a/tests/test_validators.py b/tests/test_validators.py
new file mode 100644
index 000000000..e620674fe
--- /dev/null
+++ b/tests/test_validators.py
@@ -0,0 +1,33 @@
+"""Testing validators."""
+
+import pathlib
+
+import pytest
+import yaml
+from qibolab import create_platform
+
+from qibocal.auto.execute import Executor
+from qibocal.auto.runcard import Runcard
+from qibocal.cli.report import ExecutionMode
+
+RUNCARD = pathlib.Path(__file__).parent / "runcards/chi_squared.yml"
+PLATFORM = create_platform("dummy")
+
+
+@pytest.mark.parametrize("chi2_max_value", [1000, 1e-5])
+def test_chi2(chi2_max_value, tmp_path):
+ """Dummy test only for t1"""
+ card = yaml.safe_load(RUNCARD.read_text(encoding="utf-8"))
+ card["actions"][0]["validator"]["parameters"]["chi2_max_value"] = chi2_max_value
+ executor = Executor.load(
+ Runcard.load(card),
+ tmp_path,
+ PLATFORM,
+ list(PLATFORM.qubits),
+ )
+
+ list(executor.run(mode=ExecutionMode.autocalibration))
+
+ # for large chi2 value executor will execute 2 protocols
+ # only 1 with low chi2
+ assert len(executor.history.keys()) == 2 if chi2_max_value == 100 else 1