예제 #1
0
    def test_drag_pulse_instruction(self):
        """Test that parametric pulses are correctly converted to PulseQobjInstructions."""
        converter = InstructionToQobjConverter(PulseQobjInstruction, meas_level=2)
        instruction = Play(Drag(duration=25, sigma=15, amp=-0.5 + 0.2j, beta=0.5), DriveChannel(0))

        valid_qobj = PulseQobjInstruction(
            name='parametric_pulse',
            pulse_shape='drag',
            ch='d0',
            t0=30,
            parameters={'duration': 25, 'sigma': 15, 'amp': -0.5 + 0.2j, 'beta': 0.5})
        self.assertEqual(converter(30, instruction), valid_qobj)
예제 #2
0
 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)