Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 9, 2024
1 parent f09f5a4 commit 2c89ae1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/qibolab/pulses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1584,11 +1584,12 @@ def get_pulse_overlaps(self): # -> dict((int,int): PulseSequence):
return overlaps

def separate_overlapping_pulses(self): # -> dict((int,int): PulseSequence):
"""Separates a sequence of overlapping pulses into a list of non-overlapping sequences."""
"""Separates a sequence of overlapping pulses into a list of non-
overlapping sequences."""

# This routine separates the pulses of a sequence into sets of different frequecy, non-overlapping
# This routine separates the pulses of a sequence into sets of different frequecy, non-overlapping
# pulses

freqs = set()
for pulse in self.pulses:
freqs |= {pulse.frequency}
Expand All @@ -1607,7 +1608,10 @@ def separate_overlapping_pulses(self): # -> dict((int,int): PulseSequence):
for ps in separated_pulses[freq]:
overlaps = False
for existing_pulse in ps:
if new_pulse.start < existing_pulse.finish and new_pulse.finish > existing_pulse.start:
if (
new_pulse.start < existing_pulse.finish
and new_pulse.finish > existing_pulse.start
):
overlaps = True
break
if not overlaps:
Expand All @@ -1616,7 +1620,7 @@ def separate_overlapping_pulses(self): # -> dict((int,int): PulseSequence):
break
if not stored:
separated_pulses[freq].append(PulseSequence(new_pulse))
print('---------------------')
print("---------------------")
print(separated_pulses)
return [ps for freq in freqs for ps in separated_pulses[freq]]

Expand Down

0 comments on commit 2c89ae1

Please sign in to comment.