Skip to content

Commit

Permalink
Fix the damage...
Browse files Browse the repository at this point in the history
  • Loading branch information
caryan committed Jul 11, 2016
1 parent a6674f6 commit 26829cf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
27 changes: 14 additions & 13 deletions QGL/Compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,19 +479,19 @@ def compile_sequence(seq, channels=None):
for chan in channels:
if block.pulses[chan].frameChange == 0:
continue
if len(wires[chan]) > 0:
logger.debug("Modifying pulse on %s: %s", chan,
wires[chan][-1])
wires[chan][-1] = copy(wires[chan][-1])
wires[chan][-1].frameChange += block.pulses[
chan].frameChange
if chan in ChannelLibrary.channelLib.connectivityG.nodes():
logger.debug("Doing propagate_node_frame_to_edges()")
wires = propagate_node_frame_to_edges(
wires, chan, block.pulses[chan].frameChange)
else:
if len(wires[chan]) == 0:
warn("Dropping initial frame change")
continue
logger.debug("Modifying pulse on %s: %s", chan, wires[chan][-1])
updated_frameChange = wires[chan][-1].frameChange + block.pulses[chan].frameChange
wires[chan][-1] = wires[chan][-1]._replace(frameChange=updated_frameChange)
if chan in ChannelLibrary.channelLib.connectivityG.nodes():
logger.debug("Doing propagate_node_frame_to_edges()")
wires = propagate_node_frame_to_edges(
wires, chan, block.pulses[chan].frameChange)

continue

# schedule the block
for chan in channels:
# add aligned Pulses (if the block contains a composite pulse, may get back multiple pulses)
Expand All @@ -515,8 +515,9 @@ def propagate_node_frame_to_edges(wires, chan, frameChange):
edge = ChannelLibrary.channelLib.connectivityG.edge[predecessor][chan][
'channel']
if edge in wires:
wires[edge][-1] = copy(wires[edge][-1])
wires[edge][-1].frameChange += frameChange
updated_frameChange = wires[edge][-1].frameChange + frameChange
wires[edge][-1] = wires[edge][-1]._replace(frameChange=updated_frameChange)

return wires


Expand Down
12 changes: 8 additions & 4 deletions QGL/PatternUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,16 @@ def add_gate_pulses(seqs):
for seq in seqs:
for ct in range(len(seq)):
if isinstance(seq[ct], PulseBlock):
pb = None
for chan, pulse in seq[ct].pulses.items():
if has_gate(chan) and not pulse.isZero and not (
chan.gateChan in seq[ct].pulses.keys()):
seq[ct] *= BLANK(chan, pulse.length)
if pb:
pb *= BLANK(chan, pulse.length)
else:
pb = BLANK(chan, pulse.length)
if pb:
seq[ct] *= pb
elif hasattr(seq[ct], 'channel'):
chan = seq[ct].channel
if has_gate(chan) and not seq[ct].isZero:
Expand Down Expand Up @@ -190,9 +196,7 @@ def add_digitizer_trigger(seqs):
if not contains_measurement(seq[ct]):
continue
#find corresponding digitizer trigger
chanlist = seq[ct].channel
if not isinstance(seq[ct], PulseBlock):
chanlist = [chanlist]
chanlist = list(flatten([seq[ct].channel]))
for chan in chanlist:
if hasattr(chan, 'trigChan'):
trigChan = chan.trigChan
Expand Down

0 comments on commit 26829cf

Please sign in to comment.