Пример #1
0
    def func(server, mpa):
        t_pi = 0
        t_meas = q['piLen']/2.0
        
        # without pi-pulse
        q['readout'] = True
        q['measureAmp'] = mpa
        q.xy = env.NOTHING
        q.z = eh.measurePulse(q, t_meas)
        req0 = runQubits(server, qubits, stats, probs=[1])
        
        # with pi-pulse
        q['readout'] = True
        q['measureAmp'] = mpa
        q.xy = eh.mix(q, eh.piPulseHD(q, t_pi))
        q.z = eh.measurePulse(q, t_meas)
        req1 = runQubits(server, qubits, stats, probs=[1])

        # |2> with pi-pulse
        q['readout'] = True
        q['measureAmp'] = mpa
        q.xy = eh.mix(q, eh.piPulseHD(q, t_pi-q.piLen))+eh.mix(q, env.gaussian(t_pi, q.piFWHM, q.piAmp21, df=q.piDf21), freq = 'f21')
        q.z = eh.measurePulse(q, t_meas)
        req2 = runQubits(server, qubits, stats, probs=[1])
        
        probs = yield FutureList([req0, req1, req2])
        p0, p1, p2 = [p[0] for p in probs]
        
        returnValue([p0, p1, p1-p0, p2, p2-p1])
Пример #2
0
 def func(server, iteration):
     reqs=[]
     for tomoPhase in ['+X','+Y','-X','-Y']:
         q.xy = eh.mix(q, pump + probe(holdTime, tomoPhase=tomoPhase))
         q.z = eh.measurePulse(q, holdTime+20*ns)
         q['readout']=True
         reqs.append(runQubits(server, qubits, stats, probs=[1]))
     #Arrange timing
     iteration += skips[0]
     if start[0] is None:
         start[0] = time.clock()
         nextTime = 0
     else:
         elapsed = time.clock() - start[0]
         nextIteration = int(math.ceil(elapsed / ts))
         if nextIteration > iteration + 1: #Should be nextIteration > iteration + 1
             # oops, we missed some datapoints :-(
             skips[0] += nextIteration - (iteration + 1)
             print 'skip!  skips = %d/%d (%g%%)' % (skips[0], iteration, 100*skips[0]/iteration)
         #Hang out until it's time to fire off the next iteration
         nextTime = nextIteration * ts
         wait = nextTime - (time.clock() - start[0])
         if wait > 0:
             waits[0] += wait
             waits[1] += 1
             avg = waits[0] / waits[1]
             pct = avg / ts
             print 'average wait: %g = %g%% of timeStep' % (avg, 100*pct)
             time.sleep(wait)
     probs = yield FutureList(reqs)
     data = [p[0] for p in probs]
     data = [iteration] + data + [nextTime]
     returnValue(data)
Пример #3
0
 def func(server, args):
     displacementAmp = args[0]
     currLen = args[1]
     time = 0.0
     q.xy = env.NOTHING
     q.z=env.NOTHING
     #Put the resonator in an arbitrary state with a series of qubit pulses and swaps
     for i in np.arange(len(swapTimes)):
         #q.xy += eh.mix(q, eh.rotPulseHD(q, time-delay, angle=pulseAngles[i], phase=pulsePhases[i]+2.0j*np.pi*(qf-rf)*time, alpha=0.5, state=1))
         q.xy += eh.boostState(q, time, 1)
         time += q['piLen']
         q.z += env.rect(time, swapTimes[i], sa,overshoot = os[i])
         time += swapTimes[i]
         time += offresTimes[i]
     resstart = time + probePulseDelay + 2*rdelay
     #Try to dump the qubit population in case there is any
     ##REMOVED##
     #Drive the resonator
     #The conjugate on the displacement amplitude and drive phase is there because you're driving FROM displacementAmp
     #back to the origin!
     r.xy = eh.mix(r, env.gaussian(resstart - rdelay, r.piFWHM, np.conjugate(displacementAmp*r['timingPhase'])), freq='freq')
     time += 4
     time = max(time, resstart)
     #Probe the resonator with the qubit
     q.z += env.rect(time+12, currLen, sa, overshoot=q[paramName+'SwapOvershoot'])
     time += currLen + 4+12
     
     q.z += eh.measurePulse(q, time)
 
     q['readout'] = True        
     data = yield runQubits(server, qubits, stats=stats, probs=[1])       
     data = np.hstack(([displacementAmp.real, displacementAmp.imag, currLen], data))
     returnValue(data)
