def ramsey_oscilloscope_noInterlace(s, measure=0, holdTime = 100*ns, fringeFreq = 50*MHz, timeStep = 1*sec, stats=600, name='RamseyScope', save = True): sample, qubits = util.loadQubits(s) q = qubits[measure] #Set up datavault axes = [('iteration','')] deps = [('Probability', '+X', ''),('Probability', '+Y', ''), ('Probability', '-X', ''),('Probability', '-Y', ''),('time', 't', 'sec')] kw={'stats': stats,'holdTime': holdTime,'fringeFrequency': fringeFreq,'timeStep':timeStep} dataset = sweeps.prepDataset(sample, name, axes, deps, measure=measure, kw=kw) def iterations(): i = 0 while True: yield i i += 1 tomoPhases = {'+X': 0.0, '+Y': 0.25, '-X': -0.5, '-Y': -0.25} #[+X, +Y, -X, -Y] in CYCLES pump = eh.piHalfPulseHD(q, 0, phase=0.0) def probe(time, tomoPhase): return eh.piHalfPulse(q, time, phase = 2.0*np.pi*(fringeFreq['GHz']*time['ns']+tomoPhases[tomoPhase])) start = [None] skips = [0] # number of data points that have been skipped waits = [0, 0] ts = timeStep['s'] q['readout'] = True 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+(q['piLen']/2.0)) reqs.append(runQubits(s._cxn.qubit_sequencer, qubits, stats, dataFormat='probs', 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) pX, pY, pmX, pmY = yield FutureList(reqs) data = [iteration] + [pX[0], pY[0], pmX[0], pmY[0]] + [nextTime] returnValue(data) sweeps.run(func, iterations(), save, dataset, pipesize=2)
def pingPong(s, theta=st.r[-0.25:1.75:0.01], alpha = 0.5, measure=0, numPingPongs=1, stats=900, useHD=True, name='PingPong MQ', save=True, collect=False, noisy=True, analyze=False): sample, qubits = util.loadQubits(s) q = qubits[measure] name = '%s useHD=%d nPulses=%d' % (name, useHD, numPingPongs) axes = [(theta, '2nd pulse phase (divided by pi)'),(alpha, 'alpha')] deps = [('Probability', '%d identities' % i, '') for i in range(numPingPongs+1)] kw = {'stats': stats, 'useHD': useHD, 'numPingPongs': numPingPongs} dataset = sweeps.prepDataset(sample, name, axes, dependents=deps, measure=measure, kw=kw) if useHD: def pfunc(t0, phase=0, alpha=0.5): return eh.piHalfPulseHD(q, t0, phase=phase, alpha=alpha) else: def pfunc(t0, phase=0, alpha=0.0): #The alpha parameter is just there for call signature compatibility. I know this is stupid. Sorry. DTS return env.gaussian(t0, q['piFWHM'], amp=q['piAmp']/2.0, phase=phase) 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]) return sweeps.grid(func, axes, dataset=save and dataset, collect=collect, noisy=noisy)
def ghz_simult_tomo_optimizer(sample, stats=1200, retune=None): sample, qubits = util.loadQubits(sample) axes = [('iteration', '')] measure = measurement.TomoNull(3) deps = [('initial phase', '0', ''), # phase of first pulse ('initial phase', '1', ''), ('initial phase', '2', ''), ('swap dphase', '0', ''), # delta phase change ('swap dphase', '1', ''), ('swap dphase', '2', ''), ('final phase', '0', ''), # phase of final pulse ('final phase', '1', ''), ('final phase', '2', '')] deps += measure.dependents() deps += [('fidelity', 'GHZ', '')] kw = { 'stats': stats, } dataset = sweeps.prepDataset(sample, 'Tomo optimization', axes, dependents=deps, measure=measure, kw=kw) def func(server, stage, delay, i0, i1, i2, d0, d1, d2, f0, f1, f2): if retune == 'freq': for i in range(3): mq.freqtuner(sample, measure=i, noisy=False) qubits[0]['uwavePhase'] = None #phase0 qubits[2]['uwavePhase'] = None #phase2 qubits[0]['swapDphase'] = None #dphase0 qubits[2]['swapDphase'] = None #dphase2 qs, tm = seq_ghz_simult(qubits, delay, stage) return measurement.do(measure, server, qs, tm, stats=stats) with pyle.QubitSequencer() as server: with dataset as ds: def optimfunc(x): print 'measuring tomography...' data = func(server, 3, 0*ns, *x) print 'done.' print print 'calculating physical density matrix...' f0s = [q['measureF0'] for q in qubits] f1s = [q['measureF1'] for q in qubits] Us = pyle.tomo._qst_transforms['tomo3'][0] F = werner.Fxtf(3, f0s, f1s) rho = pyle.tomo.qst_mle(data, Us, F) overlap = pyle.overlap(rho, werner.rhoG) print 'done.' print 'overlap =', overlap print ds.add(np.hstack((x, data, [overlap])))
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
def visibility(sample, mpa=st.r[0:2:0.05], stats=300, measure=0, save=True, name='Visibility MQ', collect=True, update=False, noisy=True): sample, qubits = util.loadQubits(sample) q = qubits[measure] axes = [(mpa, 'Measure pulse amplitude')] deps = [('Probability', '|0>', ''), ('Probability', '|1>', ''), ('Visibility', '|1> - |0>', ''), ('Probability', '|2>', ''), ('Visibility', '|2> - |1>', '') ] kw = {'stats': stats} dataset = sweeps.prepDataset(sample, name, axes, deps, measure=measure, kw=kw) 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]) return sweeps.grid(func, axes, dataset=save and dataset, collect=collect, noisy=noisy)
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
def pingPongFrac(s, phase=st.r[-0.125:0.875:0.02], alphas=st.r[0.4:0.6:0.005], angle=np.pi/2.0, measure=0, numPulses=1, stats=1200, useHD=True, name='PingPongVsAlpha', save=True, collect=False, noisy=True, message=False): sample, qubits = util.loadQubits(s) q = qubits[measure] name = '%s useHD=%d nPulses=%d' % (name, useHD, numPulses) axes = [(phase, '2nd pulse phase'),(alphas, 'drag alpha')] deps = [('Probability', '%d pseudo-identities' %numPulses, '')] kw = {'stats': stats, 'useHD': useHD, 'nPulses': numPulses} dataset = sweeps.prepDataset(sample, name, axes, dependents=deps, measure=measure, kw=kw) if useHD: def pfunc(t0, angle, phase=0, alpha=0.5): return eh.rotPulseHD(q, t0, angle, phase=phase, alpha=alpha) else: def pfunc(t0, phase=0): return env.gaussian(t0, q['piFWHM'], amp=q['piAmp']/2.0, phase=phase) def func(server, currPhase, currAlpha): dt = q['piLen'] n = numPulses q.xy = eh.mix(q, pfunc(-dt, angle, alpha=currAlpha) + sum(pfunc(2*k*dt, angle, alpha=currAlpha) - pfunc((2*k+1)*dt, angle, alpha=currAlpha) for k in range(n)) + pfunc(2*n*dt, angle, alpha=currAlpha, phase=2*np.pi*currPhase) ) tm = 2*n*dt + dt/2.0 q.z = eh.measurePulse(q, tm) q['readout'] = True return runQubits(server, qubits, probs=[1], stats=stats) data = sweeps.grid(func, axes, dataset=save and dataset, collect=collect, noisy=noisy) if message: s._cxn.telecomm_server.send_sms('scan done','Scan %s has finished.' %name, s._dir[1]) if collect: return data
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
def lztest_amp(Sample, measure=0, amp=st.r[0:1:0.02], stats=1200, name='lz amp test', dataFormat='Amp', save=True, noisy=True): sample, devs, qubits = gc.loadQubits(Sample, measure=measure) axes = [(amp, "swiphtAmp")] if dataFormat == 'Amp': deps = [("Mag", "", ""), ("Phase", "", "")] else: deps = [("I", "", ""), ("Q", "", "")] kw = {'stats': stats} dataset = sweeps.prepDataset(sample, name, axes, deps, measure, kw=kw) 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]) data = sweeps.grid(func, axes=axes, save=save, dataset=dataset, noisy=noisy) return data
def randomNums(s, measure, mpa, repsPerFile, delay=4*ns, stats=300, name='Random Numbers', save=True, collect=False, noisy=False): """Generate a string of random numbers by measuring a state on the equator""" sample, qubits, Qubits = util.loadQubits(s,write_access=True) q = qubits[measure] Q = Qubits[measure] q['measureAmp'] = mpa q['readout'] = True q.z = eh.measurePulse(q, 0) iterations = st.r[0:repsPerFile:1] axes = [(iterations, 'iteration')] deps = [('Tunnelled','','')] kw = {} dataset = sweeps.prepDataset(sample, name, axes, deps, measure=measure, kw=kw) def func(server,arg): result = yield runQubits(server, qubits, stats, dataFormat = 'phases') returnValue(np.vstack(result).T) data = sweeps.grid(func, axes, save=save, dataset=save and dataset, noisy=noisy, collect=collect) if collect: return data
return overshoot, plen*ns def uwave_phase_adjust(sample, phase=0, t0=None, t_couple=st.r[0:200:1,ns], adjust=0, ref=1, zpas=None, stats=3000L, name='uwave-phase cal', save=True, collect=True, noisy=True): sample, qubits = util.loadQubits(sample) axes = [(phase, 'uw phase %d' % adjust), (t_couple, 'Coupling time')] measure = measurement.Null(len(qubits), [adjust, ref]) # do xtalk-free measurement kw = { 'stats': stats, 'adjust phase': adjust, 'reference phase': ref, 'zpas': zpas, } dataset = sweeps.prepDataset(sample, name, axes, measure=measure, kw=kw) def func(server, phase, t_couple): dt = max(q['piLen'] for q in qubits) if t0 is None: tp0 = 0 tz = dt/2 else: tp0 = t0 - dt/2 tz = t0 tm = tz + t_couple + dt/2 for i, (q, zpa) in enumerate(zip(qubits, zpas)): q['uwavePhase'] = 0 # turn off automatic phase correction if i == adjust:
from pyle.dataking import squid from pyle.dataking.fpgaseq import runQubits from pyle.util import sweeptools as st from pyle.analysis import entanglementAnalysis as et from pyle.plotting import dstools #import pdb def iSwap(sample, swapLen=st.r[-20:1000:1,ns], measure=[0,1], stats=1500L, name='iSwap MQ', save=True, collect=False, noisy=True): sample, qubits = util.loadQubits(sample) q0 = qubits[measure[0]] q1 = qubits[measure[1]] #nameEx = [' q0->q1',' q1->q0'] axes = [(swapLen, 'swap pulse length')] kw = {'stats': stats} dataset = sweeps.prepDataset(sample, name, axes, measure=measure, kw=kw)#+nameEx[measure[0]] def func(server, curr): start = 0 q0.xy = eh.mix(q0, eh.piPulseHD(q0, start)) start += q0['piLen']/2 q0.z = env.rect(start, curr, q0.cZControlAmp)#amplitude for an iSWAP start += q0.cZControlLen+curr q1.z = env.rect(start, q1.cZControlLen, q1.cZControlAmp)#amplitude & length for an iSWAP start += q1.cZControlLen q0.z += eh.measurePulse(q0, start) q1.z += eh.measurePulse(q1, start) q0['readout'] = True q1['readout'] = True return runQubits(server, qubits, stats=stats)
swapAmp = new print 'New swap amplitude is ', swapAmp return swapLen, swapAmp def swap10(sample, swapLen=st.arangePQ(0,200,4,ns), swapAmp=np.arange(-0.05,0.05,0.002), measure=0, stats=600L, name='Q10-resonator swap MQ', save=True, collect=False, noisy=True): sample, qubits = util.loadQubits(sample) q = qubits[measure] if swapAmp is None: swapAmp = q.swapAmp axes = [(swapAmp, 'swap pulse amplitude'), (swapLen, 'swap pulse length')] kw = {'stats': stats} dataset = sweeps.prepDataset(sample, name, axes, measure=measure, kw=kw) def func(server, currAmp, currLen): q.xy = eh.mix(q, eh.piPulseHD(q, 0)) q.z = env.rect(q['piLen']/2, currLen, currAmp) + eh.measurePulse(q, q['piLen']/2 + currLen) q['readout'] = True return runQubits(server, qubits, stats=stats, probs=[1]) return sweeps.grid(func, axes, save=save, dataset=dataset, collect=collect, noisy=noisy) def swap21tuner(sample, swapLen=None, swapAmp=None, paraName='C', iteration=3, measure=0, stats=600L, name='Q21-resonator swap tuner MQ', save=False, noisy=True): sample, qubits = util.loadQubits(sample) q = qubits[measure] if swapAmp is None:
def ramsey_correlator_shuffled(sample, holdTime = 100*ns, fringeFreq = 50*MHz, timeStep = 1*sec, stats=600, measure=None, name='RamseyCorrelateShuffled', save = True): if measure is None: raise Exception('Choose qubits to correlate') M = len(measure) sample, qubits = util.loadQubits(sample) for m in measure: qubits[m]['readout'] = True def iterations(): i=0 while True: yield i i+=1 params = [('iteration', '')] dependents = [('Probability', '+X0', ''),('Probability', '+Y0', ''), ('Probability', '-X0', ''),('Probability', '-Y0', ''), ('Probability', '+X1', ''),('Probability', '+Y1', ''), ('Probability', '-X1', ''),('Probability', '-Y1', ''),('time', 't', 'sec')] dataset = sweeps.prepDataset(sample, name, params, dependents=dependents, kw={'stats': stats,'holdTime': holdTime, 'fringeFrequency': fringeFreq,'timeStep':timeStep}) tomoPhases = {'+X': 0.0, '+Y': 0.25, '-X': -0.5, '-Y': -0.25} #[+X, +Y, -X, -Y] in CYCLES def pump(qubit): return pi_half_pulse(qubit,0,phase=0.0) def probe(qubit, time, tomoPhase): return pi_half_pulse(qubit, time, phase = 2*pi*(fringeFreq['GHz']*time['ns']+tomoPhases[tomoPhase])) ts = timeStep['s'] 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) run(func, iterations(), save, ds_info, pipesize=2)
def ramseyCorrelate(sample, measure, holdTime = 100*ns, fringeFreq = 50*MHz, timeStep = 1*sec, stats=600, name='RamseyScope', save = True): raise Exception('Make XY shuffled') sample, qubits = util.loadQubits(sample) devices = [qubits[m] for m in measure] raise Exception('Check that SQUID delays are ok') #Set up datavault axes = [('iteration','')] deps = [('Probability', '+X0', ''),('Probability', '+Y0', ''), ('Probability', '-X0', ''),('Probability', '-Y0', ''), ('Probability', '+X1', ''),('Probability', '+Y0', ''), ('Probability', '-X1', ''),('Probability', '-Y0', ''), ('time', 't', 'sec')] kw={'stats': stats,'holdTime': holdTime,'fringeFrequency': fringeFreq,'timeStep':timeStep} dataset = sweeps.prepDataset(sample, name, axes, deps, measure=measure, kw=kw) def iterations(): i = 0 while True: yield i i += 1 tomoPhases = {'+X': 0.0, '+Y': 0.25, '-X': -0.5, '-Y': -0.25} #[+X, +Y, -X, -Y] in CYCLES def pump(q): return eh.piHalfPulseHD(q, 0, phase=0.0) def probe(q, time, tomoPhase): return eh.piHalfPulse(q, time, phase = 2.0*np.pi*(fringeFreq['GHz']*time['ns']+tomoPhases[tomoPhase])) start = [None] skips = [0] # number of data points that have been skipped waits = [0, 0] ts = timeStep['s'] 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) sweeps.run(func, iterations(), save, dataset, pipesize=2)