This fixes an error in the schedule -> signal converter when the schedule contained a barrier instruction.
Details and comments
As described in #202, in the loop over instructions to construct the signals, there is a line chan = inst.channel.name, which assumes that inst.channel exists. Barrier instructions do not have a channel attribute, hence the error. This PR modifies this line to conditionally set chan based on whether inst.channel exists, and adds a test validating the correct parsing of a schedule with a barrier. Note that I've also removed the phase and freq variables set at the same time as chan, as they were only used in one subsequent line.
For completeness, the important thing to note here is that nothing actually needs to be done to "support" barrier instructions:
Barrier instructions impact how block_to_schedule converts ScheduleBlock instances to Schedule instances.
Once in Schedule form all instructions have explicit absolute timing, so the barrier instructions in the schedule are actually redundant.
As the Dynamics schedule -> signal converter works with these absolute times, it can actually just ignore the barrier instructions when parsing a schedule.
Hence, the problem arising in #202 is just a result of a trivial mishandling of the barrier instruction object.
Summary
Closes #202.
This fixes an error in the schedule -> signal converter when the schedule contained a barrier instruction.
Details and comments
As described in #202, in the loop over instructions to construct the signals, there is a line
chan = inst.channel.name
, which assumes thatinst.channel
exists. Barrier instructions do not have achannel
attribute, hence the error. This PR modifies this line to conditionally setchan
based on whetherinst.channel
exists, and adds a test validating the correct parsing of a schedule with a barrier. Note that I've also removed thephase
andfreq
variables set at the same time aschan
, as they were only used in one subsequent line.For completeness, the important thing to note here is that nothing actually needs to be done to "support" barrier instructions:
block_to_schedule
convertsScheduleBlock
instances toSchedule
instances.Schedule
form all instructions have explicit absolute timing, so the barrier instructions in the schedule are actually redundant.