当前位置: 首页>>代码示例>>Python>>正文


Python Datacube.column方法代码示例

本文整理汇总了Python中pyview.lib.datacube.Datacube.column方法的典型用法代码示例。如果您正苦于以下问题:Python Datacube.column方法的具体用法?Python Datacube.column怎么用?Python Datacube.column使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyview.lib.datacube.Datacube的用法示例。


在下文中一共展示了Datacube.column方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _findAmplitude

# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import column [as 别名]
 def _findAmplitude(self,voltages,frequency,shape):
   """
   Only used by function calibrate.
   Measure and find the amplitude where the JBA is bi-evaluated, go to this point, and store this amplitude
   """
   ps = []
   max = 0
   maxVoltage = 0
   self.variances = zeros((len(voltages),2))
   self.variances[:,0] = voltages
   data = Datacube("Variance")
   for i in range(0,len(voltages)):
     if self.stopped():
       self._stopped = False
       raise Exception("Got stopped!")
     v = voltages[i] 
     self.init()
     self.frequency(frequency=frequency,shape=v*shape)
     (av,trends, fr)=self.analyse()
     varsum =cov(trends[0,:,0])+cov(trends[1,:,0])
     data.set(v = v)
     data.set(varsum=varsum)
     data.commit()
     self.notify("variance",(data.column("v"),data.column("varsum")))
     self.notify("status","Variance at %g V: %g" % (v,varsum))
     print "Variance at v = %f : %f" % (v,varsum)
     self.variances[i,1] = varsum
     ps.append(varsum)
     if varsum > max:
       max = varsum
       maxVoltage = voltages[i]
   self.frequency(frequency=frequency,shape=maxVoltage*shape)
   return (ps,max,maxVoltage,data)
开发者ID:adewes,项目名称:python-qubit-setup,代码行数:35,代码来源:jba_sb.py

示例2: _attenuatorRangeCheck

# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import column [as 别名]
 def _attenuatorRangeCheck(self,voltages):
   ps = []
   max = 0
   maxVoltage = 0
   self.variances = zeros((len(voltages),2))
   self.variances[:,0] = voltages
   data = Datacube("Variance")
   for i in range(0,len(voltages)):
     if self.stopped():
       self._stopped = False
       raise Exception("Got stopped!")
     v = voltages[i] 
     self._attenuator.setVoltage(v)
     self._acqiris.bifurcationMap(ntimes = 10)
     trends = self._acqiris.trends()
     varsum =cov(trends[self._params["acqirisChannel"]])+cov(trends[self._params["acqirisChannel"]+1])
     data.set(v = v)
     data.set(varsum=varsum)
     data.commit()
     self.notify("variance",(data.column("v"),data.column("varsum")))
     self.notify("status","Variance at %g V: %g" % (v,varsum))
     print "Variance: %f" % varsum
     self.variances[i,1] = varsum
     ps.append(varsum)
     if varsum > max:
       max = varsum
       maxVoltage = voltages[i]
   return (ps,max,maxVoltage)
开发者ID:adewes,项目名称:python-qubit-setup,代码行数:30,代码来源:jba.py

示例3: caracteriseIQvsFvsP

# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import column [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
开发者ID:manipp4,项目名称:qubit_setup,代码行数:59,代码来源:jba_sb_old_20140425.py

示例4: measureSCurve

# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import column [as 别名]
  def measureSCurve(self,voltages = None,ntimes = 40,microwaveOff = True):
    self.notify("status","Measuring S curve...")
    def getVoltageBounds(v0,jba,variable,ntimes):
      v = v0
      jba.setVoltage(v)
      jba._acqiris.bifurcationMap(ntimes = ntimes)
      p = jba._acqiris.Psw()[variable]
      
      while p > 0.03 and v < v0*2.0:
        v*=1.05
        jba.setVoltage(v)
        jba._acqiris.bifurcationMap(ntimes = ntimes)
        p = jba._acqiris.Psw()[variable]
      vmax = v
      
      v = v0
      jba.setVoltage(v)
      jba._acqiris.bifurcationMap(ntimes = ntimes)
      p = jba._acqiris.Psw()[variable]
      
      while p < 0.98 and v > v0/2.0:
        v/=1.05
        jba.setVoltage(v)
        jba._acqiris.bifurcationMap(ntimes = ntimes)
        p = jba._acqiris.Psw()[variable]
      vmin = v
      return (vmin*0.95,vmax*1.2)

    try:
      v0 = self.voltage()
      state = self._qubitmwg.output()
      self._attenuator.turnOn()
      data = Datacube("S Curve")
      dataManager = DataManager()
      dataManager.addDatacube(data)
      if microwaveOff:
        self._qubitmwg.turnOff()
      if voltages == None:
        self.notify("status","Searching for proper voltage range...")
        (vmin,vmax) = getVoltageBounds(v0,self,self._params["variable"],ntimes)
        voltages = arange(vmin,vmax,0.005)
        self.notify("status","Measuring S curve in voltage range  [%g - %g]..." % (vmin,vmax))
      for v in voltages:
        self.setVoltage(v)
        self._acqiris.bifurcationMap(ntimes = ntimes)
        data.set(v = v)
        data.set(**(self._acqiris.Psw()))
        data.commit()
        self.notify("sCurve",(data.column("v"),data.column(self._params["variable"])))
    finally:
      self.notify("status","S curve complete.")
      self.setVoltage(v0)
      if state:
        self._qubitmwg.turnOn()
