Skip to content

Commit

Permalink
1q recalibration runcards and scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
hay-k committed Nov 18, 2024
1 parent daf0f26 commit a379c2c
Show file tree
Hide file tree
Showing 10 changed files with 501 additions and 415 deletions.
4 changes: 4 additions & 0 deletions qw11q/calibration/BLine/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
recal_reports/*
logs/*
qubit*
slurm*.out
11 changes: 11 additions & 0 deletions qw11q/calibration/BLine/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- Make sure that you have your virtual environment setup and activated (the one that you use for running calibration experiments).
- Make sure that your `QIBOLAB_PLATFORMS` environment variable points to this copy of the `qibolab_platforms_qrc` repository.
- Change working directory to here:
```
cd qibolab_platforms_qrc/qw11q/calibration/BLine/
```
- Run the calibration script through slurm:
```
sbatch -v -J recal -p qw11q ./recal.sh
```
- On a successfull run this will generate two reports under the `./recal_reports` directory. Previous reports will be ovewritten.
59 changes: 59 additions & 0 deletions qw11q/calibration/BLine/calibrate_mixers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import warnings

from qibolab import create_platform
from qibolab.instruments.qm.controller import controllers_config


def _calibrate_readout_mixer(platform, controller, config, qubit_names):
lo_frequency = None
if_frequencies = []
for q in qubit_names:
qubit = platform.qubits[q]
element = f"readout{qubit.name}"
if lo_frequency is None:
lo_frequency = qubit.readout.lo_frequency
else:
assert lo_frequency == qubit.readout.lo_frequency, "Qubits on same probe line must have the same LO frequency."
if_frequencies.append(qubit.native_gates.MZ.frequency - lo_frequency)

qmachine = controller.manager.open_qm(config.__dict__)
qmachine.calibrate_element(element, {lo_frequency: tuple(if_frequencies)})
qmachine.close()


def _calibrate_drive_mixers(platform, controller, config, qubit_names):
for q in qubit_names:
qubit = platform.qubits[q]
element = f"drive{qubit.name}"
lo_frequency = qubit.drive.lo_frequency
if_frequency = qubit.native_gates.RX.frequency - lo_frequency

qmachine = controller.manager.open_qm(config.__dict__)
qmachine.calibrate_element(element, {lo_frequency: (if_frequency,)})
qmachine.close()


def _run_until_success(fn, *args, label):
while True:
try:
fn(*args)
print(f"Mixer calibration for {label} finished successfully")
break
except RuntimeWarning as w:
print(f"Issue encountered while running mixer calibration for {label} mixer. Retrying...")


if __name__ == "__main__":
warnings.filterwarnings("error", category=RuntimeWarning, message="invalid value")

platform = create_platform("qw11q")
controller = platform.instruments["qm"]
controller.write_calibration = True
controller.connect()

config = controllers_config(list(platform.qubits.values()), controller.time_of_flight, controller.smearing)

_run_until_success(_calibrate_readout_mixer, platform, controller, config, ["B1", "B2", "B3", "B4", "B5"], label="readout")
_run_until_success(_calibrate_drive_mixers, platform, controller, config, ["B1", "B2", "B3", "B4", "B5"], label="drive")

controller.disconnect()
15 changes: 15 additions & 0 deletions qw11q/calibration/BLine/recal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

if [ -d recal_reports ]; then
re -r recal_reports
fi

mkdir recal_reports

qq run ./runcard_frequencies.yml -o ./recal_reports/recal_frequencies -f
qq update ./recal_reports/recal_frequencies

python calibrate_mixers.py

qq run ./runcard_1q_gates.yml -o ./recal_reports/recal_1q_gates -f
qq update ./recal_reports/recal_1q_gates
158 changes: 158 additions & 0 deletions qw11q/calibration/BLine/runcard_1q_benchmark_sequential.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
platform: qw11q

actions:

- id: t1 B1
operation: t1
parameters:
delay_before_readout_end: 100_000
delay_before_readout_start: 20
delay_before_readout_step: 1_000
nshots: 512
relaxation_time: 100_000
targets: [B1]

- id: t1 B2
operation: t1
parameters:
delay_before_readout_end: 100_000
delay_before_readout_start: 20
delay_before_readout_step: 1_000
nshots: 512
relaxation_time: 100_000
targets: [B2]

- id: t1 B3
operation: t1
parameters:
delay_before_readout_end: 100_000
delay_before_readout_start: 20
delay_before_readout_step: 1_000
nshots: 512
relaxation_time: 100_000
targets: [B3]

- id: t1 B4
operation: t1
parameters:
delay_before_readout_end: 100_000
delay_before_readout_start: 20
delay_before_readout_step: 1_000
nshots: 512
relaxation_time: 100_000
targets: [B4]

- id: t1 B5
operation: t1
parameters:
delay_before_readout_end: 100_000
delay_before_readout_start: 20
delay_before_readout_step: 1_000
nshots: 512
relaxation_time: 100_000
targets: [B5]

- id: ramsey detuned B1
operation: ramsey
parameters:
delay_between_pulses_end: 3_000
delay_between_pulses_start: 8
delay_between_pulses_step: 20
detuning: 2_000_000
nshots: 512
relaxation_time: 100_000
targets: [B1]
update: true

- id: ramsey detuned B2
operation: ramsey
parameters:
delay_between_pulses_end: 3_000
delay_between_pulses_start: 8
delay_between_pulses_step: 20
detuning: 2_000_000
nshots: 512
relaxation_time: 100_000
targets: [B2]
update: true

- id: ramsey detuned B3
operation: ramsey
parameters:
delay_between_pulses_end: 3_000
delay_between_pulses_start: 8
delay_between_pulses_step: 20
detuning: 2_000_000
nshots: 512
relaxation_time: 100_000
targets: [B3]
update: true

- id: ramsey detuned B4
operation: ramsey
parameters:
delay_between_pulses_end: 3_000
delay_between_pulses_start: 8
delay_between_pulses_step: 20
detuning: 2_000_000
nshots: 512
relaxation_time: 100_000
targets: [B4]
update: true

- id: ramsey detuned B5
operation: ramsey
parameters:
delay_between_pulses_end: 3_000
delay_between_pulses_start: 8
delay_between_pulses_step: 20
detuning: 2_000_000
nshots: 512
relaxation_time: 100_000
targets: [B5]
update: true

- id: t2 B1
operation: t2
parameters:
delay_between_pulses_start: 20
delay_between_pulses_end: 40_000
delay_between_pulses_step: 400
nshots: 512
targets: [B1]

- id: t2 B2
operation: t2
parameters:
delay_between_pulses_start: 20
delay_between_pulses_end: 40_000
delay_between_pulses_step: 400
nshots: 512
targets: [B2]

- id: t2 B3
operation: t2
parameters:
delay_between_pulses_start: 20
delay_between_pulses_end: 40_000
delay_between_pulses_step: 400
nshots: 512
targets: [B3]

- id: t2 B4
operation: t2
parameters:
delay_between_pulses_start: 20
delay_between_pulses_end: 40_000
delay_between_pulses_step: 400
nshots: 512
targets: [B4]

- id: t2 B5
operation: t2
parameters:
delay_between_pulses_start: 20
delay_between_pulses_end: 40_000
delay_between_pulses_step: 400
nshots: 512
targets: [B5]
38 changes: 38 additions & 0 deletions qw11q/calibration/BLine/runcard_1q_benchmark_simultaneous.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
platform: qw11q

targets: [B1,B2,B3,B4,B5]

actions:

# - id: allXY
# operation: allxy
# parameters:
# beta_param: null
# nshots: 1024

# - id: standard rb
# operation: standard_rb
# parameters:
# depths: [1, 5, 10, 20, 40, 80, 160, 320]
# niter: 5
# nshots: 1024
# seed: 420
# relaxation_time: 100_000
# unrolling: false

- id: t1
operation: t1
parameters:
delay_before_readout_end: 100_000
delay_before_readout_start: 20
delay_before_readout_step: 1_000
nshots: 1024
relaxation_time: 100_000

- id: t2
operation: t2
parameters:
delay_between_pulses_start: 20
delay_between_pulses_end: 40_000
delay_between_pulses_step: 400
nshots: 1024
47 changes: 47 additions & 0 deletions qw11q/calibration/BLine/runcard_1q_gates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
platform: qw11q

targets: [B1,B2,B3,B4,B5]

actions:

- id: flipping B1
operation: flipping
parameters:
delta_amplitude: 0.0015
nflips_max: 50
nflips_step: 1
nshots: 256
relaxation_time: 100_000
unrolling: true
targets: [B1]
update: true

- id: flipping B2 B3 B4 B5
operation: flipping
parameters:
delta_amplitude: 0.004
nflips_max: 50
nflips_step: 1
nshots: 256
relaxation_time: 100_000
unrolling: true
targets: [B2, B3, B4, B5]
update: true

- id: DRAG
operation: drag_tuning
parameters:
beta_start: -1.0
beta_end: 1.0
beta_step: 0.01
nshots: 512
relaxation_time: 100_000
unrolling: true
update: true

- id: single shot classification
operation: single_shot_classification
parameters:
nshots: 10_000
relaxation_time: 100_000
update: true
Loading

0 comments on commit a379c2c

Please sign in to comment.