本文整理汇总了Python中pyview.lib.datacube.Datacube.addChild方法的典型用法代码示例。如果您正苦于以下问题:Python Datacube.addChild方法的具体用法?Python Datacube.addChild怎么用?Python Datacube.addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyview.lib.datacube.Datacube
的用法示例。
在下文中一共展示了Datacube.addChild方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: spectroscopy
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
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
示例2: findAnticrossing
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
def findAnticrossing(voltageRead, voltageWrite, searchRange1, searchRange2, cube=None):
if cube == None:
cube = Datacube()
spectro = Datacube()
spectro.setName("Qubit 1 Spectroscopy")
cube.addChild(spectro)
jba.calibrate()
params = getQubitFrequency(mwg, initialRange, variable, spectro)
示例3: spectroscopy
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
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
示例4: caractiseQubit
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
def caractiseQubit(self,data=None,frequencies=[8.5,9.5]):
if data==None:
data=Datacube('caracterisation %s'%self.name())
dataManager.addDatacube(data)
acqiris.setNLoops(1)
self._jba.calibrate(bounds=[2,3,25])
acqiris.setNLoops(10)
spectro=Datacube('spectro')
data.addChild(spectro)
self.measureSpectroscopy(fstart=frequencies[0],fstop=frequencies[1],fstep=0.002,power=-27.,data=spectro)
data.set(f01=self._f01)
rabi=Datacube('rabi')
data.addChild(rabi)
self.measureRabi(tstart=0,tstop=60,tstep=2.,data=rabi)
data.set(rabiPi=self._rabiDuration)
scurves=Datacube('sCurves')
data.addChild(scurves)
self.measureSCurves(data=scurves,ntimes=10)
t1=Datacube('t1')
data.addChild(t1)
self.measureT1(tstart=0,tstop=500,tstep=4,data=t1)
data.set(t1=self._t1)
frequencies=[self._f01-0.25,self._f01+0.05]
data.commit()
data.savetxt()
示例5: measureSCurves
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
def measureSCurves(self,ntimes=None,data=None):
if data==None:
if name==None:name='sCurves %s'%self.name()
data=Datacube(name)
dataManager.addDatacube(data)
self._pulseGenerator._MWSource.setPower(self._rabiPower)
self._pulseGenerator._MWSource.setFrequency(self._f01)
self._pulseGenerator.generatePulse(duration=self._rabiDuration,frequency=self._f01,DelayFromZero=register['repetitionPeriod']/2-self._rabiDuration-10,useCalibration=False)
self._pulseGenerator.sendPulse()
off=Datacube('sOff')
data.addChild(off)
self._pulseGenerator._MWSource.turnOff()
self._jba.measureSCurve(data=off,ntimes=10)
on=Datacube('sOn')
data.addChild(on)
self._pulseGenerator._MWSource.turnOn()
self._jba.measureSCurve(data=on,ntimes=10)
示例6: setUp
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
def setUp(self):
"""
We create all necessary directories and test datacubes for the IO tests.
"""
self.testCubes = dict()
rc = Datacube()
self.testCubes["real"] = rc
rc.setName("Datacube test: Real data")
rc.setParameters({"test":1,"array":[1,2,3,4],"hash":{"a":1,"b":2}})
for i in range(0,2):
rc.set(x = i,y = i*i, z = i*i*i,r = random.random())
child = Datacube()
child.setName("test {0:d}".format(i))
rc.addChild(child)
rc.commit()
for j in range(0,2):
child.set(x = j,t = j*2-j*j,r = random.random())
child.commit()
self.dataPath = os.path.normpath(os.path.dirname(__file__)+"/data")
if not os.path.exists(self.dataPath):
os.mkdir(self.dataPath)
cx = Datacube(dtype = numpy.complex128)
self.testCubes["complex"] = cx
rc.setName("Datacube test: Complex data")
rc.setParameters({"test":1,"array":[1,2,3,4],"hash":{"a":1,"b":2}})
for i in range(0,2):
cx.set(x = i,y = i*i*1j+4, z = i*i*i*1j,r = 1j*random.random())
child = Datacube(dtype = numpy.complex128)
child.setName("test {0:d}".format(i))
cx.addChild(child)
cx.commit()
for j in range(0,2):
child.set(x = j,t = j*2-j*j*1j,r = 1j*random.random())
child.commit()
示例7: caracteriseIQvsFvsP
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
def caracteriseIQvsFvsP(self,frequencies,voltages,data=None):
if data==None:
data=Datacube("JBA mapping")
dataManager.addDatacube(data)
try:
previousShape=self.shape
self.shape=zeros((20000),dtype = numpy.complex128)
self.shape[10000:10010]=linspace(0,1,10)
self.shape[10010:12100]=1
self.shape[12100:12110]=linspace(1,0,10)
# return self.shape
import scipy
pvsv=Datacube("power")
data.addChild(pvsv)
for v in voltages:
self.setAmplitude(amplitude=v)
p=self.measureJBAPower(f='autodetect')
pvsv.set(v=v,bluePower=p)
pvsv.commit()
pv=scipy.interpolate.interp1d(pvsv.column("v"),pvsv.column("bluePower"))
data.savetxt()
for f in frequencies:
child=Datacube("f=%f"%f)
data.addChild(child)
self.setFrequency(f)
for v in voltages:
self.setAmplitude(amplitude=v)
time.sleep(0.5)
co=self.getThisMeasure()[1]
var=cov(co[0])+cov(co[1])
if var>0.01:
cod=Datacube("components at p=%f" %pv(v))
cod.createColumn('I',co[0])
cod.createColumn('Q',co[1])
cod.createColumn('bluePower',[pv(v)]*len(co[0]))
child.addChild(cod)
else:
####### ECRIRE QUELQUE CHOSE ICI
[I,Q]=[mean(co[0]),mean(co[1])]
child.set(f=f,v=v,I=I,Q=Q,sigma=var,bluePower=pv(v))
child.set(M=sqrt(I**2+Q**2))
child.set(phi=math.atan2(I,Q))
child.commit()
data.set(f=f,v=v,I=I,Q=Q,sigma=var,bluePower=pv(v))
data.set(M=sqrt(I**2+Q**2))
data.set(phi=math.atan2(I,Q))
data.commit()
data.savetxt()
except:
raise
finally:
data.savetxt()
self.shape=previousShape
示例8: sCurves
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
def sCurves(qubit,jba,variable = "p1x",data = None,ntimes = 20,optimize = "v20"):
"""
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.05
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.05
jba.setVoltage(v)
acqiris.bifurcationMap()
p = acqiris.Psw()[variable]
vmin = v
return (vmin*0.95,vmax*1.2)
try:
v0 = jba.voltage()
if data == None:
sData = Datacube()
else:
sData = data
sData.setName("S curves - %s" % qubit.name())
sData.setParameters(instrumentManager.parameters())
s0 = Datacube("S0")
s1 = Datacube("S1")
s2 = Datacube("S2")
sData.addChild(s0)
sData.addChild(s1)
sData.addChild(s2)
qubit.turnOffDrive()
(vmin,vmax) = getVoltageBounds(v0,jba,variable,ntimes)
measureSingleS(voltages = arange(vmin,vmax,0.005),data = s0,jba = jba,ntimes = ntimes)
qubit.turnOnDrive()
loadPi01Pulse(qubit)
measureSingleS(voltages = arange(vmin,vmax,0.005),data = s1,jba = jba,ntimes = ntimes)
failed12 = False
try:
loadPi012Pulse(qubit)
measureSingleS(voltages = arange(vmin,vmax,0.005),data = s2,jba = jba,ntimes = ntimes)
s1.createColumn("contrast20",s2.column(variable)-s0.column(variable))
s1.createColumn("contrast21",s2.column(variable)-s1.column(variable))
qubit.parameters()["readout.v20"] = s1.column("v")[argmax(s1.column("contrast20"))]
qubit.parameters()["readout.v21"] = s1.column("v")[argmax(s1.column("contrast21"))]
except:
failed12 = True
raise
s1.createColumn("contrast10",s1.column(variable)-s0.column(variable))
qubit.parameters()["readout.v10"] = s1.column("v")[argmax(s1.column("contrast10"))]
if optimize == "v20" and not failed12:
imax = argmax(s1.column("contrast20"))
qubit.parameters()["readout.p11"] = s2.column(variable)[imax]
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"))
qubit.parameters()["readout.p11"] = s1.column(variable)[imax]
v0 = s1.column("v")[imax]
#To do: Add dialog to ask to which voltage (v10,v20,v21) in
qubit.parameters()["readout.p00"] = 1.0-s0.column(variable)[imax]
return (sData,v0)
finally:
jba.setVoltage(v0)
data.savetxt()
示例9: IqOptimization
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
#.........这里部分代码省略.........
Calibrate the IQ mixer sideband generation.
"""
if frequencyRange==None:
frequencyRange=[self._mwg.frequency()]
try:
self.setup()
params = dict()
params["power"] = self._mwg.power()
params["channels"] = self._awgChannels
params["mwg"] = self._mwg.name()
params["awg"] = self._awg.name()
params["fsp"] = self._fsp.name()
self.sidebandCalibrationData().setParameters(params)
self._mwg.turnOn()
channels = self._awgChannels
self.loadSidebandWaveforms()
for f_c in frequencyRange:
#We round the center frequency to an accuracy of 1 MHz
f_c = round(f_c,3)
self._mwg.setFrequency(f_c)
self._awg.setAmplitude(channels[0],4.5)
self._awg.setAmplitude(channels[1],4.5)
self._awg.setOffset(channels[0],self.iOffset(f_c))
self._awg.setOffset(channels[1],self.qOffset(f_c))
data = Datacube("f_c = %g GHz" % f_c)
rowsToDelete = []
try:
for i in range(0,len(self._sidebandCalibrationData.column("f_c"))):
if abs(self._sidebandCalibrationData.column("f_c")[i]-f_c) < 0.1:
rowsToDelete.append(i)
except:
pass
self._sidebandCalibrationData.removeRows(rowsToDelete)
self._sidebandCalibrationData.addChild(data, f_c=f_c)
self._sidebandCalibrationData.set(f_c = f_c)
self._sidebandCalibrationData.commit()
for f_sb in sidebandRange:
print "f_c = %g GHz, f_sb = %g GHz" % (f_c,f_sb)
self._fsp.write("SENSE1:FREQUENCY:CENTER %f GHZ" % (f_c+f_sb))
result = scipy.optimize.fmin_powell(lambda x,*args: self.measureSidebandPower(x,*args),[0,0],args = [f_sb],full_output = 1,xtol = 0.00001,ftol = 1e-4,maxiter = 2)
params = result[0]
value = result[1]
print "f_c = %g GHz, f_sb = %g GHz, c = %g, phi = %g rad" % (f_c,f_sb,params[0],params[1])
self.loadSidebandCalibrationWaveform(f_sb = f_sb,c = params[0],phi = params[1])
for i in [-3,-2,-1,0,1,2,3]:
self._fsp.write("SENSE1:FREQUENCY:CENTER %f GHZ" % (f_c+f_sb*i))
if i < 0:
suppl = "m"
else:
suppl = ""
data.set(**{"p_sb%s%d" % (suppl,abs(i)) : self.measureAveragePower()})
data.set(f_c = f_c,f_sb = f_sb,c = params[0],phi = params[1])
data.commit()
self._sidebandCalibrationData.sortBy("f_c")
self._sidebandCalibrationData.savetxt()
finally:
self.teardown()
return self._sidebandCalibrationData.filename()
def iOffset(self,f):
return self._iOffsetInterpolation(f)
def qOffset(self,f):
return self._qOffsetInterpolation(f)
def setDriveFrequency(self,f):
示例10: measureSCurves
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
def measureSCurves(qubit,jba,variable = "p1x",data = None,ntimes = 20):
"""
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.05
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.05
jba.setVoltage(v)
acqiris.bifurcationMap()
p = acqiris.Psw()[variable]
vmin = v
return (vmin*0.9,vmax*1.1)
try:
v0 = jba.voltage()
if data == None:
sData = Datacube()
else:
sData = data
sData.setName("S curves - %s" % qubit.name())
sData.setParameters(instrumentManager.parameters())
sOff = Datacube("SOFF")
sOn = Datacube("SON")
sData.addChild(sOff)
sData.addChild(sOn)
qubit.turnOffDrive()
(vmin,vmax) = getVoltageBounds(v0,jba,variable,ntimes)
for v in arange(vmin,vmax,0.005):
jba.setVoltage(v)
acqiris.bifurcationMap(ntimes = ntimes)
sOff.set(**(acqiris.Psw()))
sOff.set(v = v)
sOff.commit()
qubit.turnOnDrive()
for v in arange(vmin,vmax,0.005):
jba.setVoltage(v)
acqiris.bifurcationMap(ntimes = ntimes)
sOn.set(**acqiris.Psw())
sOn.set(v = v)
sOn.commit()
sOn.createColumn("contrast",sOn.column(variable)-sOff.column(variable))
v0 = sOn.column("v")[argmax(sOn.column("contrast"))]
maxContrast = max(sOn.column("contrast"))
return (sData,maxContrast,v0)
finally:
jba.setVoltage(v0)
示例11: sCurves
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
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))
#.........这里部分代码省略.........
示例12: parameterSurvey
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
def parameterSurvey(qubit,jba,values,generator,data = None,ntimes = 20,durations = arange(0,50,2),freqs = list(arange(5.0,6.5,0.002))+list(arange(7.0,8.3,0.002)),autoRange = False,spectroAmp = 0.1,rabiAmp = 1.0,f_sb = -0.1,variable = "p1x",fastMeasure=False,use12Pulse=False):
"""
Measure the characteristic properties of the qubit (T1, Rabi period, transition frequency, readout contrast) for a list of different parameters.
"params" contains a list of parameters, which are iterated over and passed to the function "generator" at each iteration.
Example:
values = [0.0,1.0,2.0]
def generator(x):
#Set the amplitude of AFG1 to the given parameter value
afg1.setAmplitude(x)
"""
if data == None:
data = Datacube()
data.setName("Parameter Survey - %s" % qubit.name())
for v in values:
generator(v)
try:
jba.calibrate()
except:
continue
vData = Datacube("flux = %g V" % v)
data.addChild(vData)
data.set(flux = v)
spectroData = Datacube()
vData.addChild(spectroData)
#Measure a spectroscopy
spectroscopy(qubit = qubit,frequencies = freqs,variable = variable,data = spectroData,ntimes = 20,amplitude = spectroAmp,measureAtReadout = False,measure20=use12Pulse)
if qubit.parameters()["frequencies.f01"] == None:
data.commit()
continue
if autoRange:
freqs = list(arange(qubit.parameters()["frequencies.f01"]-0.2,qubit.parameters()["frequencies.f01"]+0.2,0.002))
data.set(f01 = qubit.parameters()["frequencies.f01"],f02 = qubit.parameters()["frequencies.f02"])
#Measure a Rabi oscillation
rabiData = Datacube()
vData.addChild(rabiData)
f01 = qubit1.parameters()["frequencies.f01"]
f_sb = -0.1-(f01-round(f01,2))
qubit.parameters()["pulses.xy.f_sb"]=float(f_sb)
rabi(qubit = qubit,durations = rabiDurations,variable = variable,data = rabiData,amplitude = rabiAmp,f_sb = f_sb,averaging = 20)
if qubit.parameters()["pulses.xy.t_pi"] == None:
data.commit()
continue
data.set(t_pi = qubit.parameters()["pulses.xy.t_pi"])
if use12Pulse:
#Measure a Rabi 12 oscillation
qubit.parameters()["pulses.xy.drive_amplitude"]=rabiAmp
rabi12Data = Datacube()
vData.addChild(rabi12Data)
rabi12(qubit = qubit,durations = rabiDurations,variable = variable,data = rabi12Data,averaging = 20)
if qubit.parameters()["pulses.xy.t_pi12"] == None:
data.commit()
continue
data.set(t_pi12 = qubit.parameters()["pulses.xy.t_pi12"])
#Measure S curves
sData = Datacube()
vData.addChild(sData)
sCurves(qubit = qubit,jba = jba,variable = variable,data = sData,optimize = "v10",s2=use12Pulse)
data.set(contrast10 = qubit.parameters()["readout.contrast10"])
if not fastMeasure:
#Measure T1
t1Data = Datacube()
vData.addChild(t1Data)
delays = list(arange(0,200,10))+list(arange(200,2000,50))
T1(qubit = qubit,delays = delays,variable = variable,data = t1Data, averaging=20)
data.set(T1 = qubit.parameters()["relaxation.t1"])
#Measure T2
ramseyData = Datacube()
vData.addChild(ramseyData)
durations = arange(0,200,3.0)
ramsey(qubit = qubit,durations = durations,variable = variable,data = ramseyData,averaging = 20,amplitude = 0.0,f_offset = 0.03,correctFrequency = False)
data.set(T2 = ramseyData.parameters()["ramseyFit"][2])
data.set(Tphi = 1.0/(1.0/ramseyData.parameters()["ramseyFit"][2]-1.0/2./qubit.parameters()["relaxation.t1"]))
#.........这里部分代码省略.........
示例13: len
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
dataManager.addDatacube(curves)
i = 0
curve = None
while i < len(lines):
elements = lines[i].split(",")
if re.search("l1=(\d+\.\d+)",lines[i],re.I):
if curve != None and len(curve) == 0:
curves.removeChild(curve)
print lines[i]
lq = float(re.search("l1=(\d+\.\d+)",lines[i],re.I).group(1))
print lq
i+=2
if i >= len(lines):
break
curve = Datacube("l1 = %g nH" % lq)
curves.addChild(curve,lq = lq)
curve.parameters()["defaultPlot"] = [("freq","mag")]
elif len(elements) == 2:
(freq,mag) = map(lambda x:float(x),lines[i].split(","))
curve.set(freq = freq,mag = mag)
curve.commit()
i+=1
curves.savetxt("sonnet_model")
##
import os
from numpy import *
m = zeros((len(curves.children()[0]),len(curves.children())))
i = 0
for child in curves.children():
print mean(child["mag"]),max(child["mag"])
m[:,i] = child["mag"]
示例14: methods
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addChild [as 别名]
def methods(self,instrument,methodNames):
return [getattr(instrument,methodName for methodName in methodNames]
def methodsFromAliases(self,localInstrumentName,methodAliases):
instr,methodsDict=self._subInstruments[localInstrumentName]
return self.methods(instr,[methodsDict[methodAlias] for methodAlias in methodAliases])
def checkAliasedMethodsExist(self,localInstrumentName,methodAliases=None):
if methodAliases==None: methodAliases=self._subInstruments[localInstrumentName][1].keys()
methods= self.methodsFromAliases(localInstrumentName,methodAliases)
indices = [i for i, x in enumerate(methods) if x == None]
if len(indices)!=O:
raise NameError('methods '+str([methodAliases[i] for i in indices])+' do not seem to exist')
def setBiasGen(self,instr,setBiasFuncName='setVoltage',getBiasFuncName='voltage'):
if instr!=None:
if isinstance(instr,str):
inst=getInstrument(instr)
else:
inst=instr
methods={'setBias':setBiasFuncName,'getBias':getBiasFuncName}
self._subInstruments['biasGen']=(inst,methods)
self.checkAliasedMethodsExist('biasGen')
def setPumpGen(self,instr,setFreqFuncName='setFrequency',getFreqFuncName='frequency',setPowFuncName='setPower',getPowFuncName='power'):
if instr!=None:
if isinstance(instr,str):
inst=getInstrument(pumpGen)
else:
inst=instr
methods={'setFreq':setFreqFuncName,'getFreq':getFreqFuncNam,'setPow':setPowFuncName,'getPow':getPowFuncName}
self._subInstruments['pumpGen']=(inst,methods)
self.checkAliasedMethodsExist('pumpGen')
def setTestVna(self,instr,\
setFreqFuncName='setCenterInGhz',getFreqFuncName='getCenterInGhz',\
setSpanFuncName='setSpanInGhz',getSpanFuncName='setSpanInGhz',\
setPowFuncName='setTotalPower',getPowFuncName='getTotalPower',\
getSpectrumFuncName='getFreqMagPhase',check=True\
):
if instr!=None:
if isinstance(instr,str):
inst=getInstrument(pumpGen)
else:
inst=instr
methods={'setFreq':setFreqFuncName,'getFreq':getSpanFuncNam,'setSpan':setSpanFuncName,'getSpan':getSpanFuncName,\
'setPow':setPowFuncName,'getPow':getPowFuncName,'getSpectrum':getSpectrumFuncName}
self._subInstruments['testVNA']=(inst,methods)
self.checkAliasedMethodsExist('testVNA')
def adaptFunc1(self,adaptiveLoop,deltafMax=span/10.,deltafMin=span/20.,stepMin=0.1,stepMax=1.):
fbValues=adaptiveLoop.feedBackValues()
if len(fbValues)>=2:
step=adaptiveLoop.getStep()
dir=1.0;
if step<0:
dir=-1.0
deltaF=abs(fbValues[-1]-fbValues[-2])
newStep=step
if deltaF > deltafMax:
newStep=max(abs(step/2.),stepMin)*dir
adaptiveLoop.setStep(newStep)
elif deltaF < deltafMin:
newStep=min(abs(step*2),stepMax)*dir
adaptiveLoop.setStep(newStep)
def calibrateFreq(self,biasStart=None,biasStop=None,biasStep=1,centerStart=None,span=None,):
if self._subInstruments['testVNA'].has_Key('biasGen')
setBias,getBias=self.methodsFromAliases('biasGen',['setBias','getBias'])
[setFreq,getFreq,setSpan,getSpan,setPow,getPow,getSpectrum]=self.methodsFromAliases('testVna',['setFreq','getFreq','setSpan','getSpan','setPow','getPow','getSpectrum'])
if biasStart!=None : setFreq(biasStart)
else :biasStart=getFreq()
if biasStop==None : biasStop=biasStart+10*biasStep
if centerStart!=None : setFreq(centerStart)
if span!=None : setSpan(span)
data=Datacube('parampFreqVsBias')
data.toDataManager()
xLoop=AdaptiveLoop(biasStart,step=biasStep,stop=biasStop,name=parampFreqVsBias,adaptFunc=self.adaptFunc1)
setFreq(fCenter)
for x in xLoop:
print "Bias= ", x
setBias(x,slewRate=0.5)
child1=getSpectrum(waitFullSweep = True)
child1.setName('bias'+str(x))
data.addChild(child1)
#Fit phase and determine center frequency f here
xLoop.newFeedbackValue(f)
data.set(bias=x,freq=f,commit=True,columnOrder=['bias','freq','peakdB'])