Esempio n. 1
0
    def test_snapshot(self):
        """Test snapshot instruction."""
        with pulse.build() as schedule:
            pulse.snapshot('test', 'state')

        reference = pulse.Schedule()
        reference += instructions.Snapshot('test', 'state')

        self.assertEqual(schedule, reference)
    def convert_snapshot(self, instruction):
        """Return converted `Snapshot`.

        Args:
            instruction (PulseQobjInstruction): snapshot qobj
        Returns:
            Schedule: Converted and scheduled Snapshot
        """
        t0 = instruction.t0
        return instructions.Snapshot(instruction.label, instruction.type) << t0
Esempio n. 3
0
    def test_default(self):
        """Test default snapshot."""
        snapshot = instructions.Snapshot(label='test_name', snapshot_type='state')

        self.assertIsInstance(snapshot.id, int)
        self.assertEqual(snapshot.name, 'test_name')
        self.assertEqual(snapshot.type, 'state')
        self.assertEqual(snapshot.duration, 0)
        self.assertNotEqual(snapshot, instructions.Delay(10, channels.DriveChannel(0)))
        self.assertEqual(repr(snapshot), "Snapshot(test_name, state, name='test_name')")