Пример #4
0
    def func(server, iteration):
        #Arrange timing
        iteration += skips[0]
        if start[0] is None:
            start[0] = time.clock()
            nextTime = 0
        else:
            elapsed = time.clock() - start[0]
            nextIteration = int(math.ceil(elapsed / ts))
            if nextIteration > iteration + 1: #Should be nextIteration > iteration + 1
                # oops, we missed some datapoints :-(
                skips[0] += nextIteration - (iteration + 1)
                print 'skip!  skips = %d/%d (%g%%)' % (skips[0], iteration, 100*skips[0]/iteration)
            #Hang out until it's time to fire off the next iteration
            nextTime = nextIteration * ts
            wait = nextTime - (time.clock() - start[0])
            if wait > 0:
                waits[0] += wait
                waits[1] += 1
                avg = waits[0] / waits[1]
                pct = avg / ts
                print 'average wait: %g = %g%% of timeStep' % (avg, 100*pct)
                time.sleep(wait)

        pX, pY, pmX, pmY = yield runInterlacedSRAM(server, qubits, stats, probs=[1])
        data = [iteration] + [pX[0], pY[0], pmX[0], pmY[0]] + [nextTime]
        returnValue(data)
Пример #5
0
 def func(server, delay):
     reqs = []
     for controlPi in [False,True]:
         t = 0
         qC.xy = qC.z = env.NOTHING
         if controlPi:
             qC.xy += eh.boostState(qC, t, controlState)
             t += (controlState-0.5)*qC['piLen'] + 0.5*qM['piLen']
         qM.xy = eh.boostState(qM, t, measureState-1)
         t += (measureState-1)*qM['piLen']
         qM.xy += eh.mix(qM, eh.piHalfPulse(qM, t, phase=0.0, state=measureState), state=measureState)
         t += delay
         qM.xy += eh.mix(qM, eh.piHalfPulse(qM, t, phase = 2*np.pi*(fringeFreq['GHz']*delay['ns']), state=measureState), state=measureState)
         t += 0.5*qM['piLen']
         qM.z = eh.measurePulse(qM, t, state=measureState)
         if controlPi:
             qM['readout'] = True
             qC['readout'] = True
             qC.z += eh.measurePulse(qC, t, state=controlState)
             if control < measure:
                 probsReadout = [2,3]
             else:
                 probsReadout = [1,3]
         else:
             probsReadout = [1]
             qM['readout'] = True
             qC['readout'] = False
         reqs.append(runQubits(server, qubits, stats, probs=probsReadout))
     probs = yield FutureList(reqs)
     data = []
     for probset in probs:
         data += probset
     problist = [data[0],data[1],data[2]]
     returnValue(data)
Пример #6
0
    def func(iteration):
        seqs = []
        qubitPhases = [shuffleable(['+X','+Y','-X','-Y']) for i in range(M)]
        for i in range(M): #Shuffle the order of the tomo phases
            qubitPhases[i].shuffle()
        for tomoPhase in range(4):
            for i,m in enumerate(measure):
                qubits[m]._xy = mix(qubits[m], pump(qubits[m]) + probe(qubits[m], holdTime, tomoPhase = qubitPhases[i].table[tomoPhase][1]))
                qubits[m]._z  = measure_pulse(qubits[m],holdTime+20*ns)
            seqs += [Seq(qubits,stats,separate=True)]
        
        ###TIMING. Wait until next sequence should be run.#################
        nextIteration = iteration+1
        while time.clock()>=nextIteration*ts:
            nextIteration+=2
        #Hang out until it's time to fire off the next iteration
        t = time.clock()
        nextTime = nextIteration * ts
        time.sleep(nextTime - t)
        ###END TIMING#######################################################

        response = yield seqs   #Returns a list of 4 numpy arrays, one array for each tomo axis. Each array has two elements, one for each
                                #qubit measured
        data=[]
        #Sort data
        for i,m in enumerate(measure):
            L = zip([qubitPhases[i].table[j][0] for j in range(4)],[response[j][i] for j in range(4)])
            L.sort()
            L = [L[j][1] for j in range(4)]
            data.extend(L)
        data = [iteration] + data + [nextTime]
        returnValue(data)
