def spectroscopy(qubit,frequencies,data = None,ntimes = 20,amplitude = 0.1,variable = "p1x",measureAtReadout = False,delay = 0,f_sb = 0,measure20 = True): if data == None: data = Datacube() if measureAtReadout: data.setName("Spectroscopy at Readout - %s" % qubit.name()) else: data.setName("Spectroscopy - %s" % qubit.name()) measureSpectroscopy(qubit = qubit,frequencies = frequencies,data = data,amplitude = amplitude,measureAtReadout = measureAtReadout,delay = delay,f_sb = f_sb) (params,rsquare) = fitQubitFrequency(data,variable) if measureAtReadout: qubit.parameters()["frequencies.readout.f01"] = params[1] else: qubit.parameters()["frequencies.f01"] = params[1] qubit.setDriveFrequency(params[1]) data.setName(data.name()+ " - f01 = %g GHz" % params[1]) if not measureAtReadout: if measure20: data02 = Datacube("Spectroscopy of (0->2)_2 transition") data.addChild(data02) frequencies02 = arange(params[1]-0.2,params[1]-0.05,0.001) measureSpectroscopy(qubit = qubit,frequencies = frequencies02,data = data02,amplitude = amplitude*10.0,measureAtReadout = measureAtReadout,delay = delay,f_sb = f_sb) (params02,rsquare02) = fitQubitFrequency(data02,variable) qubit.parameters()["frequencies.f02"] = params02[1]*2.0 data.setName(data.name()+" - f02_2 = %g GHz" % params02[1]) data.savetxt() return data
def spectroscopy(qubit,frequencies,data = None,ntimes = 20,amplitude = 0.1,variable = "p1x",measureAtReadout = False,delay = 0,f_sb = 0,measure20 = True,fitFrequency = True,factor20 = 10.0,delayAtReadout = 1500,saveData = True,pulseLength = 500,gaussian=True): f_drive = qubit.driveFrequency() try: if data == None: data = Datacube() if measureAtReadout: data.setName("Spectroscopy at Readout - %s" % qubit.name()) else: data.setName("Spectroscopy - %s" % qubit.name()) data.parameters()["defaultPlot"]=[["f",variable]] measureSpectroscopy(qubit = qubit,frequencies = frequencies,data = data,amplitude = amplitude,measureAtReadout = measureAtReadout,delay = delay,f_sb = f_sb,delayAtReadout = delayAtReadout,pulseLength = pulseLength,gaussian=gaussian) if fitFrequency: (params,rsquare) = fitQubitFrequency(data,variable) if measureAtReadout: varname01 = "frequencies.readout.f01" else: varname01 = "frequencies.f01" if rsquare > 0.6: print params[1] qubit.parameters()[varname01] = params[1] data.setName(data.name()+ " - f01 = %g GHz" % qubit.parameters()[varname01]) else: print "No peak found..." data.savetxt() return data if measure20: data02 = Datacube("Spectroscopy of (0->2)_2 transition") data.addChild(data02) frequencies02 = arange(params[1]-0.18,params[1]-0.05,0.001) data02.parameters()["defaultPlot"]=[["f",variable]] measureSpectroscopy(qubit = qubit,frequencies = frequencies02,data = data02,amplitude = amplitude*factor20,measureAtReadout = measureAtReadout,delay = delay,f_sb = f_sb,delayAtReadout = delayAtReadout,pulseLength = pulseLength,gaussian=gaussian) (params02,rsquare02) = fitQubitFrequency(data02,variable) if rsquare02 > 0.5 and params[0] > 0.2: if measureAtReadout: varname02 = "frequencies.readout.f02" varname12 = "frequencies.readout.f12" else: varname02 = "frequencies.f02" varname12 = "frequencies.f12" qubit.parameters()[varname02] = params02[1]*2.0 qubit.parameters()[varname12] = params02[1]*2.0-qubit.parameters()[varname01] data.setName(data.name()+" - f02_2 = %g GHz" % (qubit.parameters()[varname02]/2)) if saveData: data.savetxt() return data finally: try: qubit.setDriveFrequency(f_drive) except: pass
def T1(qubit,delays,data = None,averaging = 20,variable = "p1x"): if data == None: data = Datacube() data.setName("T1 - " + qubit.name()) data.setParameters(instrumentManager.parameters()) try: for delay in delays: qubit.loadRabiPulse(phase = math.pi,readout = qubit.parameters()["timing.readout"],delay = delay) acqiris.bifurcationMap(ntimes = averaging) data.set(delay = delay) data.set(**acqiris.Psw()) data.commit() finally: params = fitT1Parameters(data,variable) data.setName(data.name()+" - T1 = %g ns " % params[2]) qubit.parameters()["relaxation.t1"] = params[2] data.savetxt() return data
def measureSpectroscopy(qubit,frequencies,data = None,ntimes = 20,amplitude = 0.1,variable = "p1x"): if data == None: data = Datacube() data.setName("Spectroscopy - %s" % qubit.name()) qubit.loadRabiPulse(length = 500,readout = qubit.parameters()["timing.readout"],f_sb = 0) qubit.turnOnDrive() data.setParameters(instrumentManager.parameters()) try: for f in frequencies: qubit.setDriveFrequency(f) qubit.setDriveAmplitude(I = amplitude,Q = amplitude) acqiris.bifurcationMap(ntimes = ntimes) data.set(f = f) data.set(**acqiris.Psw()) data.commit() finally: (params,rsquare) = fitQubitFrequency(data,variable) qubit.parameters()["frequencies.f01"] = params[1] qubit.setDriveFrequency(params[1]) data.setName(data.name()+" - f01 = %g GHz" % params[1]) data.savetxt() return spectroData
def T1precis(qubit,delays,data = None,averaging = 20,variable = "p1x"): print "starting T1precis..." if data == None: data = Datacube() data.setName("T1 - " + qubit.name()) data.setParameters(instrumentManager.parameters()) data.parameters()["defaultPlot"]=[["delay",variable]] highTdelays=arange(2500,2600,5) try: for delay in highTdelays: qubit.loadRabiPulse(phase = math.pi,readout = qubit.parameters()["timing.readout"],delay = delay) acqiris.bifurcationMap(ntimes = averaging) data.set(delay=delay) data.set(**acqiris.Psw()) data.commit() highTvalue=data.ColumnMean(variable) highTValueFound=True print "Long time ps=",highTvalue except: highTValueFound=False raise try: for delay in delays: qubit.loadRabiPulse(phase = math.pi,readout = qubit.parameters()["timing.readout"],delay = delay) acqiris.bifurcationMap(ntimes = averaging) data.set(delay=delay) data.set(**acqiris.Psw()) data.commit() finally: if highTValueFound: print "calling fitT1Parametersprecis" params = fitT1Parametersprecis(data,variable,highTvalue) else: params = fitT1Parameters(data,variable) data.setName(data.name()+" - T1 = %g ns " % params[1]) qubit.parameters()["relaxation.t1"] = params[1] data.savetxt() return data
def T1(qubit,delays,data = None,averaging = 20,variable = "p1x",gaussian = True,saveData = True,state=1): if data == None: data = Datacube() data.setName("T1 - " + qubit.name()+" - state "+str(state)) data.setParameters(instrumentManager.parameters()) data.parameters()["defaultPlot"]=[["delay",variable]] try: for delay in delays: if state==2: loadPi012Pulse(qubit,delay=delay) else: qubit.loadRabiPulse(phase = math.pi,delay = delay,gaussian = gaussian) acqiris.bifurcationMap(ntimes = averaging) data.set(delay = delay) data.set(**acqiris.Psw()) data.commit() finally: params = fitT1Parameters(data,variable) data.setName(data.name()+" - T1 = %g ns " % params[2]) qubit.parameters()["relaxation.t1_%d" % state] = params[2] if saveData: data.savetxt() return data
def sCurves(jba,qubit = None,variable = "p1x",data = None,ntimes = 20,s2=False,optimize = "v10",step = 0.01,measureErrors = False,saveData = True,voltageBounds = None,**kwargs): """ Measures the s curves of the JBA. Assumes that the qubit is alread preset to a pi-pulse. """ def getVoltageBounds(v0,jba,variable,ntimes): v = v0 jba.setVoltage(v) acqiris.bifurcationMap(ntimes = ntimes) p = acqiris.Psw()[variable] while p > 0.03 and v < v0*2.0: v*=1.1 jba.setVoltage(v) acqiris.bifurcationMap() p = acqiris.Psw()[variable] vmax = v v = v0 jba.setVoltage(v) acqiris.bifurcationMap(ntimes = ntimes) p = acqiris.Psw()[variable] while p < 0.98 and v > v0/2.0: v/=1.1 jba.setVoltage(v) acqiris.bifurcationMap() p = acqiris.Psw()[variable] vmin = v return (vmin*0.95,vmax*1.1) hasFinished = False try: data.setParameters(instrumentManager.parameters()) v0 = jba.voltage() if data == None: sData = Datacube() else: sData = data if sData.name() == "datacube": if not qubit == None: sData.setName("S curves - %s" % qubit.name()) s0 = Datacube("S0") s1 = Datacube("S1") sData.addChild(s0) sData.addChild(s1) s0.parameters()["defaultPlot"]=[["v",variable]] s1.parameters()["defaultPlot"]=[["v",variable]] s1.parameters()["defaultPlot"].append(["v","contrast10"]) else: sData.setName("S curve - %s" % jba.name()) sData.parameters()["defaultPlot"]=[["v",variable]] error=False if not qubit == None: qubit.turnOnDrive() qubit.loadRabiPulse(length = 0) if voltageBounds == None: (vmin,vmax) = getVoltageBounds(v0,jba,variable,ntimes) else: (vmin,vmax) = voltageBound print vmin,vmax if qubit == None: measureSingleS(voltages = arange(vmin,vmax,step),data = sData,jba = jba,ntimes = ntimes) return else: measureSingleS(voltages = arange(vmin,vmax,step),data = s0,jba = jba,ntimes = ntimes) qubit.loadRabiPulse(phase = math.pi,**kwargs) measureSingleS(voltages = arange(vmin,vmax,step),data = s1,jba = jba,ntimes = ntimes) failed12 = False if s2: try: s2 = Datacube("S2") s2.parameters()["defaultPlot"]=[["v",variable]] sData.addChild(s2) loadPi012Pulse(qubit) measureSingleS(voltages = arange(vmin,vmax,step),data = s2,jba = jba,ntimes = ntimes) s1.createColumn("contrast20",s2.column(variable)-s0.column(variable)) s1.createColumn("contrast21",s2.column(variable)-s1.column(variable)) s1.parameters()["defaultPlot"].extend([["v","contrast20"],["v","contrast21"]]) qubit.parameters()["readout.v20"] = float(s1.column("v")[argmax(s1.column("contrast20"))]) qubit.parameters()["readout.v21"] = float(s1.column("v")[argmax(s1.column("contrast21"))]) qubit.parameters()["readout.contrast20"] = float(s1.column("contrast20")[argmax(s1.column("contrast20"))]) qubit.parameters()["readout.contrast21"] = float(s1.column("contrast21")[argmax(s1.column("contrast21"))]) data.setName(data.name()+" - v20 = %g" % qubit.parameters()["readout.contrast20"]) data.setName(data.name()+" - v21 = %g" % qubit.parameters()["readout.contrast21"]) except: failed12 = True raise else: failed12=True s1.createColumn("contrast10",s1.column(variable)-s0.column(variable)) s1.parameters()["defaultPlot"].append(["v",variable]) qubit.parameters()["readout.v10"] = float(s1.column("v")[argmax(s1.column("contrast10"))]) qubit.parameters()["readout.contrast10"] = float(s1.column("contrast10")[argmax(s1.column("contrast10"))]) data.setName(data.name()+" - v10 = %g" % qubit.parameters()["readout.contrast10"]) if optimize == "v21" or optimize == 'v20': qubit.parameters()["readout.use12"] = True else: qubit.parameters()["readout.use12"] = False if optimize == "v20" and not failed12: imax = argmax(s1.column("contrast20")) v0 = s1.column("v")[imax] elif optimize == "v21" and not failed12: imax = argmax(s1.column("contrast21")) v0 = s1.column("v")[imax] else: imax = argmax(s1.column("contrast10")) v0 = s1.column("v")[imax] hasFinished = True return (sData,v0) finally: jba.setVoltage(v0) if hasFinished: if optimize == 'v20': loadPi012Pulse(qubit) else: qubit.loadRabiPulse(phase = math.pi) if measureErrors: qubit.turnOnDrive() qubit.loadRabiPulse(phase=0) acqiris.bifurcationMap(ntimes = 1000) qubit.parameters()["readout.p00"] = float(1.0-acqiris.Psw()[variable]) if optimize == 'v10': qubit.loadRabiPulse(phase=math.pi) else: loadPi012Pulse(qubit) acqiris.bifurcationMap(ntimes = 1000) qubit.parameters()["readout.p11"] = float(acqiris.Psw()[variable]) if saveData: data.savetxt()
qubit.loadWaveform(seq.getWaveform(endAt = qubit.parameters()["timing.readout"]),readout = qubit.parameters()["timing.readout"]) if callback != None: callback(duration) acqiris.bifurcationMap(ntimes = averaging) data.set(duration = duration) data.set(**acqiris.Psw()) data.commit() except: traceback.print_exc() finally: if amplitude != 0: qubit.popState() (params,rsquare) = fitRamseyFrequency(data,variable,f_offset=f_offset) if rsquare > 0.5: qubit.parameters()["pulses.ramsey.t_pi"] = params[1]/2.0 data.setName(data.name()+" - f_r = %g MHz - T_2 = %g ns" % ((1.0/params[1])*1000,params[2])) data.parameters()["ramseyFit"] = params f_correct = 1.0/params[1]-abs(f_offset) if correctFrequency and amplitude == 0 and f_correct < 0.05: print "Correcting qubit frequency by %g MHz" % (f_correct*1000) if 01 == transition or 02 == transition: qubit.parameters()["frequencies.f01"]-=f_correct elif 12 == transition: qubit.parameters()["frequencies.f12"]-=f_correct else: print "Ramsey fit is not good, resetting parameters..." qubit.parameters()["pulses.ramsey.t_pi"] = None if saveData: data.savetxt() return data