Skip to content

Commit

Permalink
fix: Fix event registered
Browse files Browse the repository at this point in the history
Make type check useful, to catch this error later on
  • Loading branch information
alecandido committed Aug 30, 2024
1 parent 92b8638 commit bce178a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/qibolab/instruments/qm/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from dataclasses import asdict, dataclass
from os import PathLike
from pathlib import Path
from typing import Optional
from typing import Optional, Union

from pydantic import Field
from qm import QuantumMachinesManager, SimulationConfig, generate_qua_script
Expand Down Expand Up @@ -284,16 +284,19 @@ def configure_channels(self, configs: dict[str, Config], channels: set[ChannelId
for id in channels:
self.configure_channel(id, configs)

def register_pulse(self, channel: ChannelId, pulse: Pulse) -> str:
def register_pulse(self, channel: ChannelId, pulse: Union[Pulse, Readout]) -> str:
"""Add pulse in the QM ``config``.
And return corresponding operation.
"""
ch = self.channels[channel]
if isinstance(ch, DcChannel):
assert isinstance(pulse, Pulse)
return self.config.register_dc_pulse(channel, pulse)
if isinstance(ch, IqChannel):
assert isinstance(pulse, Pulse)
return self.config.register_iq_pulse(channel, pulse)
assert isinstance(pulse, Readout)
return self.config.register_acquisition_pulse(channel, pulse)

def register_pulses(self, configs: dict[str, Config], sequence: PulseSequence):
Expand All @@ -313,7 +316,7 @@ def register_pulses(self, configs: dict[str, Config], sequence: PulseSequence):
if isinstance(pulse, Pulse):
self.register_pulse(id, pulse)
elif isinstance(pulse, Readout):
self.register_pulse(id, pulse.probe)
self.register_pulse(id, pulse)

def register_duration_sweeper_pulses(
self, args: ExecutionArguments, sweeper: Sweeper
Expand Down

0 comments on commit bce178a

Please sign in to comment.