コード例 #1
0
 def test_parametric_pulse_schedule(self):
     """Test that parametric instructions/schedules can be drawn."""
     filename = self._get_resource_path(
         'current_schedule_matplotlib_ref.png')
     schedule = Schedule(name='test_parametric')
     schedule += Gaussian(duration=25, sigma=4, amp=0.5j)(DriveChannel(0))
     pulse_drawer(schedule, filename=filename)
     self.assertImagesAreEqual(filename,
                               self.parametric_matplotlib_reference)
     os.remove(filename)
コード例 #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)
コード例 #3
0
 def test_parametric_pulses(self):
     """Test converted qobj from ParametricInstruction."""
     instruction = Play(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], instruction)
コード例 #4
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)