Skip to content

Commit

Permalink
feat: Set LO frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed Jan 23, 2025
1 parent f3a8e4d commit f3e82dc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/qibolab/_core/instruments/qblox/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _configure(
for slot, chs in self._channels_by_module.items():
module = self._modules[slot]
assert len(module.sequencers) >= len(chs)
config.module(module)
config.module(module, dict(chs), self.channels, configs)
for idx, ((ch, address), sequencer) in enumerate(
zip(chs, module.sequencers)
):
Expand Down
43 changes: 30 additions & 13 deletions src/qibolab/_core/instruments/qblox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,24 @@ def local_address(self):
return f"{direction}{channels}"


def module(mod: Module):
def _probe(id_: ChannelId, channel: Channel) -> Optional[ChannelId]:
return (
id_
if isinstance(channel, IqChannel)
else (
channel.probe
if isinstance(channel, AcquisitionChannel) and channel.probe is not None
else None
)
)


def module(
mod: Module,
mod_channels: dict[ChannelId, PortAddress],
channels: dict[ChannelId, Channel],
configs: Configs,
):
# map sequencers to specific outputs (but first disable all sequencer connections)
mod.disconnect_outputs()

Expand All @@ -79,17 +96,17 @@ def module(mod: Module):
mod.scope_acq_trigger_mode_path0("sequencer")
mod.scope_acq_trigger_mode_path1("sequencer")


def _self_or_probe(channel: ChannelId) -> Optional[ChannelId]:
return (
channel
if isinstance(channel, IqConfig)
else (
channel.probe
if isinstance(channel, AcquisitionChannel) and channel.probe is not None
else None
)
)
# set lo frequencies
los = {
(probe, cast(IqChannel, channels[probe]).lo)
for probe in (_probe(ch, channels[ch]) for ch in mod_channels)
if probe is not None
}
for probe, lo in los:
if lo is None:
continue
n = mod_channels[probe].ports[0] # TODO: check it is the correct path
getattr(mod, f"out{n}_lo_freq")(cast(OscillatorConfig, configs[lo]).frequency)


def sequencer(
Expand Down Expand Up @@ -127,7 +144,7 @@ def sequencer(
# demodulation
seq.demod_en_acq(acquisition is not AcquisitionType.RAW)

probe = _self_or_probe(channel_id)
probe = _probe(channel_id, channels[channel_id])
if probe is not None:
freq = cast(IqConfig, configs[probe]).frequency
lo = cast(IqChannel, channels[probe]).lo
Expand Down

0 comments on commit f3e82dc

Please sign in to comment.