开发者ID:adewes,项目名称:python-qubit-setup,代码行数:56,代码来源:jba.py

示例5: getTrace

# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import column [as 别名]
    def getTrace(self,correctPhase = False,waitFullSweep = False,timeOut = 200):
      print "Getting trace..."
      trace = Datacube()
      if DEBUG:
        print "Getting trace..."
      handle = self.getHandle()
      handle.timeout = timeOut
      if waitFullSweep:
#        freqs = self.ask_for_values("HLD;TRS;WFS;fma;msb;OFV;") 2011/12 VS 
        self.write("TRS;WFS;")
      freqs = self.ask_for_values("fma;msb;OFV;")
      data = self.ask_for_values("fma;msb;OFD;")
      freqs.pop(0)
      data.pop(0)
      mag = []
      phase = []
      #If y length is twice the x length, we got phase and magnitude.
      if len(data) == 2*len(freqs):
        for i in range(0,len(data)):
          if i%2 == 0:	
            mag.append(data[i])
          else:
					 phase.append(data[i])
      else:
        mag = data
      trace.createColumn("freq",freqs)
      trace.createColumn("mag",mag)
      attenuation = float(self.ask("SA1?"))
      power = float(self.ask("PWR?"))
      trace.column("mag")[:]+= attenuation
      params = dict()
      params["attenuation"] = attenuation
      params["power"] = power
      trace.setParameters(params)
      if len(phase) > 0:
        correctedPhase = []
        if correctPhase:
          correctedPhase.append(phase[0])
          oldPhi = phase[0]
          for phi in phase[1:]:
            if fabs(phi+360.0-oldPhi) < fabs(phi-oldPhi):
              newPhi = phi+360.0
            elif fabs(phi-360.0-oldPhi) < fabs(phi-oldPhi):
              newPhi = phi-360.0
            else:
              newPhi = phi
            correctedPhase.append(newPhi)
            oldPhi = newPhi
        else:
          correctedPhase = phase
        trace.createColumn("phase",correctedPhase)
      print "returning trace."
      return trace
开发者ID:adewes,项目名称:python-qubit-setup,代码行数:55,代码来源:vna.py

示例6: sCurves

# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import column [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()
开发者ID:adewes,项目名称:python-qubit-setup,代码行数:95,代码来源:Copie+(2)+de+measure.py

示例7: IqOptimization

# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import column [as 别名]
class IqOptimization(Reloadable):
  
  """
  Optimizes the parameters of an IQ mixer.
  """
  
  def __init__(self,mwg,fsp,awg,channels = [1,2]):
    Reloadable.__init__(self)
    self._mwg = mwg
    self._fsp = fsp
    self._awg = awg
    self._awgChannels = channels
    self.initCalibrationData()
  
  def initCalibrationData(self):
    """
    Initialize the datacubes that contain the IQ calibration data.
    """
    self._offsetCalibrationData = Datacube()
    self._offsetCalibrationData.setName("IQ mixer calibration - Offset Calibration Data")
    self._powerCalibrationData = Datacube()
    self._powerCalibrationData.setName("IQ mixer calibration - Power Calibration Data")
    self._sidebandCalibrationData = Datacube()
    self._sidebandCalibrationData.setName("IQ mixer calibration - Sideband Mixing Calibration Data")
  
  def sidebandCalibrationData(self):
    return self._sidebandCalibrationData
    
  def setSidebandCalibrationData(self,data):
    self._sidebandCalibrationData = data
  
  def offsetCalibrationData(self):
    """
    Return the datacube containing the offset calibration data.
    """
    return self._offsetCalibrationData
  
  def setOffsetCalibrationData(self,data):
    self._offsetCalibrationData = data
    self.updateOffsetCalibrationInterpolation()
    
  def updateOffsetCalibrationInterpolation(self):
    if len(self._offsetCalibrationData.column("frequency"))>1:
      frequencies = self._offsetCalibrationData.column("frequency")
      self._iOffsetInterpolation = scipy.interpolate.interp1d(frequencies,self._offsetCalibrationData.column("lowI"))        
      self._qOffsetInterpolation = scipy.interpolate.interp1d(frequencies,self._offsetCalibrationData.column("lowQ"))
    else:
      self._iOffsetInterpolation=lambda x:self._offsetCalibrationData.column("lowI")[0]
      self._qOffsetInterpolation=lambda x:self._offsetCalibrationData.column("lowQ")[0]

  
  def powerCalibrationData(self):
    """
    Return the datacube containing the power calibration data.
    """
    return self._powerCalibrationData

  def setPowerCalibrationData(self,data):
    self._powerCalibrationData = data
  
  def teardown(self):
  	"""
  	Restore the original configuration.
  	"""
  	self._fsp.loadConfig("IQCalibration")
  	self._awg.loadSetup("iq_calibration.awg")
  	self._mwg.restoreState(self._mwgState)
  
  def setup(self,averaging = 10,reference = -50):
    """
    Configure the AWG and the FSP for the IQ mixer calibration.
    """
    self._fsp.storeConfig("IQCalibration")
    self._awg.saveSetup("iq_calibration.awg")
    self._mwgState = self._mwg.saveState("iq calibration")
    self._fsp.write("SENSE1:FREQUENCY:SPAN 0 MHz")
    period = int(1.0/self._awg.repetitionRate()*1e9)
    self._fsp.write("SWE:TIME 2 ms")
    self._rbw = 1000
    self._fsp.write("SENSE1:BAND:RES %f Hz" % self._rbw)
    self._fsp.write("SENSE1:BAND:VIDEO AUTO")
    self._fsp.write("TRIG:SOURCE EXT")
    self._fsp.write("TRIG:HOLDOFF 0.02 s")
    self._fsp.write("TRIG:LEVEL 0.5 V")
    self._fsp.write("TRIG:SLOP POS")
    self._fsp.write("SENSE1:AVERAGE:COUNT %d" % averaging)
    self._fsp.write("SENSE1:AVERAGE:STAT1 ON")
    self._fsp.write("DISP:TRACE1:Y:RLEVEL %f" % reference)
    self.setupWaveforms()
  	
  def setupWaveforms(self):
    self._awg.write("AWGC:RMOD CONT")
    period = int(1.0/self._awg.repetitionRate()*1e9)
    print period
    waveformOffset = zeros((period))
    waveformActive = zeros((period))+1.0
    waveformPassive = zeros((period))-1.0
    self._markers = zeros((period),dtype = uint8)
    self._markers[1:len(self._markers)/2] = 255
    self._awg.createRawWaveform("IQ_Offset_Calibration",waveformOffset,self._markers,"REAL")
#.........这里部分代码省略.........
开发者ID:adewes,项目名称:python-qubit-setup,代码行数:103,代码来源:iq_level_optimization.py

示例8: measureSCurves

# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import column [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)
开发者ID:adewes,项目名称:python-qubit-setup,代码行数:74,代码来源:Copie+de+measure.py

示例9: sCurves

# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import column [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))
#.........这里部分代码省略.........
开发者ID:adewes,项目名称:python-qubit-setup,代码行数:103,代码来源:measure.py

示例10: Instr

# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import column [as 别名]

