Skip to content

Commit

Permalink
feat: Extract configurations values from parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed Jan 23, 2025
1 parent 3f83451 commit e6571fd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
19 changes: 14 additions & 5 deletions src/qibolab/_core/instruments/qblox/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from qblox_instruments.qcodes_drivers.module import Module
from qcodes.instrument import find_or_create_instrument

from qibolab._core.components.configs import Config
from qibolab._core.components.configs import Configs
from qibolab._core.execution_parameters import AcquisitionType, ExecutionParameters
from qibolab._core.identifier import ChannelId, Result
from qibolab._core.instruments.abstract import Controller
Expand Down Expand Up @@ -88,7 +88,7 @@ def disconnect(self):

def play(
self,
configs: dict[str, Config],
configs: Configs,
sequences: list[PulseSequence],
options: ExecutionParameters,
sweepers: list[ParallelSweepers],
Expand All @@ -99,15 +99,18 @@ def play(
for ps in sequences:
sequences_ = compile(ps, sweepers, options, self.sampling_rate)
log.sequences(sequences_)
sequencers = self._configure(sequences_, options.acquisition_type)
sequencers = self._configure(sequences_, configs, options.acquisition_type)
log.status(self.cluster, sequencers)
data = self._execute(sequencers, options.estimate_duration([ps], sweepers))
log.data(data)
results |= _extract(data)
return results

def _configure(
self, sequences: dict[ChannelId, Sequence], acquisition: AcquisitionType
self,
sequences: dict[ChannelId, Sequence],
configs: Configs,
acquisition: AcquisitionType,
) -> SeqeuencerMap:
sequencers = defaultdict(dict)
for slot, chs in self._channels_by_module.items():
Expand All @@ -119,7 +122,13 @@ def _configure(
):
sequencers[slot][ch] = idx
config.sequencer(
sequencer, address, sequences.get(ch, Sequence.empty()), acquisition
sequencer,
address,
sequences.get(ch, Sequence.empty()),
ch,
self.channels,
configs,
acquisition,
)

return sequencers
Expand Down
15 changes: 11 additions & 4 deletions src/qibolab/_core/instruments/qblox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from qblox_instruments.qcodes_drivers.module import Module
from qblox_instruments.qcodes_drivers.sequencer import Sequencer

from qibolab._core.components.channels import Channel
from qibolab._core.components.configs import AcquisitionConfig, Configs, DcConfig
from qibolab._core.execution_parameters import AcquisitionType
from qibolab._core.identifier import ChannelId
from qibolab._core.serialize import Model
Expand Down Expand Up @@ -76,6 +78,9 @@ def sequencer(
seq: Sequencer,
address: PortAddress,
sequence: Sequence,
channel: ChannelId,
channels: dict[ChannelId, Channel],
configs: Configs,
acquisition: AcquisitionType,
):
# upload sequence
Expand All @@ -85,20 +90,22 @@ def sequencer(
# configure the sequencers to synchronize
seq.sync_en(True)

config = configs[channel]

# set parameters
# TODO: read values from configs
# offsets
seq.offset_awg_path0(0.0)
seq.offset_awg_path0(config.offset if isinstance(config, DcConfig) else 0.0)
seq.offset_awg_path1(0.0)
# modulation, only disable for QCM - always used for flux pulses
mod = cast(Module, seq.ancestors[1])
seq.mod_en_awg(mod.is_qrm_type or mod.is_rf_type)
# acquisition
if address.input:
assert isinstance(config, AcquisitionConfig)
seq.integration_length_acq(1000)
# discrimination
seq.thresholded_acq_rotation(0.0)
seq.thresholded_acq_threshold(0.0)
seq.thresholded_acq_rotation(config.iq_angle)
seq.thresholded_acq_threshold(config.threshold)
# demodulation
seq.demod_en_acq(acquisition is not AcquisitionType.RAW)

Expand Down

0 comments on commit e6571fd

Please sign in to comment.