Пример #7
0
 def wrapped(args):
     all, swept = args
     ans = yield func(*all)
     ans = np.asarray(ans)
     pre = np.asarray(swept)
     if len(ans.shape) != 1:
         pre = np.tile([pre], (ans.shape[0], 1))
     returnValue(np.hstack((pre, ans)))
Пример #8
0
 def func(server, delay, phase):
     reqs = []
     for tomoPhase in tomoPhases.keys():
         q.xy = eh.boostState(q, 0, state-1) + eh.mix(q, pump + probe(delay, tomoPhase = tomoPhase, phase=phase), state=state)
         q.z = eh.measurePulse(q,timeUpstate+dt+delay, state=state)
         reqs.append(runQubits(server, qubits, stats, probs=[1]))
     probs = yield FutureList(reqs)
     data = [p[0] for p in probs]
     returnValue(data)
Пример #9
0
 def wrapped(val):
     ans = yield func(val)
     ans = np.asarray(ans)
     if noisy:
         if len(ans.shape) == 1:
             rows = [ans]
         else:
             rows = ans
         for row in rows:
             print ' '.join(('%0.3g' % v).ljust(8) for v in row)
     returnValue(ans)
Пример #10
0
 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))
Пример #11
0
 def func(server, len, iter, amp):
     q.xy = eh.mix(q, eh.rabiPulseHD(q, 0, len, amp=amp, width=turnOnWidth))
     q.z = eh.measurePulse(q, measureDelay+len)
     q['readout']=True
     reqRabi = runQubits(server, qubits, stats, probs=[1])
     
     q.xy = eh.mix(q, eh.piPulse(q,0))
     q.z = eh.measurePulse(q, len)
     q['readout']=True
     reqT1 = runQubits(server, qubits, stats, probs=[1])
     
     probs = yield FutureList([reqRabi, reqT1])
     pRabi, pT1 = [p[0] for p in probs]
     returnValue([pRabi,pT1])
Пример #12
0
 def func(server, theta, alpha):
     dt = q['piLen']
     reqs = []
     for i in range(numPingPongs+1):
         q.xy = eh.mix(q,
             pfunc(-dt) +
             sum(pfunc(2*k*dt, alpha=alpha) - pfunc((2*k+1)*dt, alpha=alpha) for k in range(i)) +
             pfunc(2*i*dt, phase=theta*np.pi, alpha = alpha)
         )
         tm = 2*i*dt + dt/2.0
         q.z = eh.measurePulse(q, tm)
         q['readout'] = True
         reqs.append(runQubits(server, qubits, probs=[1], stats=stats))
     probs = yield FutureList(reqs)
     returnValue([p[0] for p in probs])
Пример #13
0
 def func(server, curramp):
     alg = gc.Algorithm(devs)
     q0 = alg.q0
     alg[LZ_gate([q0], amp=curramp)]
     alg[gates.Wait([q0], 0 * ns)]
     alg[gates.PiPulse([q0])]
     alg[gates.Readout([q0])]
     alg.compile()
     data = yield runQubits(server, alg.agents, stats, dataFormat='iqRaw')
     if dataFormat == 'Amp':
         mag, ang = readout.iqToPolar(readout.parseDataFormat(data, 'iq'))
     else:
         data = readout.parseDataFormat(data, 'iq')
         mag, ang = data[0], data[1]
     returnValue([mag, ang])
Пример #14
0
 def func(server, delay):
     reqs=[]
     dt=q['piLen']
     tpi = dt/2.0 + delay/2.0
     tProbe = dt/2.0 + delay + dt/2.0
     tMeas = tProbe + dt/2.0
     piPhase = 2*np.pi*df[GHz]*delay[ns]/2.0
     for tomoPhase in tomoPhases.keys():
         q.xy = eh.mix(q, pump +
                         eh.piPulse(q, tpi, phase=piPhase) + 
                         probe(tProbe, tomoPhase))
         q.z = eh.measurePulse(q, tMeas)
         reqs.append(runQubits(server, qubits, stats, probs=[1]))
     probs = yield FutureList(reqs)
     data = [p[0] for p in probs]
     returnValue(data)
