Exemplo n.º 1
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),
                                     [MemorySlot(0)]) << sched_duration
     self.assertEqual(sched.duration, 1525)
     self.assertTrue('sigma' in sched.instructions[0][1].command.parameters)
Exemplo n.º 2
0
 def test_gaussian_pulse_instruction(self):
     """Test that parametric pulses are correctly converted to PulseQobjInstructions."""
     converter = InstructionToQobjConverter(PulseQobjInstruction,
                                            meas_level=2)
     instruction = Play(Gaussian(duration=25, sigma=15, amp=-0.5 + 0.2j),
                        DriveChannel(0))
     valid_qobj = PulseQobjInstruction(name='parametric_pulse',
                                       pulse_shape='gaussian',
                                       ch='d0',
                                       t0=0,
                                       parameters={
                                           'duration': 25,
                                           'sigma': 15,
                                           'amp': -0.5 + 0.2j
                                       })
     self.assertEqual(converter(0, instruction), valid_qobj)
Exemplo n.º 3
0
 def test_parametric_pulses(self):
     """Test converted qobj from ParametricInstruction."""
     instruction = Gaussian(duration=25, sigma=15,
                            amp=-0.5 + 0.2j)(DriveChannel(0))
     qobj = PulseQobjInstruction(name='parametric_pulse',
                                 pulse_shape='gaussian',
                                 ch='d0',
                                 t0=0,
                                 parameters={
                                     'duration': 25,
                                     'sigma': 15,
                                     'amp': -0.5 + 0.2j
                                 })
     converted_instruction = self.converter(qobj)
     self.assertEqual(converted_instruction.timeslots,
                      instruction.timeslots)
     self.assertEqual(converted_instruction.instructions[0][-1].command,
                      instruction.command)