def rb_epc(fit, rb_pattern):
    """Take the rb fit data and convert it into EPC (error per Clifford)

    Args:
        fit (dict): dictionary of the fit quantities (A, alpha, B) with the
            keys 'qn' where n is  the qubit and subkeys 'fit', e.g.
            {'q0':{'fit': [1, 0, 0.9], 'fiterr': [0, 0, 0]}}}
        rb_pattern (list): (see randomized benchmarking functions). Pattern
            which specifies which qubits performing RB with which qubits. E.g.
            [[1],[0,2]] is Q1  doing 1Q RB simultaneously with Q0/Q2 doing
            2Q RB

    Return:
        dict: updates the passed in fit dictionary with the epc
    """
    for patterns in rb_pattern:
        for qubit in patterns:
            fitalpha = fit['q%d' % qubit]['fit'][1]
            fitalphaerr = fit['q%d' % qubit]['fiterr'][1]
            nrb = 2 ** len(patterns)

            fit['q%d' % qubit]['fit_calcs'] = {}
            fit['q%d' % qubit]['fit_calcs']['epc'] = [(nrb - 1) / nrb * (1 - fitalpha),
                                                      fitalphaerr / fitalpha]
            fit['q%d' % qubit]['fit_calcs']['epc'][1] *= fit['q%d' % qubit]['fit_calcs']['epc'][0]

    return fit
def rb_epc(fit, rb_pattern):
    """Take the rb fit data and convert it into EPC (error per Clifford)

    Args:
        fit (dict): dictionary of the fit quantities (A, alpha, B) with the
            keys 'qn' where n is  the qubit and subkeys 'fit', e.g.
            {'q0':{'fit': [1, 0, 0.9], 'fiterr': [0, 0, 0]}}}
        rb_pattern (list): (see randomized benchmarking functions). Pattern
            which specifies which qubits performing RB with which qubits. E.g.
            [[1],[0,2]] is Q1  doing 1Q RB simultaneously with Q0/Q2 doing
            2Q RB

    Return:
        dict: updates the passed in fit dictionary with the epc
    """
    for patterns in rb_pattern:
        for qubit in patterns:
            fitalpha = fit['q%d' % qubit]['fit'][1]
            fitalphaerr = fit['q%d' % qubit]['fiterr'][1]
            nrb = 2 ** len(patterns)

            fit['q%d' % qubit]['fit_calcs'] = {}
            fit['q%d' % qubit]['fit_calcs']['epc'] = [(nrb - 1) / nrb * (1 - fitalpha),
                                                      fitalphaerr / fitalpha]
            fit['q%d' % qubit]['fit_calcs']['epc'][1] *= fit['q%d' % qubit]['fit_calcs']['epc'][0]

    return fit
def rb_epc ( fit , rb_pattern ) : for patterns in rb_pattern : for qubit in patterns : fitalpha = fit [ 'q%d' % qubit ] [ 'fit' ] [ 1 ] fitalphaerr = fit [ 'q%d' % qubit ] [ 'fiterr' ] [ 1 ] nrb = 2 ** len ( patterns ) fit [ 'q%d' % qubit ] [ 'fit_calcs' ] = { } fit [ 'q%d' % qubit ] [ 'fit_calcs' ] [ 'epc' ] = [ ( nrb - 1 ) / nrb * ( 1 - fitalpha ) , fitalphaerr / fitalpha ] fit [ 'q%d' % qubit ] [ 'fit_calcs' ] [ 'epc' ] [ 1 ] *= fit [ 'q%d' % qubit ] [ 'fit_calcs' ] [ 'epc' ] [ 0 ] return fit
Take the rb fit data and convert it into EPC (error per Clifford)

    Args:
        fit (dict): dictionary of the fit quantities (A, alpha, B) with the
            keys 'qn' where n is  the qubit and subkeys 'fit', e.g.
            {'q0':{'fit': [1, 0, 0.9], 'fiterr': [0, 0, 0]}}}
        rb_pattern (list): (see randomized benchmarking functions). Pattern
            which specifies which qubits performing RB with which qubits. E.g.
            [[1],[0,2]] is Q1  doing 1Q RB simultaneously with Q0/Q2 doing
            2Q RB

    Return:
        dict: updates the passed in fit dictionary with the epc
Take the rb fit data and convert it into EPC ( error per Clifford )