예제 #1
0
def lztest_theta(Sample,
                 measure=0,
                 theta=st.r[0:2 * np.pi:0.1],
                 state=1,
                 stats=1200,
                 delta=1.0,
                 name='lz theta test',
                 save=True,
                 noisy=True,
                 prob=True):
    sample, devs, qubits, Qubits = gc.loadQubits(Sample, measure, True)
    axes = [(theta, 'Geometric phase')]
    if prob:
        deps = readout.genProbDeps(qubits, measure)
    else:
        deps = [("Mag", "|%s>" % state, ""), ("Phase", "|%s>" % state, "rad")]
    kw = {'stats': stats, 'prob': prob}

    dataset = sweeps.prepDataset(sample, name, axes, deps, measure, kw=kw)

    def func(server, currphase):
        alg = gc.Algorithm(devs)
        q0 = alg.q0
        k0 = np.sqrt(delta**2 / (1 + np.tan(currphase)**2))
        #alg[gates.MoveToState([q0], 0, state-1)]
        alg[LZ_gate([q0], k0=k0, k1=k0 * np.tan(currphase))]
        #alg[gates.MoveToState([q0], state-1, 0)]
        alg[gates.Measure([q0])]
        alg.compile()
        data = yield runQubits(server, alg.agents, stats, dataFormat='iqRaw')
        if prob:
            probs = readout.iqToProbs(data, alg.qubits)
            probs = np.squeeze(probs)
            returnValue(probs)
        else:
            data = readout.parseDataFormat(data, 'iq')
            mag, phase = readout.iqToPolar(data)
            returnValue([mag, phase])

    data = sweeps.grid(func,
                       axes=axes,
                       save=save,
                       dataset=dataset,
                       noisy=noisy)

    return data
예제 #2
0
def lztest_tauc(Sample,
                measure=0,
                delay=st.r[100:120:0.1, ns],
                state=1,
                stats=1200,
                name='lz tauc test',
                save=True,
                noisy=True,
                prob=True):
    sample, devs, qubits, Qubits = gc.loadQubits(Sample, measure, True)
    axes = [(delay, 'tauc')]
    if prob:
        deps = readout.genProbDeps(qubits, measure)
    else:
        deps = [("Mag", "|%s>" % state, ""), ("Phase", "|%s>" % state, "rad")]
    kw = {'stats': stats, 'prob': prob}

    dataset = sweeps.prepDataset(sample, name, axes, deps, measure, kw=kw)

    def func(server, currdelay):
        alg = gc.Algorithm(devs)
        q0 = alg.q0
        taup = q0['lztaup']
        currtau1 = (currdelay - taup) / 2
        alg[LZ_gate([q0], tau1=currtau1)]
        alg[gates.Measure([q0])]
        alg.compile()
        data = yield runQubits(server, alg.agents, stats, dataFormat='iqRaw')
        if prob:
            probs = readout.iqToProbs(data, alg.qubits)
            probs = np.squeeze(probs)
            returnValue(probs)
        else:
            data = readout.parseDataFormat(data, 'iq')
            mag, phase = readout.iqToPolar(data)
            returnValue([mag, phase])

    data = sweeps.grid(func,
                       axes=axes,
                       save=save,
                       dataset=dataset,
                       noisy=noisy)

    return data
예제 #3
0
def lztest_theta_with_k2(Sample,
                         measure=0,
                         k2=st.r[0.1:5:0.2],
                         theta=st.r[0:2 * np.pi:0.2],
                         delta=5.0,
                         state=1,
                         tBuf=0 * ns,
                         stats=600,
                         name='lz k2',
                         save=True,
                         noisy=True):

    sample, devs, qubits = gc.loadQubits(Sample, measure)
    axes = [(k2, 'k2'), (theta, 'Geometric phase')]
    deps = readout.genProbDeps(qubits, measure, range(1 + state))
    kw = {"stats": stats, 'tBuf': tBuf, "state": state}
    name += ' with delta=' + np.str(delta)

    dataset = sweeps.prepDataset(sample, name, axes, deps, measure, kw=kw)

    def func(server, currk, currphase):
        alg = gc.Algorithm(devs)
        q0 = alg.q0
        k0 = np.sqrt(delta**2 / (1 + np.tan(currphase)**2))
        alg[gates.MoveToState([q0], 0, state - 1)]
        alg[gates.Wait([q0], waitTime=tBuf)]
        alg[LZ_gate([q0], k0=k0, k1=k0 * np.tan(currphase), k2=currk)]
        alg[gates.Wait([q0], waitTime=tBuf)]
        alg[gates.Measure([q0])]
        alg.compile()
        data = yield runQubits(server, alg.agents, stats, dataFormat='iqRaw')
        probs = readout.iqToProbs(data, alg.qubits, states=range(1 + state))
        returnValue(np.squeeze(probs))

    data = sweeps.grid(func,
                       axes=axes,
                       save=save,
                       dataset=dataset,
                       noisy=noisy)

    return data