Пример #15
0
 def func(server, len):
     reqs = []
     for measQubit in measure:
         for numQubit in measure:
             qubits[numQubit]['readout'] = False
             qubits[numQubit]['z'] = env.NOTHING
         qubits[measQubit]['readout'] = True
         qD['f10'] = qubits[measQubit]['f10']
         if measQubit == drive:
             qD['f10'] = fD
         qD.xy = eh.mix(qD, env.flattop(0, len, w=qD['piFWHM'], amp=amp))
         qubits[measQubit]['z'] = eh.measurePulse(qubits[measQubit], len+qD['piLen']/2.0)
         reqs.append(runQubits(server, qubits, stats, probs=[1]))
     probs = yield FutureList(reqs)
     problist = [p[0] for p in probs]
     returnValue(problist)
Пример #16
0
 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])
Пример #17
0
 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])
Пример #18
0
 def __call__(self, server, qubits, t, **kw):
     """Tomographic measurement."""
     dt = max(q['piLen'] for q in qubits)
     tp = t + dt # TODO this timing might be overly conservative
     tm = t + 2*dt
     
     measureFunc = measurement.null if self.null else measurement.simult
     
     def addRotation(q, rot):
         """Add rotation pulse to a single qubit."""
         if rot is None:
             return q
         angle, axis = rot
         phase = axis + q['tomoPhase']
         pulse = eh.mix(q, eh.rotPulse(q, tp, angle=angle, phase=phase))
         return q.where(xy=q.get('xy', env.NOTHING) + pulse)
     
     def rotateAndMeasure(rotations):
         """Rotate all qubits and then measure them."""
         rotated = [addRotation(q, rot) for q, rot in zip(qubits, rotations)]
         return measureFunc(server, rotated, tm, self.measure, **kw)
     
     I = None # no rotation
     XA, YA = self.basisA
     XB, YB = self.basisB
     XC, YC = self.basisC
     
     rots = [(I, I, I), (XA, XB, XC), (YA, YB, XC), (YA, XB, YC), (XA, YB, YC)]
     
     futures = [rotateAndMeasure(rot) for rot in rots]
     Piii, Pxxx, Pyyx, Pyxy, Pxyy = yield FutureList(futures)
     
     # compute anticorrelations
     indices = [int(i,2) for i in ('000', '011', '101', '110')]
     Axxx = sum(Pxxx[indices])
     Ayyx = sum(Pyyx[indices])
     Ayxy = sum(Pyxy[indices])
     Axyy = sum(Pxyy[indices])
     
     G = Axxx - Ayyx - Ayxy - Axyy
     
     returnValue(np.hstack((Piii, Pxxx, Pyyx, Pyxy, Pxyy, [Axxx, Ayyx, Ayxy, Axyy, G])))
Пример #19
0
 def func(server,tunnelQubit):
     reqs = []
     for measQubit in measure:
         for numQubit in measure:
             qubits[numQubit]['readout'] = False
             qubits[numQubit]['z'] = env.NOTHING
         qubits[measQubit]['readout'] = True
         qt = qubits[tunnelQubit]
         qt['measureAmp'] = mpas[measure.index(tunnelQubit)]
         qt['readout'] = True
         if measQubit == tunnelQubit:
             probNum = 1
         else:
             probNum = 3
         reqs.append(runQubits(server, qubits, stats, probs=[probNum]))
         qt['z'] = eh.measurePulse(qt, 0*ns, state=1)
         reqs.append(runQubits(server, qubits, stats, probs=[probNum]))
     probs = yield FutureList(reqs)
     probdiff = [probs[2*q+1][0]-probs[2*q][0] for q in range(len(measure))]        
     returnValue(probdiff)
