本文整理汇总了Python中pyview.lib.datacube.Datacube.parameters方法的典型用法代码示例。如果您正苦于以下问题:Python Datacube.parameters方法的具体用法?Python Datacube.parameters怎么用?Python Datacube.parameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyview.lib.datacube.Datacube
的用法示例。
在下文中一共展示了Datacube.parameters方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rabi12
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import parameters [as 别名]
def rabi12(qubit,durations,data = None,variable ="p1x",averaging = 20,delay = 0,callback = None,saveData = True):
from instruments.qubit import PulseSequence
if data == None:
data = Datacube()
data.setParameters(instrumentManager.parameters())
data.setName("Rabi Sequence 12 - %s" % qubit.name())
amplitude = qubit.parameters()["pulses.xy.drive_amplitude"]
f_sb = qubit.parameters()["pulses.xy.f_sb"]
f_carrier = qubit.parameters()["frequencies.f01"]+f_sb
f_sb_12 = -(qubit.parameters()["frequencies.f12"]-f_carrier)
print f_sb_12
qubit.setDriveFrequency(f_carrier)
qubit.setDriveAmplitude(I = amplitude,Q = amplitude)
failed = False
data.parameters()["defaultPlot"] = [["duration",variable],["duration","%s_fit" % variable]]
try:
for duration in durations:
seq = PulseSequence()
seq.addPulse(qubit.generateRabiPulse(phase = math.pi,f_sb = f_sb))
seq.addPulse(qubit.generateRabiPulse(length = duration,f_sb = f_sb_12))
seq.addPulse(qubit.generateRabiPulse(phase = math.pi,f_sb = f_sb))
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 StopThread:
pass
except:
print "Failed!"
failed = True
import traceback
traceback.print_exc()
finally:
if len(data) == 0:
return
if failed:
raise
(params,rsquare) = fitRabi12Frequency(data,variable)
qubit.parameters()["pulses.xy.t_pi12"] = params[1]/2.0
qubit.parameters()["pulses.xy.drive_amplitude12"] = amplitude
qubit.parameters()["pulses.xy.f_sb12"] = f_sb_12
data.parameters()["rabiFit12"] = params
if saveData:
data.savetxt()
return data
示例2: rabi
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import parameters [as 别名]
def rabi(qubit,durations,data = None,variable ="p1x",f_sb = -0.1,amplitude = 1.0,averaging = 20,delay = 0,use12Pulse = False,callback = None,angle = 0,compositePulse = False,gaussian = True,flank = 3,saveData = True):
if data == None:
data = Datacube()
data.setParameters(instrumentManager.parameters())
data.parameters()["defaultPlot"]=[["duration",variable]]
data.setName("Rabi Sequence - %s" % qubit.name())
qubit.setDriveFrequency(qubit.parameters()["frequencies.f01"]+f_sb)
qubit.setDriveAmplitude(I = amplitude,Q = amplitude)
qubit.turnOnDrive()
try:
for duration in durations:
if compositePulse:
seq = PulseSequence()
seq.addPulse(qubit.generateRabiPulse(angle = angle,length = duration/2.0,f_sb = f_sb,sidebandDelay = seq.position(),gaussian = gaussian))
seq.addWait(0)
seq.addPulse(qubit.generateRabiPulse(angle = angle,length = duration/2.0,f_sb = f_sb,sidebandDelay = seq.position(),gaussian = gaussian))
qubit.loadWaveform(seq.getWaveform(endAt = qubit.parameters()["timing.readout"]-delay),readout = qubit.parameters()["timing.readout"])
else:
seq = PulseSequence()
seq.addPulse(qubit.generateRabiPulse(angle = angle,length = duration,f_sb = f_sb,sidebandDelay = seq.position(),gaussian = gaussian))
if use12Pulse:
f_carrier = qubit.parameters()["frequencies.f01"]+f_sb
f_sb_12 = -(qubit.parameters()["frequencies.f12"]-f_carrier)
t_pi_12 = qubit.parameters()["pulses.xy.t_pi12"]
seq.addPulse(qubit.generateRabiPulse(angle = angle,length = t_pi_12,f_sb = f_sb_12,sidebandDelay = seq.position()))
qubit.loadWaveform(seq.getWaveform())#endAt = qubit.parameters()["timing.readout"]-delay),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:
import traceback
traceback.print_exc()
finally:
(params,rsquare) = fitRabiFrequency(data,variable,withOffset = True)
if rsquare > 0.5:
qubit.parameters()["pulses.xy.t_pi"] = float(params[1]/2.0)
qubit.parameters()["pulses.xy.drive_amplitude"] = float(amplitude)
qubit.parameters()["pulses.xy.f_sb"] = float(f_sb)
data.parameters()["rabiFit"] = params
qubit.loadRabiPulse(flank = flank,angle = angle,phase = math.pi,readout = qubit.parameters()["timing.readout"],f_sb = f_sb)
else:
print "Rabi fit is not good, resetting parameters..."
qubit.parameters()["pulses.xy.t_pi"] = None
qubit.parameters()["pulses.xy.drive_amplitude"] = None
qubit.parameters()["pulses.xy.f_sb"] = None
if saveData:
data.savetxt()
return data
示例3: spectroscopy
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import parameters [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: rabi
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import parameters [as 别名]
def rabi(qubit,durations,data = None,variable ="p1x",f_sb = -0.1,amplitude = 1.0,averaging = 20,delay = 0,callback = None):
if data == None:
data = Datacube()
data.setParameters(instrumentManager.parameters())
data.setName("Rabi Sequence - %s" % qubit.name())
qubit.setDriveFrequency(qubit.parameters()["frequencies.f01"]+f_sb)
qubit.setDriveAmplitude(I = amplitude,Q = amplitude)
qubit.turnOnDrive()
try:
for duration in durations:
qubit.loadRabiPulse(length = duration,readout = qubit.parameters()["timing.readout"],f_sb = f_sb)
if callback != None:
callback(duration)
acqiris.bifurcationMap(ntimes = averaging)
data.set(duration = duration)
data.set(**acqiris.Psw())
data.commit()
finally:
try:
params = fitRabiFrequency(data,variable)
qubit.parameters()["pulses.xy.t_pi"] = params[1]/2.0-params[4]
qubit.parameters()["pulses.xy.drive_amplitude"] = amplitude
qubit.parameters()["pulses.xy.f_sb"] = f_sb
data.parameters()["rabiFit"] = params
qubit.loadRabiPulse(phase = math.pi,readout = qubit.parameters()["timing.readout"],f_sb = f_sb)
except:
pass
data.savetxt()
return data
示例5: measureSpectroscopy
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import parameters [as 别名]
def measureSpectroscopy(qubit,frequencies,data = None,ntimes = 20,amplitude = 1,measureAtReadout = False,delay = 0,f_sb = 0,delayAtReadout = 1500,pulseLength = 500,gaussian=False):
if data == None:
data = Datacube()
if measureAtReadout:
qubit.loadRabiPulse(length = pulseLength,f_sb = f_sb,delay = delay,gaussian=gaussian)
else:
qubit.loadRabiPulse(length = pulseLength,f_sb = f_sb,delay = delay,gaussian=gaussian)
qubit.turnOnDrive()
data.setParameters(dict(data.parameters(),**instrumentManager.parameters()))
try:
for f in frequencies:
qubit.setDriveFrequency(f+f_sb)
qubit.setDriveAmplitude(I = amplitude,Q = amplitude)
acqiris.bifurcationMap(ntimes = ntimes)
data.set(f = f)
data.set(**acqiris.Psw())
data.commit()
except StopThread:
return data
示例6: rabi12
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import parameters [as 别名]
def rabi12(qubit,durations,data = None,variable ="p1x",f_sb = -0.1,amplitude = 1.0,averaging = 20,delay = 0,callback = None):
from instruments.qubit import PulseSequence
if data == None:
data = Datacube()
data.setParameters(instrumentManager.parameters())
data.setName("Rabi Sequence 12 - %s" % qubit.name())
f_sb_12 = f_sb-qubit.parameters()["frequencies.f02"]+qubit.parameters()["frequencies.f01"]*2
qubit.setDriveFrequency(qubit.parameters()["frequencies.f01"]+f_sb)
qubit.setDriveAmplitude(I = amplitude,Q = amplitude)
piLength = len(qubit.generateRabiPulse(phase = math.pi,f_sb = f_sb))
try:
for duration in durations:
pulseLength = len(qubit.generateRabiPulse(length = duration,f_sb = f_sb_12))
seq = PulseSequence()
seq.addPulse(qubit.generateRabiPulse(phase = math.pi,delay = qubit.parameters()["timing.readout"]-pulseLength-piLength,f_sb = f_sb))
seq.addPulse(qubit.generateRabiPulse(length = duration,delay = qubit.parameters()["timing.readout"]-pulseLength,f_sb = f_sb_12))
qubit.loadWaveform(seq.getWaveform(),readout = qubit.parameters()["timing.readout"])
if callback != None:
callback(duration)
acqiris.bifurcationMap(ntimes = averaging)
data.set(duration = duration)
data.set(**acqiris.Psw())
data.commit()
finally:
if len(data) == 0:
return
params = fitRabi12Frequency(data,variable)
qubit.parameters()["pulses.xy.t_pi12"] = params[1]/2.0-params[4]
qubit.parameters()["pulses.xy.drive_amplitude12"] = amplitude
qubit.parameters()["pulses.xy.f_sb12"] = f_sb
data.parameters()["rabiFit12"] = params
seq = PulseSequence()
pulseLength = len(qubit.generateRabiPulse(length = params[1]/2.0-params[4],f_sb = f_sb_12))
seq.addPulse(qubit.generateRabiPulse(phase = math.pi,delay = qubit.parameters()["timing.readout"]-pulseLength-piLength,f_sb = f_sb))
seq.addPulse(qubit.generateRabiPulse(length = params[1]/2.0-params[4],delay = qubit.parameters()["timing.readout"]-pulseLength,f_sb = f_sb_12))
qubit.loadWaveform(seq.getWaveform(),readout = qubit.parameters()["timing.readout"])
data.savetxt()
return data
示例7: T1precis
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import parameters [as 别名]
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
示例8: T1
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import parameters [as 别名]
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
示例9: sCurves
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import parameters [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))
#.........这里部分代码省略.........
示例10: parameterSurvey
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import parameters [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"]))
#.........这里部分代码省略.........
示例11: DataManager
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import parameters [as 别名]
from pyview.helpers.datamanager import DataManager
dataManager = DataManager()
from pyview.helpers.instrumentsmanager import Manager
from instruments.qubit import *
reload(sys.modules["instruments.qubit"])
from instruments.qubit import *
instruments = Manager()
def ramsey(qubit,durations,data = None,variable ="p1x",callback = None,angle = 0,phase = math.pi/2.0,averaging = 20,amplitude = 0,f_offset = 0,correctFrequency = False,saveData = True,transition = 01,use12Pulse = False):
if data == None:
data = Datacube()
data.setParameters(instrumentManager.parameters())
data.parameters()["defaultPlot"]=[["duration",variable]]
data.setName("Ramsey Sequence - %s" % qubit.name())
f_sb = qubit.parameters()["pulses.xy.f_sb"]
if 'pulses.xy.f_shift' in qubit.parameters():
f_shift=qubit.parameters()["pulses.xy.f_shift"]
else:
f_shift=0
qubit.setDriveFrequency(qubit.parameters()["frequencies.f01"]+f_sb)
f_sb-=f_shift
qubit.setDriveAmplitude(I = qubit.parameters()["pulses.xy.drive_amplitude"],Q = qubit.parameters()["pulses.xy.drive_amplitude"])
qubit.turnOnDrive()
if amplitude != 0:
qubit.pushState()
baseForm = qubit.fluxlineWaveform()
if 02 == transition:
f_offset/=2.0
示例12: len
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import parameters [as 别名]
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"]
i+=1