Skip to content

Commit 411e2f5

Browse files
authored
Merge pull request #1269 from qiboteam/qblox-circuits
Qblox fixes for running circuits
2 parents 40f3daf + f37272b commit 411e2f5

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

src/qibolab/_core/instruments/qblox/config/sequencer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ def build(
112112
if config.iq_angle is not None:
113113
cfg.thresholded_acq_rotation = np.degrees(config.iq_angle % (2 * np.pi))
114114
if config.threshold is not None:
115-
cfg.thresholded_acq_threshold = config.threshold
115+
# threshold needs to be compensated by length
116+
# see: https://docs.qblox.com/en/main/api_reference/sequencer.html#Sequencer.thresholded_acq_threshold
117+
cfg.thresholded_acq_threshold = config.threshold * length
116118
# demodulation
117119
cfg.demod_en_acq = acquisition is not AcquisitionType.RAW
118120

src/qibolab/_core/instruments/qblox/results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def _scope(data: ScopeData) -> Result:
100100

101101

102102
def _classification(data: Thresholded) -> Result:
103-
return np.array(data)
103+
return np.array(data, dtype=int)
104104

105105

106106
def extract(

src/qibolab/_core/instruments/qblox/sequence/asm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def convert(value: float, kind: Parameter) -> float:
5050
if kind is Parameter.amplitude:
5151
return value * MAX_PARAM[kind]
5252
if kind is Parameter.relative_phase:
53-
return (value / (2 * np.pi)) % 1.0 * MAX_PARAM[kind]
53+
return ((value % (2 * np.pi)) / (2 * np.pi)) % 1.0 * MAX_PARAM[kind]
5454
if kind is Parameter.frequency:
5555
return value / 500e6 * MAX_PARAM[kind]
5656
if kind is Parameter.offset:

src/qibolab/_core/instruments/qblox/sequence/experiment.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
Play,
2121
Register,
2222
SetPhDelta,
23+
UpdParam,
2324
Wait,
2425
WaitSync,
2526
)
@@ -74,6 +75,7 @@ def play(
7475

7576
if isinstance(pulse, Pulse):
7677
phase = int(convert(pulse.relative_phase, Parameter.relative_phase))
78+
minus_phase = int(convert(-pulse.relative_phase, Parameter.relative_phase))
7779
duration_sweep = {
7880
p.role: p.reg for p in params if p.role.value[1] is Parameter.duration
7981
}
@@ -84,7 +86,11 @@ def play(
8486
if len(duration_sweep) == 0
8587
else play_duration_swept(duration_sweep)
8688
)
87-
+ ([SetPhDelta(value=-phase)] if phase != 0 else [])
89+
+ (
90+
[SetPhDelta(value=minus_phase), UpdParam(duration=4)]
91+
if phase != 0
92+
else []
93+
)
8894
)
8995
if isinstance(pulse, Delay):
9096
return [
@@ -101,7 +107,8 @@ def play(
101107
value=int(pulse.phase * PHASE_FACTOR)
102108
if len(params) == 0
103109
else next(iter(params)).reg
104-
)
110+
),
111+
UpdParam(duration=4),
105112
]
106113
if isinstance(pulse, Acquisition):
107114
acq = acquisitions[pulse.id]

0 commit comments

Comments
 (0)