def build_wigner_circuits(circuit, phis, thetas, qubits,
                          qreg, creg):
    """Create the circuits to rotate to points in phase space
    Args:
        circuit (QuantumCircuit): The circuit to be appended with tomography
                                  state preparation and/or measurements.
        phis (np.matrix[[complex]]): phis
        thetas (np.matrix[[complex]]): thetas
        qubits (list[int]): a list of the qubit indexes of qreg to be measured.
        qreg (QuantumRegister): the quantum register containing qubits to be
                                measured.
        creg (ClassicalRegister): the classical register containing bits to
                                    store measurement outcomes.

    Returns:
        list: A list of names of the added wigner function circuits.

    Raises:
        QiskitError: if circuit is not a valid QuantumCircuit.
    """

    if not isinstance(circuit, QuantumCircuit):
        raise QiskitError('Input circuit must be a QuantumCircuit object')

    tomography_circuits = []
    points = len(phis[0])
    for point in range(points):
        label = '_wigner_phase_point'
        label += str(point)
        tmp_circ = QuantumCircuit(qreg, creg, name=label)
        for qubit, _ in enumerate(qubits):
            tmp_circ.u3(thetas[qubit][point], 0,
                        phis[qubit][point], qreg[qubits[qubit]])
            tmp_circ.measure(qreg[qubits[qubit]], creg[qubits[qubit]])
        # Add to original circuit
        tmp_circ = circuit + tmp_circ
        tmp_circ.name = circuit.name + label
        tomography_circuits.append(tmp_circ)

    logger.info('>> Created Wigner function circuits for "%s"', circuit.name)
    return tomography_circuits
def build_wigner_circuits(circuit, phis, thetas, qubits,
                          qreg, creg):
    """Create the circuits to rotate to points in phase space
    Args:
        circuit (QuantumCircuit): The circuit to be appended with tomography
                                  state preparation and/or measurements.
        phis (np.matrix[[complex]]): phis
        thetas (np.matrix[[complex]]): thetas
        qubits (list[int]): a list of the qubit indexes of qreg to be measured.
        qreg (QuantumRegister): the quantum register containing qubits to be
                                measured.
        creg (ClassicalRegister): the classical register containing bits to
                                    store measurement outcomes.

    Returns:
        list: A list of names of the added wigner function circuits.

    Raises:
        QiskitError: if circuit is not a valid QuantumCircuit.
    """

    if not isinstance(circuit, QuantumCircuit):
        raise QiskitError('Input circuit must be a QuantumCircuit object')

    tomography_circuits = []
    points = len(phis[0])
    for point in range(points):
        label = '_wigner_phase_point'
        label += str(point)
        tmp_circ = QuantumCircuit(qreg, creg, name=label)
        for qubit, _ in enumerate(qubits):
            tmp_circ.u3(thetas[qubit][point], 0,
                        phis[qubit][point], qreg[qubits[qubit]])
            tmp_circ.measure(qreg[qubits[qubit]], creg[qubits[qubit]])
        # Add to original circuit
        tmp_circ = circuit + tmp_circ
        tmp_circ.name = circuit.name + label
        tomography_circuits.append(tmp_circ)

    logger.info('>> Created Wigner function circuits for "%s"', circuit.name)
    return tomography_circuits
def build_wigner_circuits ( circuit , phis , thetas , qubits , qreg , creg ) : if not isinstance ( circuit , QuantumCircuit ) : raise QiskitError ( 'Input circuit must be a QuantumCircuit object' ) tomography_circuits = [ ] points = len ( phis [ 0 ] ) for point in range ( points ) : label = '_wigner_phase_point' label += str ( point ) tmp_circ = QuantumCircuit ( qreg , creg , name = label ) for qubit , _ in enumerate ( qubits ) : tmp_circ . u3 ( thetas [ qubit ] [ point ] , 0 , phis [ qubit ] [ point ] , qreg [ qubits [ qubit ] ] ) tmp_circ . measure ( qreg [ qubits [ qubit ] ] , creg [ qubits [ qubit ] ] ) # Add to original circuit tmp_circ = circuit + tmp_circ tmp_circ . name = circuit . name + label tomography_circuits . append ( tmp_circ ) logger . info ( '>> Created Wigner function circuits for "%s"' , circuit . name ) return tomography_circuits
Create the circuits to rotate to points in phase space
    Args:
        circuit (QuantumCircuit): The circuit to be appended with tomography
                                  state preparation and/or measurements.
        phis (np.matrix[[complex]]): phis
        thetas (np.matrix[[complex]]): thetas
        qubits (list[int]): a list of the qubit indexes of qreg to be measured.
        qreg (QuantumRegister): the quantum register containing qubits to be
                                measured.
        creg (ClassicalRegister): the classical register containing bits to
                                    store measurement outcomes.

    Returns:
        list: A list of names of the added wigner function circuits.

    Raises:
        QiskitError: if circuit is not a valid QuantumCircuit.
Create the circuits to rotate to points in phase space Args : circuit ( QuantumCircuit ) : The circuit to be appended with tomography state preparation and / or measurements . phis ( np . matrix [[ complex ]] ) : phis thetas ( np . matrix [[ complex ]] ) : thetas qubits ( list [ int ] ) : a list of the qubit indexes of qreg to be measured . qreg ( QuantumRegister ) : the quantum register containing qubits to be measured . creg ( ClassicalRegister ) : the classical register containing bits to store measurement outcomes .