Skip to content

Commit

Permalink
Deal with composite pulses
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Ristè committed Mar 27, 2018
1 parent 4fa630f commit e12c86c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions QGL/PulseSequencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,8 @@ def align_p(mode="center", *pulses):
# Align any number of Pulses
# TODO: First, make everything look like a sequence of pulses
def flatten_to_pulses(obj):
import pdb; pdb.set_trace()
if isinstance(obj, Pulse):
if isinstance(obj, Pulse) or isinstance(obj, CompositePulse):
yield obj
elif isinstance(obj, CompositePulse):
for pulse in obj.pulses:
yield from flatten_to_pulses(pulse)
else:
for pulse in obj.pulses.values():
yield from flatten_to_pulses(pulse)
Expand All @@ -275,7 +271,7 @@ def flatten_to_pulses(obj):
pulse_list = []
for k,pulse in enumerate(pulses):
if isinstance(pulse, PulseBlock):
pulse_list.append(list(flatten_to_pulses(pulse))) #TODO: flatten the list
pulse_list += list(flatten_to_pulses(pulse))
else:
pulse_list.append(pulse)
if max(pad_lengths) == 0:
Expand Down

0 comments on commit e12c86c

Please sign in to comment.