コード例 #1
0
    def setUp(self) -> None:
        """Setup."""
        super().setUp()

        self.qubits = list(qiskit.QuantumRegister(2))
        self.clbits = list(qiskit.ClassicalRegister(2))

        self.instructions = [
            types.ScheduledGate(t0=0, operand=library.U1Gate(0),
                                duration=0, bits=[self.qubits[0]], bit_position=0),
            types.ScheduledGate(t0=0, operand=library.U2Gate(0, 0),
                                duration=10, bits=[self.qubits[0]], bit_position=0),
            types.ScheduledGate(t0=10, operand=library.CXGate(),
                                duration=50, bits=[self.qubits[0], self.qubits[1]],
                                bit_position=0),
            types.ScheduledGate(t0=100, operand=library.U3Gate(0, 0, 0),
                                duration=20, bits=[self.qubits[0]], bit_position=0),
            types.ScheduledGate(t0=120, operand=library.Barrier(2),
                                duration=0, bits=[self.qubits[0], self.qubits[1]],
                                bit_position=0),
            types.ScheduledGate(t0=120, operand=library.CXGate(),
                                duration=50, bits=[self.qubits[1], self.qubits[0]],
                                bit_position=1),
            types.ScheduledGate(t0=200, operand=library.Barrier(1),
                                duration=0, bits=[self.qubits[0]], bit_position=0),
            types.ScheduledGate(t0=200, operand=library.Measure(),
                                duration=100, bits=[self.qubits[0], self.clbits[0]],
                                bit_position=0),
        ]
コード例 #2
0
    def setUp(self) -> None:
        """Setup."""
        super().setUp()

        self.qubit = list(qiskit.QuantumRegister(1))[0]

        self.u1 = types.ScheduledGate(t0=100,
                                      operand=library.U1Gate(0),
                                      duration=0,
                                      bits=[self.qubit],
                                      bit_position=0)

        self.u3 = types.ScheduledGate(t0=100,
                                      operand=library.U3Gate(0, 0, 0),
                                      duration=20,
                                      bits=[self.qubit],
                                      bit_position=0)

        self.delay = types.ScheduledGate(t0=100,
                                         operand=Delay(20),
                                         duration=20,
                                         bits=[self.qubit],
                                         bit_position=0)

        style = stylesheet.QiskitTimelineStyle()
        self.formatter = style.formatter
コード例 #3
0
    def test_gate_output(self):
        """Test gate output."""
        bit_event = events.BitEvents(self.qubits[0], self.instructions, 300)

        gates = list(bit_event.get_gates())
        ref_list = [
            types.ScheduledGate(
                t0=0, operand=library.U1Gate(0), duration=0, bits=[self.qubits[0]], bit_position=0
            ),
            types.ScheduledGate(
                t0=0,
                operand=library.U2Gate(0, 0),
                duration=10,
                bits=[self.qubits[0]],
                bit_position=0,
            ),
            types.ScheduledGate(
                t0=10,
                operand=library.CXGate(),
                duration=50,
                bits=[self.qubits[0], self.qubits[1]],
                bit_position=0,
            ),
            types.ScheduledGate(
                t0=100,
                operand=library.U3Gate(0, 0, 0),
                duration=20,
                bits=[self.qubits[0]],
                bit_position=0,
            ),
            types.ScheduledGate(
                t0=120,
                operand=library.CXGate(),
                duration=50,
                bits=[self.qubits[1], self.qubits[0]],
                bit_position=1,
            ),
            types.ScheduledGate(
                t0=200,
                operand=library.Measure(),
                duration=100,
                bits=[self.qubits[0], self.clbits[0]],
                bit_position=0,
            ),
        ]

        self.assertListEqual(gates, ref_list)