#.........这里部分代码省略.........
      if center==None:
        values=linspace(bounds[0],bounds[1],bounds[2])
      else:
        print ''
    
    self.notify('iqP',0)
    ps = []
    maxcov = 0
    maxVoltage = 0
    self.variances = zeros((len(values),2))
    self.variances[:,0] = values
    self.data.clear()
    try:
      self.setAmplitude(magnitudeButton=magnitudeButton, amplitude=values[0])
      time.sleep(0.5)
      for i in range(0,len(values)):
        if self.stopped():
          self._stopped = False
          raise Exception("Got stopped!")
        v = values[i] 
        v=self.setAmplitude(magnitudeButton=magnitudeButton, amplitude=v)
        trends=self.getComponents()
        varsum =cov(trends[0])+cov(trends[1])
        if not dataValues==None:
          ch=Datacube()
          dataValues.addChild(ch)
          ch.createColumn('I',trends[0])
          ch.createColumn('Q',trends[0])
          dataValues.set(v=v,varsum=varsum)
          dataValues.commit()
        self.data.set(v = v)
        self.data.set(varsum=varsum)
        self.data.commit()
        self.notify("variance",(self.data.column("v"),self.data.column("varsum"),((color,0,0))))
        x=1.*i/len(values)
        self.notify("iqP",(trends[0],trends[1],((x,0,1-x))))
        self.notify("status","Variance at %g V: %g" % (v,varsum))
        if DEBUG: print "Variance at v = %f : %f" % (v,varsum)
        self.variances[i,1] = varsum
        ps.append(varsum)
        if varsum > maxcov:
          maxcov = varsum
          maxVoltage = values[i]
      self.setAmplitude(magnitudeButton=magnitudeButton,amplitude=maxVoltage)
      self._vMaxAmplitude=maxVoltage
      self._sCurveParams=fitLorentzian(self.data['varsum'],self.data['v'])
    except:
      raise
    finally:    
      return maxVoltage
    
  def _adjustRotationAndOffset(self,accurate=False):
    frequency=self._fsb
    """
    Only used by function calibrate, use only where the JBA is bi-valued
    To find the rotation angle and offsets to discriminate properly the bi-valued values, at a single frequency, and store thoses values
    """
    trends=self.getComponents()

    if accurate:    
      density,Chi,XY,domain=convertToDensity(trends.transpose())
      e,f,p= fit2D2Gaussian(Chi,XY)
      centers=[[p[2],p[3]],[p[7],p[8]]]
      sepCenter=(mean([centers[0][0],centers[1][0]]),mean([centers[0][1],centers[1][1]]))
      sepAngle=-math.atan2(centers[0][0]-centers[1][0],centers[0][1]-centers[1][1])
    else:
开发者ID:manipp4,项目名称:qubit_setup,代码行数:70,代码来源:jba_sb_old_20140425.py

示例11: Instr

# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import column [as 别名]

#.........这里部分代码省略.........
        trends=self.getComponents(nLoops=nLoops)
        varsum =cov(trends[0])+cov(trends[1])

        x=1.*i/len(values)
        self.notify("iqP",(trends[0],trends[1],((x,0,1-x))))


        if fitModel:
          try:
            fitResults=self.multiGaussianClusters(trends.transpose())
          except:
            raise
          sep=self.separatrixBimodal(fitResults)
          separatrixList.append(sep)

          self.separatrixList=separatrixList
          s=[sep[0]]
          sepCenters=array([[p[0],p[1]] for p in s]).transpose()
          c=sep[3]
          centers=[[c[0][0],c[1][0]],[c[0][1],c[1][1]]]
          self.notify("centersIQ",[sepCenters, centers])


        if not dataValues==None:
          ch=Datacube()
          dataValues.addChild(ch)
          ch.createColumn('I',trends[0])
          ch.createColumn('Q',trends[1])
          dataValues.set(v=v,varsum=varsum)
          dataValues.commit()
        self.data.set(v = v)
        self.data.set(varsum=varsum)
        self.data.commit()
        self.notify("variance",(self.data.column("v"),self.data.column("varsum"),((color,0,0))))
        self.notify("status","Variance at %g V: %g" % (v,varsum))
        if DEBUG: print "Variance at v = %f : %f" % (v,varsum)
        self.variances[i,1] = varsum
        ps.append(varsum)
        if varsum > maxcov:
          maxcov = varsum
          maxVoltage = values[i]
      self.setAmplitude(magnitudeButton=magnitudeButton,amplitude=maxVoltage)
      self._vMaxAmplitude=maxVoltage
    except:
      raise
    finally:    



      # calculate separatrix
      print "fitModel: ",fitModel
      if fitModel:
        self.separatrixList=separatrixList

        sepCenters=[s[0] for s in self.separatrixList]
        centers=[s[3] for s in self.separatrixList]

        self.notify("centersIQ",[sepCenters, centers])

        print "separatrixList: ",separatrixList
        coefs,st=self.separatrixMulti(separatrixList,0.1,0.9)
        I0=separatrixList[len(separatrixList)/2][0][0]
        Q0=coefs[0]*I0+coefs[1]
        angle=arctan(coefs[0])
        self._setRotationAndOffset(I0,Q0,angle)
        self.setAmplitude(amplitude=self.center-abs(self.width)/2)
开发者ID:manipp4,项目名称:qubit_setup,代码行数:70,代码来源:jba_sb.py


注:本文中的pyview.lib.datacube.Datacube.column方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。