Skip to content

Commit

Permalink
fix: Start designing sweepers implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed Dec 11, 2024
1 parent 6297935 commit 82ec248
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions src/qibolab/_core/instruments/qblox/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from qibolab._core.execution_parameters import AveragingMode, ExecutionParameters
from qibolab._core.pulses.pulse import Delay, Pulse, PulseLike, VirtualZ
from qibolab._core.sequence import PulseSequence
from qibolab._core.sweeper import ParallelSweepers
from qibolab._core.sweeper import ParallelSweepers, Parameter

from .ast_ import (
Instruction,
Expand All @@ -15,6 +15,10 @@
Program,
Reference,
Register,
SetAwgGain,
SetAwgOffs,
SetFreq,
SetPhDelta,
Stop,
Wait,
WaitSync,
Expand Down Expand Up @@ -49,6 +53,27 @@ def execution(
]


SWEEPERS = {
Parameter.frequency: lambda v, o: ([SetFreq(value=v)], [SetFreq(value=o)]),
Parameter.amplitude: lambda v, o: (
[SetAwgGain(value_0=v, value_1=v)],
[SetAwgGain(value_0=o, value_1=o)],
),
Parameter.relative_phase: lambda v, o: (
[SetPhDelta(value=v)],
[SetPhDelta(value=-v)],
),
Parameter.offset: lambda v, o: (
[SetAwgOffs(value_0=v, value_1=v)],
[SetAwgOffs(value_0=o, value_1=o)],
),
}


def parameters_update(sweepers: ParallelSweepers) -> list[Instruction]:
return [Nop()]


def loop(
sweepers: list, experiment: list[Line], relaxation_time: int, outer_shots: bool
):
Expand Down Expand Up @@ -103,11 +128,15 @@ def play(
)
]
if isinstance(pulse, Pulse)
else [Line.instr(Wait(duration=int(pulse.duration * sampling_rate)))]
if isinstance(pulse, Delay)
else [Line.instr(SetPhDelta(value=int(pulse.phase * PHASE_FACTOR)))]
if isinstance(pulse, VirtualZ)
else []
else (
[Line.instr(Wait(duration=int(pulse.duration * sampling_rate)))]
if isinstance(pulse, Delay)
else (
[Line.instr(SetPhDelta(value=int(pulse.phase * PHASE_FACTOR)))]
if isinstance(pulse, VirtualZ)
else []
)
)
)


Expand Down

0 comments on commit 82ec248

Please sign in to comment.