Пример #1
0
 def test_play(self):
     """Test basic play instruction."""
     duration = 64
     pulse = pulse_lib.SamplePulse([1.0] * duration, name='test')
     play = Play(pulse, DriveChannel(1))
     self.assertEqual(play.name, pulse.name)
     self.assertEqual(play.duration, duration)
Пример #2
0
    def test_play(self):
        """Test basic play instruction."""
        duration = 4
        pulse = pulse_lib.SamplePulse([1.0] * duration, name='test')
        play = Play(pulse, DriveChannel(1))

        self.assertIsInstance(play.id, int)
        self.assertEqual(play.name, pulse.name)
        self.assertEqual(play.duration, duration)
        self.assertEqual(repr(play),
                         "Play(SamplePulse(array([1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j]), name='test'),"
                         " DriveChannel(1), name='test')")
Пример #3
0
    def bind_pulse(self, pulse):
        """Bind the supplied pulse to a converter method by pulse name.

        Args:
            pulse (PulseLibraryItem): Pulse to bind
        """
        # pylint: disable=unused-variable
        pulse = pulse_lib.SamplePulse(pulse.samples, pulse.name)

        @self.bind_name(pulse.name)
        def convert_named_drive(self, instruction):
            """Return converted `Play`.

            Args:
                instruction (PulseQobjInstruction): pulse qobj
            Returns:
                Schedule: Converted and scheduled pulse
            """
            t0 = instruction.t0
            channel = self.get_channel(instruction.ch)
            return instructions.Play(pulse, channel) << t0