Skip to content

Commit

Permalink
Fix pulse transforms recursion bug fix that was lost in merge conflict (
Browse files Browse the repository at this point in the history
#4974)

* Fix bug fix that was lost in merge conflict.

* Added bug fix reno.

* Revert style.
  • Loading branch information
taalexander authored Aug 25, 2020
1 parent 43c6490 commit 04f2079
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
19 changes: 11 additions & 8 deletions qiskit/pulse/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,15 @@ def add_implicit_acquires(schedule: interfaces.ScheduleComponent,
chans.AcquireChannel(i),
mem_slot=chans.MemorySlot(i),
kernel=inst.kernel,
discriminator=inst.discriminator) << time
discriminator=inst.discriminator)
if time not in acquire_map:
new_schedule |= explicit_inst
new_schedule.insert(time, explicit_inst, inplace=True)
acquire_map = {time: {i}}
elif i not in acquire_map[time]:
new_schedule |= explicit_inst
new_schedule.insert(time, explicit_inst, inplace=True)
acquire_map[time].add(i)
else:
new_schedule |= inst << time
new_schedule.insert(time, inst, inplace=True)

return new_schedule

Expand Down Expand Up @@ -300,13 +300,16 @@ def compress_pulses(schedules: List[Schedule]) -> List[Schedule]:
if inst.pulse in existing_pulses:
idx = existing_pulses.index(inst.pulse)
identical_pulse = existing_pulses[idx]
new_schedule |= instructions.Play(
identical_pulse, inst.channel, inst.name) << time
new_schedule.insert(time,
instructions.Play(identical_pulse,
inst.channel,
inst.name),
inplace=True)
else:
existing_pulses.append(inst.pulse)
new_schedule |= inst << time
new_schedule.insert(time, inst, inplace=True)
else:
new_schedule |= inst << time
new_schedule.insert(time, inst, inplace=True)

new_schedules.append(new_schedule)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
A bug was fixed that caused long pulse schedules to throw a recursion error.

0 comments on commit 04f2079

Please sign in to comment.