def test_gaussian_square_pulse_instruction(self): """Test that parametric pulses are correctly converted to PulseQobjInstructions.""" converter = InstructionToQobjConverter(PulseQobjInstruction, meas_level=2) instruction = Play(GaussianSquare(duration=1500, sigma=15, amp=-0.5 + 0.2j, width=1300), MeasureChannel(1)) valid_qobj = PulseQobjInstruction( name='parametric_pulse', pulse_shape='gaussian_square', ch='m1', t0=10, parameters={'duration': 1500, 'sigma': 15, 'amp': -0.5 + 0.2j, 'width': 1300}) self.assertEqual(converter(10, instruction), valid_qobj)
def test_parametric_commands_in_sched(self): """Test that schedules can be built with parametric commands.""" sched = Schedule(name='test_parametric') sched += Gaussian(duration=25, sigma=4, amp=0.5j)(DriveChannel(0)) sched += Drag(duration=25, amp=0.2+0.3j, sigma=7.8, beta=4)(DriveChannel(1)) sched += ConstantPulse(duration=25, amp=1)(DriveChannel(2)) sched_duration = sched.duration sched += GaussianSquare(duration=1500, amp=0.2, sigma=8, width=140)(MeasureChannel(0)) << sched_duration sched += Acquire(duration=1500)(AcquireChannel(0), mem_slots=[MemorySlot(0)]) << sched_duration self.assertEqual(sched.duration, 1525) self.assertTrue('sigma' in sched.instructions[0][1].command.parameters)