Skip to content

Commit

Permalink
Merge pull request #629 from qiboteam/allXYunrolling
Browse files Browse the repository at this point in the history
Sequence unrolling in allXY
  • Loading branch information
stavros11 authored Dec 11, 2023
2 parents 1fe5cf0 + 42987a4 commit 5f287ce
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 21 deletions.
36 changes: 34 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ classifiers = [

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
qibolab = "^0.1.2"
qibolab = "^0.1.4"
qibo = "^0.2.1"
numpy = "^1.24.0"
scipy = "^1.10.1"
Expand Down
46 changes: 28 additions & 18 deletions src/qibocal/protocols/characterization/allxy/allxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class AllXYParameters(Parameters):

beta_param: float = None
"""Beta parameter for drag pulse."""
unrolling: bool = False
"""If ``True`` it uses sequence unrolling to deploy multiple sequences in a single instrument call.
Defaults to ``False``."""


@dataclass
Expand Down Expand Up @@ -80,31 +83,38 @@ def _acquisition(

# repeat the experiment as many times as defined by software_averages
# for iteration in range(params.software_averages):
sequences, all_ro_pulses = [], []
for gates in gatelist:
# create a sequence of pulses
ro_pulses = {}
sequence = PulseSequence()
sequences.append(PulseSequence())
all_ro_pulses.append({})
for qubit in qubits:
sequence, ro_pulses[qubit] = add_gate_pair_pulses_to_sequence(
platform, gates, qubit, sequence, params.beta_param
sequences[-1], all_ro_pulses[-1][qubit] = add_gate_pair_pulses_to_sequence(
platform, gates, qubit, sequences[-1], params.beta_param
)
# execute the pulse sequence
results = platform.execute_pulse_sequence(
sequence,
ExecutionParameters(
nshots=params.nshots,
averaging_mode=AveragingMode.CYCLIC,
),
)

# retrieve the results for every qubit

# execute the pulse sequence
options = ExecutionParameters(
nshots=params.nshots, averaging_mode=AveragingMode.CYCLIC
)
if params.unrolling:
results = platform.execute_pulse_sequences(sequences, options)
else:
results = [
platform.execute_pulse_sequence(sequence, options) for sequence in sequences
]

for ig, (gates, ro_pulses) in enumerate(zip(gatelist, all_ro_pulses)):
gate = "-".join(gates)
for qubit in qubits:
z_proj = 2 * results[ro_pulses[qubit].serial].probability(0) - 1
# store the results
gate = "-".join(gates)
serial = ro_pulses[qubit].serial
if params.unrolling:
z_proj = 2 * results[serial][ig].probability(0) - 1
else:
z_proj = 2 * results[ig][serial].probability(0) - 1
data.register_qubit(
AllXYType, (qubit), dict(prob=np.array([z_proj]), gate=np.array([gate]))
)

# finally, save the remaining data
return data

Expand Down
7 changes: 7 additions & 0 deletions tests/runcards/protocols.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f287ce

Please sign in to comment.