diff --git a/src/qibolab/sequence.py b/src/qibolab/sequence.py index b72dd6a74..fd9f89e2c 100644 --- a/src/qibolab/sequence.py +++ b/src/qibolab/sequence.py @@ -82,11 +82,11 @@ def channel(self, channel: ChannelId) -> Iterable[PulseLike]: def channel_duration(self, channel: ChannelId) -> float: """Duration of the given channel.""" - sequence = self - for _, pulse in self: - if isinstance(pulse, Align): - sequence = self.align_to_delays() - break + sequence = ( + self.align_to_delays() + if any(isinstance(pulse, Align) for _, pulse in self) + else self + ) return sum(pulse.duration for pulse in sequence.channel(channel)) def pulse_channels(self, pulse_id: int) -> list[ChannelId]: