qiskit/tools/qcvv/tomography.py
def __pauli_prep_gates(circuit, qreg, op):
    """
    Add state preparation gates to a circuit.
    """
    bas, proj = op
    if bas not in ['X', 'Y', 'Z']:
        raise QiskitError("There's no X, Y or Z basis for this Pauli "
                          "preparation")

    if bas == "X":
        if proj == 1:
            circuit.u2(np.pi, np.pi, qreg)  # H.X
        else:
            circuit.u2(0., np.pi, qreg)  # H
    elif bas == "Y":
        if proj == 1:
            circuit.u2(-0.5 * np.pi, np.pi, qreg)  # S.H.X
        else:
            circuit.u2(0.5 * np.pi, np.pi, qreg)  # S.H
    elif bas == "Z" and proj == 1:
        circuit.u3(np.pi, 0., np.pi, qreg)
def __pauli_prep_gates(circuit, qreg, op):
    """
    Add state preparation gates to a circuit.
    """
    bas, proj = op
    if bas not in ['X', 'Y', 'Z']:
        raise QiskitError("There's no X, Y or Z basis for this Pauli "
                          "preparation")

    if bas == "X":
        if proj == 1:
            circuit.u2(np.pi, np.pi, qreg)  # H.X
        else:
            circuit.u2(0., np.pi, qreg)  # H
    elif bas == "Y":
        if proj == 1:
            circuit.u2(-0.5 * np.pi, np.pi, qreg)  # S.H.X
        else:
            circuit.u2(0.5 * np.pi, np.pi, qreg)  # S.H
    elif bas == "Z" and proj == 1:
        circuit.u3(np.pi, 0., np.pi, qreg)
def __pauli_prep_gates ( circuit , qreg , op ) : bas , proj = op if bas not in [ 'X' , 'Y' , 'Z' ] : raise QiskitError ( "There's no X, Y or Z basis for this Pauli " "preparation" ) if bas == "X" : if proj == 1 : circuit . u2 ( np . pi , np . pi , qreg ) # H.X else : circuit . u2 ( 0. , np . pi , qreg ) # H elif bas == "Y" : if proj == 1 : circuit . u2 ( - 0.5 * np . pi , np . pi , qreg ) # S.H.X else : circuit . u2 ( 0.5 * np . pi , np . pi , qreg ) # S.H elif bas == "Z" and proj == 1 : circuit . u3 ( np . pi , 0. , np . pi , qreg )
Add state preparation gates to a circuit.
Add state preparation gates to a circuit .