示例#1
0
    def setUp(self):
        @functional_pulse
        def linear(duration, slope, intercept):
            x = np.linspace(0, duration - 1, duration)
            return slope * x + intercept

        self.linear = linear
        self.two_qubit_device = PulseChannelSpec(n_qubits=2, n_control=1, n_registers=2)
示例#2
0
    def setUp(self):
        self.linear = SamplePulse(np.arange(0, 0.01), name='linear')
        self.pulse_library = [PulseLibraryItem(name=self.linear.name,
                                               samples=self.linear.samples.tolist())]

        self.converter = QobjToInstructionConverter(self.pulse_library, buffer=0)

        self.device = PulseChannelSpec(n_qubits=2, n_control=0, n_registers=2)
    def test_default(self):
        """Test default device specification.
        """
        spec = PulseChannelSpec(n_qubits=2, n_control=0, n_registers=2)

        self.assertEqual(spec.drives[0], DriveChannel(0))
        self.assertEqual(spec.acquires[1], AcquireChannel(1))
        self.assertEqual(spec.memoryslots[0], MemorySlot(0))
        self.assertEqual(spec.registers[1], RegisterSlot(1))
    def test_creation_from_backend_with_zero_u_channels(self):
        """Test creation of device specification from backend.
        """
        backend = FakeOpenPulse2Q()

        device = PulseChannelSpec.from_backend(backend)

        self.assertEqual(device.drives[0], DriveChannel(0))
        self.assertEqual(device.controls[0], ControlChannel(0))
        self.assertEqual(device.measures[0], MeasureChannel(0))
        self.assertEqual(device.acquires[0], AcquireChannel(0))
        self.assertEqual(device.registers[0], RegisterSlot(0))
        self.assertEqual(device.memoryslots[0], MemorySlot(0))
 def setUp(self):
     self.device = PulseChannelSpec(n_qubits=1, n_control=0, n_registers=1)
 def setUp(self):
     self.schedule = Schedule()
     self.device = PulseChannelSpec(n_qubits=2, n_control=1, n_registers=2)