Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequence unrolling in allXY #629

Merged
merged 6 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
stavros11 marked this conversation as resolved.
Show resolved Hide resolved
priority: 0
operation: allxy
parameters:
beta_param: null
unrolling: True
nshots: 10

- id: allxy_drag_pulse_tuning
priority: 0
Expand Down