Пример #20
0
    def func(server, iteration):
        for q in devices:
            q['xy']=[]
            q['z']=[]
        for q in devices:
            for tomoPhase in ['+X','+Y','-X','-Y']:
                q['xy'].append(eh.mix(q, pump + probe(holdTime, tomoPhase=tomoPhase)))
                q['z'].append(eh.measurePulse(q,holdTime+(q['piLen']/2.0)))
                q['xy'],q['indices'] = shuffle(q['xy'])
                q['readout']=True
        #Arrange timing
        iteration += skips[0]
        if start[0] is None:
            start[0] = time.clock()
            nextTime = 0
        else:
            elapsed = time.clock() - start[0]
            nextIteration = int(math.ceil(elapsed / ts))
            if nextIteration > iteration + 1: #Should be nextIteration > iteration + 1
                # oops, we missed some datapoints :-(
                skips[0] += nextIteration - (iteration + 1)
                print 'skip!  skips = %d/%d (%g%%)' % (skips[0], iteration, 100*skips[0]/iteration)
            #Hang out until it's time to fire off the next iteration
            nextTime = nextIteration * ts
            wait = nextTime - (time.clock() - start[0])
            if wait > 0:
                waits[0] += wait
                waits[1] += 1
                avg = waits[0] / waits[1]
                pct = avg / ts
                print 'average wait: %g = %g%% of timeStep' % (avg, 100*pct)
                time.sleep(wait)

        tomoAxes = yield runInterlacedSRAM(server, qubits, stats, separate=True)
        data=[]
        for i,q in enumerate(devices):
            data += unshuffle([tomoAxes[ax][i] for ax in range(4)],q['indices'])
        #data = [iteration] + [tomoAxes[axis][q] for q in range(len(devices)) for axis in range(4)] + [nextTime]
        data = [iteration] + data + [nextTime]
        returnValue(data)
Пример #21
0
    def func(iteration):
        seqs = []
        for tomoPhase in ['+X','+Y','-X','-Y']: #Run through tomo axes
            for m in measure: #Set up the sequence for each qubit for this tomography axis
                qubits[m]._xy = eh.mix(qubits[m], pump(qubits[m]) + probe(qubits[m], holdTime, tomoPhase = tomoPhase))
                qubits[m]._z  = eh.mix(qubits[m],holdTime+20*ns)
            seqs += [Seq(qubits,stats,separate=True)] #Add that axis to the list of sequences to run
        #Timing. Wait until next sequence should be run.
        nextIteration = iteration+1
        while time.clock()>=nextIteration*ts:
            nextIteration+=2
        #Hang out until it's time to fire off the next iteration
        t = time.clock()
        nextTime = nextIteration * ts
        time.sleep(nextTime - t)

        tomoAxes = yield seqs  #tomoAxes is a list of four lists, one for each tomo axis (ie. sequence)
                            #Each of these four lists has three elements [Pq0, Pq1, Pq2], for the prob that each qubit
                            #switched (ie. was in the |1> state).
        data = [iteration] + [tomoAxes[axis][qubit] for qubit in measure for axis in range(4)] + [nextTime]
        #data = [iteration] + [p[0] for p in probs]+[nextTime]
        returnValue(data)
Пример #22
0
    def func(server,time):
        reqs = []
        qR['readout'] = True
        for q in qubits:
            q['z'] = env.NOTHING
        qR['z'] += eh.measurePulse(qR, 0*ns, state=1)
#        probNum = 1+int(readout<tunnel)
        if correctZ:
            eh.correctCrosstalkZ(qubits)
        reqs.append(runQubits(server, qubits, stats, probs=[1]))
        for q in qubits:
            q['z'] = env.NOTHING
        if time<0:
            t = -time
        else:
            t = 0*ns
        qT['z'] += eh.measurePulse(qT, t, state=1)
        qR['z'] += eh.measurePulse(qR, t+time, state=1)
        if correctZ:
            eh.correctCrosstalkZ(qubits)
        reqs.append(runQubits(server, qubits, stats, probs=[1]))
        probs = yield FutureList(reqs)
        probdiff = [p[0] for p in probs]
        returnValue(probdiff)
Пример #23
0
 def func(server,arg):
     result = yield runQubits(server, qubits, stats, dataFormat = 'phases')
     returnValue(np.vstack(result).T)