def test_acquire(self):
        """Test converted qobj from AcquireInstruction."""
        cmd = Acquire(
            10, Discriminator(name='test_disc', params={'test_params': 1.0}),
            Kernel(name='test_kern', params={'test_params': 'test'}))
        instruction = cmd(self.device.q, self.device.mem, self.device.c)

        qobj = PulseQobjInstruction(
            name='acquire',
            t0=0,
            duration=10,
            qubits=[0],
            memory_slot=[0],
            register_slot=[0],
            kernels=[
                QobjMeasurementOption(name='test_kern',
                                      params={'test_params': 'test'})
            ],
            discriminators=[
                QobjMeasurementOption(name='test_disc',
                                      params={'test_params': 1.0})
            ])
        converted_instruction = self.converter(qobj)

        self.assertEqual(converted_instruction.timeslots,
                         instruction.timeslots)
        self.assertEqual(converted_instruction.instructions[0][-1].command,
                         cmd)
예제 #2
0
    def test_acquire(self):
        """Test converted qobj from AcquireInstruction."""
        cmd = Acquire(10,
                      kernel=Kernel(name='test_kern',
                                    params={'test_params': 'test'}),
                      discriminator=Discriminator(name='test_disc',
                                                  params={'test_params': 1.0}))

        schedule = Schedule()
        for i in range(self.n_qubits):
            schedule |= cmd(AcquireChannel(i), MemorySlot(i), RegisterSlot(i))

        qobj = PulseQobjInstruction(
            name='acquire',
            t0=0,
            duration=10,
            qubits=[0, 1],
            memory_slot=[0, 1],
            register_slot=[0, 1],
            kernels=[
                QobjMeasurementOption(name='test_kern',
                                      params={'test_params': 'test'})
            ],
            discriminators=[
                QobjMeasurementOption(name='test_disc',
                                      params={'test_params': 1.0})
            ])
        converted_instruction = self.converter(qobj)

        self.assertEqual(converted_instruction.timeslots, schedule.timeslots)
        self.assertEqual(converted_instruction.instructions[0][-1].command,
                         cmd)