本文整理汇总了Python中pyview.lib.datacube.Datacube.toDataManager方法的典型用法代码示例。如果您正苦于以下问题:Python Datacube.toDataManager方法的具体用法?Python Datacube.toDataManager怎么用?Python Datacube.toDataManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyview.lib.datacube.Datacube
的用法示例。
在下文中一共展示了Datacube.toDataManager方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: measureRabi
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import toDataManager [as 别名]
def measureRabi(self,durations,data=None,rabiParameters=None, dataParameters=None):
"""
Measure a rabi, will use what is in dictionnary if power/frequency/useCalibration/nLoops are not set
Fit and save the period in the Qubit dictionnary under piRabiTime
Return the datacube and rabiPeriod
"""
if dataParameters==None:
dataParameters=dict()
dataParameters['addToDataManager']=True
dataParameters['save']=True
if rabiParameters==None:
if self._params.has_key('rabiParameters'):
rabiParameters=self._params['rabiParameters']
else: raise Exception("Unable to find rabi parameters... Exiting... ")
useCalibration=rabiParameters['useCalibration']
frequency=rabiParameters['frequency']
if frequency=="f01":frequency=self.frequency01()
power=rabiParameters['power']
nLoops=rabiParameters['nLoops']
if rabiParameters.has_key('remember'):
if rabiParameters['remember']: self._params['rabiParameters']=rabiParameters
if self._params.has_key('offsetDelay'):
offsetDelay=self._params['offsetDelay']
else: offsetDelay=20
if data==None:
data=Datacube("Rabi %s dBm"%power)
if dataParameters['addToDataManager']:data.toDataManager()
if power !="stay":self._pulseGenerator._MWSource.setPower(power)
self._pulseGenerator._MWSource.turnOn()
for duration in durations:
self.clearPulses()
self.generateRabiPulse(duration=duration, frequency=frequency, offsetDelay=offsetDelay,useCalibration=rabiParameters['useCalibration'])
result=self._jba.measure(nLoops=nLoops,fast=True)[0]
data.set(**result)
data.set(duration=duration)
data.commit()
#Fit
try:
columnName="b%i"%self._jba.bit
period= estimatePeriod(data['duration'],data[columnName])
[y0,dy,piRabi,t10],yfit=fitRabi(data['duration'],data[columnName],period=period)
data.createColumn("%sfit"%columnName,yfit)
except:
print 'fit error'
piRabi=0
if dataParameters['save']:data.savetxt()
self._params['piRabiTime']=piRabi
return data,piRabi
示例2: measureT1
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import toDataManager [as 别名]
def measureT1(self,delays,data=None,t1Parameters=None, dataParameters=None):
"""
Measure a T1, will use what is in dictionnary if power/frequency/useCalibration/nLoops are not set
Fit and save the period in the Qubit dictionnary under T1
Return data and T1
"""
if dataParameters==None:
dataParameters=dict()
dataParameters['addToDataManager']=True
dataParameters['save']=True
print t1Parameters
if t1Parameters==None:
if self._params.has_key('t1Parameters'):
t1Parameters=self._params['t1Parameters']
else: raise Exception("Unable to find rabi parameters... Exiting... ")
useCalibration=t1Parameters['useCalibration']
frequency=t1Parameters['frequency']
if frequency=="f01":frequency=self.frequency01()
print frequency
power=t1Parameters['power']
nLoops=t1Parameters['nLoops']
duration=t1Parameters['duration']
if duration=="rabi":duration=self._params['piRabiTime']
if t1Parameters.has_key('remember'):
if t1Parameters['remember']: self._params['t1Parameters']=t1Parameters
if self._params.has_key('offsetDelay'):
offsetDelay=self._params['offsetDelay']
else: offsetDelay=20
if data==None:
data=Datacube("T1 Measurement")
if dataParameters['addToDataManager']:data.toDataManager()
if power !="stay":self._pulseGenerator._MWSource.setPower(power)
if power !="stay":self._pulseGenerator._MWSource.setPower(power)
for delay in delays:
self._pulseGenerator.clearPulse()
self._pulseGenerator.generatePulse(duration=duration, frequency=frequency, DelayFromZero=10000-delay-duration-offsetDelay,useCalibration=False)
self._pulseGenerator.sendPulse()
result=self._jba.measure(nLoops=nLoops,fast=True)[0]
data.set(**result)
data.set(delay=delay)
data.commit()
columnName="b%i"%self._jba.bit
[y0,dy,T1],yfit=fitT1(data['delay'],data[columnName])
data.createColumn("fit",yfit)
self._params['T1']=T1
return data,T1
示例3: measureSpectroscopy
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import toDataManager [as 别名]
def measureSpectroscopy(self,frequencies, data=None, spectroscopyParameters=None,dataParameters=None):
"""
Measure a spectroscopy
Fit
Return the datacube and centerFrequency
"""
if spectroscopyParameters==None:
if self._params.has_key(spectroscopyParameters):
spectroscopyParameters=self._params['spectroscopyParameters']
else:
raise Exception("No spectroscopy parameters found... Exiting...")
if dataParameters==None:
dataParameters=dict()
dataParameters['addToDataManager']=True
dataParameters['save']=True
if spectroscopyParameters.has_key('remember'):self._params['spectroscopyParameters']=spectroscopyParameters
useCalibration=spectroscopyParameters['useCalibration']
nLoops=spectroscopyParameters['nLoops']
duration=spectroscopyParameters['duration']
if spectroscopyParameters.has_key('power'): self._pulseGenerator._MWSource.setPower(spectroscopyParameters['power'])
amplitude = spectroscopyParameters['amplitude'] if spectroscopyParameters.has_key('amplitude') else 0
if data==None:
data=Datacube("Spectroscopy measurement")
if dataParameters['addToDataManager']:data.toDataManager()
if self._params.has_key('offsetDelay'):
offsetDelay=self._params['offsetDelay']
else: offsetDelay=20
first=True
for frequency in frequencies:
self._pulseGenerator._MWSource.setFrequency(frequency)
if first: # i.e. generate a rabi pulse on the AWG only the first time (no need to re-generate an AWG pulse every time)
self._pulseGenerator.pulseList=()
self.generateRabiPulse(duration=duration,amplitude=amplitude,offsetDelay=offsetDelay,useCalibration=useCalibration,frequency=frequency)
first=False
time.sleep(0.2)
data.set(frequency=frequency)
data.set(**self._jba.measure(nLoops=nLoops,fast=True)[0])
data.commit()
try:
columnName="b%i"%self._jba.bit
[dy,f0,df,y0],yfit=fitLorentzian(data['frequency'],data[columnName],1)
data.createColumn(columnName+"fit",yfit)
except:
print "fitting error"
[dy,f0,df,y0]=[0]*4
if dataParameters['save']:data.savetxt()
d0.setParameters(Manager().saveState('currentState'))
return data, f0
示例4: methods
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import toDataManager [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'])