def setUp(self): qubits = [ Qubit(0, drive_channels=[DriveChannel(0, 1.2)], control_channels=[ControlChannel(0)]), Qubit(1, drive_channels=[DriveChannel(1, 3.4)], acquire_channels=[AcquireChannel(1)]) ] registers = [RegisterSlot(i) for i in range(2)] mem_slots = [MemorySlot(i) for i in range(2)] self.two_qubit_device = DeviceSpecification(qubits, registers, mem_slots)
def setUp(self): @functional_pulse def linear(duration, slope, intercept): x = np.linspace(0, duration - 1, duration) return slope * x + intercept self.linear = linear qubits = [Qubit(0, DriveChannel(0), AcquireChannel(0), MeasureChannel(0), control_channels=[ControlChannel(0)]), Qubit(1, DriveChannel(1), MeasureChannel(0), AcquireChannel(1))] registers = [RegisterSlot(i) for i in range(2)] mem_slots = [MemorySlot(i) for i in range(2)] self.two_qubit_device = DeviceSpecification(qubits, registers, mem_slots)
def setUp(self): super().setUp() qubits = [ Qubit(0, DriveChannel(0), AcquireChannel(0), MeasureChannel(0), control_channels=[ControlChannel(0)]), Qubit(1, DriveChannel(1), MeasureChannel(0), AcquireChannel(1)) ] registers = [RegisterSlot(i) for i in range(2)] mem_slots = [MemorySlot(i) for i in range(2)] self.two_qubit_device = DeviceSpecification(qubits, registers, mem_slots)
def test_default(self): """Test default device specification. """ qubits = [ Qubit(0, DriveChannel(0), MeasureChannel(0), AcquireChannel(0)), Qubit(1, DriveChannel(1), MeasureChannel(1), AcquireChannel(1)) ] registers = [RegisterSlot(i) for i in range(2)] mem_slots = [MemorySlot(i) for i in range(2)] spec = DeviceSpecification(qubits, registers, mem_slots) self.assertEqual(spec.q[0].drive, DriveChannel(0)) self.assertEqual(spec.q[1].acquire, AcquireChannel(1)) self.assertEqual(spec.mem[0], MemorySlot(0)) self.assertEqual(spec.c[1], RegisterSlot(1))
def setUp(self): self.schedule = Schedule() self.qubits = [ Qubit(0, drive_channel=DriveChannel(0), control_channels=[ControlChannel(0)], measure_channel=MeasureChannel(0), acquire_channel=AcquireChannel(0)), Qubit(1, drive_channel=DriveChannel(1), acquire_channel=AcquireChannel(1), measure_channel=MeasureChannel(1)) ] self.registers = [RegisterSlot(i) for i in range(2)] self.mem_slots = [MemorySlot(i) for i in range(2)] self.device = DeviceSpecification(self.qubits, self.registers, self.mem_slots)
def setUp(self): self.device = DeviceSpecification(qubits=[ Qubit(0, drive_channels=[DriveChannel(0, 1.2)], acquire_channels=[AcquireChannel(0)]) ], registers=[RegisterSlot(0)], mem_slots=[MemorySlot(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 = DeviceSpecification( qubits=[ Qubit(0, DriveChannel(0), MeasureChannel(0), AcquireChannel(0)), Qubit(1, DriveChannel(1), MeasureChannel(1), AcquireChannel(1)), ], registers=[RegisterSlot(0), RegisterSlot(1)], mem_slots=[MemorySlot(0), MemorySlot(1)])
def test_default(self): """Test default qubit. """ qubit = Qubit(1, DriveChannel(2), MeasureChannel(4), AcquireChannel(5), control_channels=[ControlChannel(3)]) self.assertEqual(qubit.drive, DriveChannel(2)) self.assertEqual(qubit.controls[0], ControlChannel(3)) self.assertEqual(qubit.measure, MeasureChannel(4)) self.assertEqual(qubit.acquire, AcquireChannel(5))
def setUp(self): self.device = DeviceSpecification( qubits=[ Qubit(0, DriveChannel(0), MeasureChannel(0), AcquireChannel(0)) ], registers=[ RegisterSlot(0) ], mem_slots=[ MemorySlot(0) ] )
def test_default(self): """Test default qubit. """ qubit = Qubit(1, drive_channels=[DriveChannel(2, 1.2)], control_channels=[ControlChannel(3)], measure_channels=[MeasureChannel(4)], acquire_channels=[AcquireChannel(5)]) self.assertEqual(qubit.drive, DriveChannel(2, 1.2)) self.assertEqual(qubit.control, ControlChannel(3)) self.assertEqual(qubit.measure, MeasureChannel(4)) self.assertEqual(qubit.acquire, AcquireChannel(5))