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


Python VISA_Driver.writeAndLog方法代码示例

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


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

示例1: performStopSweep

# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import writeAndLog [as 别名]
 def performStopSweep(self, quant, options={}):
     # This command is only necessary if in ramp mode
     if quant.name.startswith("Voltage"):
         mode = self.getValue("Voltage Mode")
     elif quant.name.startswith("Current"):
         mode = self.getValue("Voltage Mode")
     else:
         # if it is some other quant, call default function
         VISA_Driver.performStopSweep(self, quant, options)
     if mode == "Ramp":
         VISA_Driver.writeAndLog(self, "ABOR")
开发者ID:Labber-software,项目名称:Drivers,代码行数:13,代码来源:Keysight_B2961A.py

示例2: clearMessages

# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import writeAndLog [as 别名]
 def clearMessages(self):
     #Send version request so message buffer isn't empty
     VISA_Driver.writeAndLog(self,'V')
     #Read message buffer in full, to clear any messages that were not previously cleared
     #(Uncleared messages seem to arise from fact that device seems to be comparatively slow to reply)
     reply = VISA_Driver.read(self,ignore_termination=True)
     self.log("Message buffer read on initialisation: "+reply)
     while not reply.startswith('IPS120'):
         #There was an error or incorrect value, try to clear message buffer again
         reply = VISA_Driver.read(self,ignore_termination=True)
         self.wait(delayTime)
         self.log("Message buffer read again: "+reply)
开发者ID:Labber-software,项目名称:Drivers,代码行数:14,代码来源:Oxford_PS120.py

示例3: checkIfSweeping

# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import writeAndLog [as 别名]
 def checkIfSweeping(self, quant, options={}):
     #Can't create quant instances from here, can only pass name of quant
     #Whereas system
     if type(quant) == str:
         name = quant
     else:
         name = quant.name
     if name == 'Source Voltage Level' or name == 'Source Current Level':
         #If sweeping, can't go into program edit mode
         #Can't see any other way of checking if program is running
         VISA_Driver.writeAndLog(self,'*CLS') #Clear any existing errors
         VISA_Driver.writeAndLog(self,'PROG:EDIT:STAR') #force an error if program running
         err = VISA_Driver.askAndLog(self,'SYST:ERR?') #Check if there's a 'program running' error
         #Separate error code and error message
         #error code = 0 -> no errors
         errCode = int(err.split(',')[0])
         if errCode == -284:
             #There is a 'program running' error, so program must be sweeping
             return True
         elif errCode == 103:
             #There is a 'program being edited error' for some reason. Stop editing
             self.log("Program didn't stop properly")
             VISA_Driver.writeAndLog(self,'PROG:EDIT:END')
             return False
         else:
             VISA_Driver.writeAndLog(self,'PROG:EDIT:END')
             return False
     else:
         #Not checking one of the quants that can sweep
         return False
开发者ID:Labber-software,项目名称:Drivers,代码行数:32,代码来源:Yokogawa_GS200.py

示例4: performOpen

# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import writeAndLog [as 别名]
 def performOpen(self,options={}):
     VISA_Driver.performOpen(self,options)
     self.wait(delayTime)
     """
     #Switch to remote & unlocked mode
     #(command already in 'init:' field in INI file)
     VISA_Driver.writeAndLog('$C3')
     """
     self.clearMessages()
     #Switch to extended resolution
     VISA_Driver.writeAndLog(self,'$Q4')
     #Clear clamped status, if applicable
     VISA_Driver.writeAndLog(self,'$A0')
     self.wait(delayTime)
开发者ID:Labber-software,项目名称:Drivers,代码行数:16,代码来源:Oxford_PS120.py

示例5: performStopSweep

# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import writeAndLog [as 别名]
 def performStopSweep(self,quant,options={}):
     VISA_Driver.writeAndLog(self,'SWEEP:HALT')
开发者ID:Labber-software,项目名称:Drivers,代码行数:4,代码来源:Marconi_2026_multisource_generator.py

示例6: performSetValue

# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import writeAndLog [as 别名]
    def performSetValue(self, quant, value, sweepRate=0.0, options={}):
        couplingModes = ['Coupling CFRQAB','Coupling CFRQAC','Coupling RFLVAB','Coupling RFLVAC']
        self.log('Quant.name is: '+quant.name+' Set value')
        if quant.name[-1] == ')':
            #Add source selection string to beginning of every
            #source specific command (ensure setting affects right source)
            source = quant.name[-2]
            sourceCmd = 'SOURCE '+source+'; :'
        if quant.name == 'Combiner Mode':
            VISA_Driver.writeAndLog(self,'CMODE '+value)
            return value
        elif quant.name == couplingModes[0]:
            """
            This function sets all coupling modes at once, so it should
            only be called once per set_config action.

            Note: COUPLING:MODE CFRQAB (for example) makes CFRQAB the only mode
            I.e. modes can't be added one by one
            """
            modeCmds = []
            for cMode in couplingModes:
                if self.getValue(cMode) == True:
                    self.log('Adding: '+cMode)
                    modeCmds.append(cMode.split(' ')[1])
            if len(modeCmds) == 0:
                cmdStr = 'COUPLING:MODE DISABLED'
            else:
                cmdStr = 'COUPLING:MODE '+','.join(modeCmds)
            VISA_Driver.writeAndLog(self,cmdStr)
        elif quant.name in couplingModes:
            pass
        elif quant.name.startswith('Coupling'):
            cmd = quant.name.split(' ')
            """
            cmd[0] = 'Coupling'
            cmd[1] = one of the coupling modes
            cmd[2] = MODE, HARM, SUBHARM, OFFSET
            """
            if cmd[2] == 'MODE':
                comboDict = {'Harmonic':'HARM','Sub-harmonic':'SUBHARM'}
                VISA_Driver.writeAndLog(self,'COUPLING:'+cmd[1]+':'+cmd[2]+' '+comboDict[value])
            else:
                VISA_Driver.writeAndLog(self,'COUPLING:'+cmd[1]+':'+cmd[2]+' '+str(value))
        elif quant.name.startswith('Carrier Frequency'):
            initValue = self.readValueFromOther(quant.name,options)
            initValue = float(initValue)
            if value == initValue:
                return initValue
            elif sweepRate != 0:
                """
                Sweeping is done by continuously setting frequency
                Minimum time between steps is 50msec
                """
                valueDiff = value - initValue
                time = abs(valueDiff)/sweepRate
                increment = 0.05*sweepRate
                #Sweep to point
                cmd = 'SWEEP:'+sourceCmd
                cmd += 'SWEEP:TRIG STARTSTOP; '
                cmd += 'SWEEP:CFRQ:START '+str(initValue)+'; '
                cmd +='STOP '+str(value)+'; '
                cmd += 'TIME 0.05S; '
                cmd += 'INC '+str(increment)+'; '
                cmd += ':SWEEP:GO'
                VISA_Driver.writeAndLog(self,cmd)
            else:
                VISA_Driver.writeAndLog(self,sourceCmd+'CFRQ:VALUE '+str(value)+'HZ')
        elif quant.name.startswith('Carrier Phase offset'):
            VISA_Driver.writeAndLog(self,sourceCmd+'CFRQ:PHASE '+str(value)+'DEG')
        elif quant.name.startswith('RF Output On'):
            if value:
                VISA_Driver.writeAndLog(self,sourceCmd+'RFLV:ON')
            else:
                VISA_Driver.writeAndLog(self,sourceCmd+'RFLV:OFF')
        elif quant.name.startswith('RF Level'):
            VISA_Driver.writeAndLog(self,sourceCmd+'RFLV:VALUE '+str(value)+'DBM')
        elif quant.name.startswith('RF Type'):
            VISA_Driver.writeAndLog(self,sourceCmd+'RFLV:TYPE '+str(value))
        elif quant.name.startswith('Modulation Control'):
            if value:
                VISA_Driver.writeAndLog(self,sourceCmd+'MOD:ON')
            else:
                VISA_Driver.writeAndLog(self,sourceCmd+'MOD:OFF')
        elif quant.name.startswith('Modulation mode'):
            modeList = []
            pulse = self.getValue('Pulse Modulation ('+source+')')
            if 'AM' in value:
                modeList.append('AM')
            if 'FM' in value:
                modeList.append('FM')
            if 'PM' in value:
                modeList.append('PM')
            if 'FSK2L' in value:
                modeList.append('FSK2L')
            if 'FSK4L' in value:
                modeList.append('FSK4L')
            if pulse:
                modeList.append('PULSE')
            VISA_Driver.writeAndLog(self,'MODE '+','.join(modeList))
        elif quant.name.startswith('Frequency Modulation Type'):
#.........这里部分代码省略.........
开发者ID:Labber-software,项目名称:Drivers,代码行数:103,代码来源:Marconi_2026_multisource_generator.py

示例7: performSetValue

# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import writeAndLog [as 别名]
 def performSetValue(self, quant, value, sweepRate=0.001, options={}):
     if quant.name == 'Output':
         if value:
             VISA_Driver.writeAndLog(self,'OUTP:STAT ON')
             return True
         else:
             #Sweep source to zero before turning off, to avoid sudden jumps
             func = self.getValue('Function')
             if func == 'Voltage':
                 self.sendValueToOther('Source Voltage Level',0)
                 while self.checkIfSweeping('Source Voltage Level',options):
                     self.wait(0.05)
             elif func == 'Current':
                 self.sendValueToOther('Source Current Level',0)
                 while self.checkIfSweeping('Source Current Level',options):
                     self.wait(0.05)
             VISA_Driver.writeAndLog(self,'OUTP:STAT OFF')
             return False
     elif quant.name == 'Function':
         if value == 'Voltage':
             VISA_Driver.writeAndLog(self,'SOUR:FUNC VOLT')
             return 'Voltage'
         elif value == 'Current':
             VISA_Driver.writeAndLog(self,'SOUR:FUNC CURR')
             return 'Current'
     elif quant.name == 'Source Current Range' or quant.name == 'Source Voltage Range':
         VISA_Driver.writeAndLog(self,'SOUR:RANG '+str(value))
         return value
     elif quant.name == 'Source Voltage Level' or quant.name == 'Source Current Level':
         self.log(quant.name+' value passed: '+str(value))
         self.log('Sweep rate: '+str(sweepRate))
         #Check current source level
         initValue = float(self.askAndLog('SOUR:LEV?'))
         if value == initValue:
             #if no change, do nothing
             return float(value)
         else:
             #It seems sometimes sweepRate is not passed to this function (e.g. when setting config)
             # Ensure that this never causes a jump in source levels
             if quant.name == 'Source Voltage Level':
                 maxSweepRate = 0.03 #30mV/sec or 1.8V/min
             else:
                 maxSweepRate = 0.03 #30mA/sec or 1.8A/min
             if sweepRate == 0 or sweepRate > maxSweepRate:
                 sweepRate = maxSweepRate
             difference = abs(value - initValue)
             duration = difference/abs(sweepRate)
             #Note minimum duration is 0.1s
             duration = max(duration,0.1)
             cmd1 = 'PROG:REP 0; '               #Program doesn't repeat
             cmd2 = 'SLOP '+str(duration)+'; '   #Source takes this long to move between values
             cmd3 = 'INT '+str(duration)+'; '    #This much time between program steps
             cmd4 = 'EDIT:STAR; '                #Add points to program
             cmd5 = ':SOUR:LEV '+str(value)+'; ' #Add target point
             cmd6 = ':PROG:EDIT:END; '           #Stop adding points to program
             cmd7 = ':PROG:RUN'                  #Run program
             sCmd = cmd1+cmd2+cmd3+cmd4+cmd5+cmd6+cmd7
             VISA_Driver.writeAndLog(self,sCmd)  #Combine all the above into one string, then send it
             return float(value)
     else:
         self.log('No other quant names triggered: '+quant.name)
         return VISA_Driver.performSetValue(self,quant,value,options,sweepRate)
开发者ID:Labber-software,项目名称:Drivers,代码行数:64,代码来源:Yokogawa_GS200.py

示例8: performOpen

# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import writeAndLog [as 别名]
 def performOpen(self, options={}):
     VISA_Driver.performOpen(self, options=options)
     # Set the format for the output
     VISA_Driver.writeAndLog(self, "FORM:ELEM:SENS VOLT,CURR,RES")
     # Put source modes to fixed (rather than sweep)
     VISA_Driver.writeAndLog(self, "SOUR:CURR:MODE FIX; :SOUR:VOLT:MODE FIX")
开发者ID:Labber-software,项目名称:Drivers,代码行数:8,代码来源:Keysight_B2961A.py

示例9: performSetValue

# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import writeAndLog [as 别名]
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     self.log("performSetValue called: " + quant.name + " value: " + str(value))
     if quant.name == "Voltage Mode":
         if value == "Fixed":
             VISA_Driver.writeAndLog(self, "SOUR:VOLT:MODE FIX")
         elif value == "Ramp":
             # General settings for ramp function
             # Rtime, start:level, end:level are set when actually sweeping
             cmd = []
             cmd.append("SOUR:VOLT:MODE ARB")
             cmd.append("SOUR:ARB:FUNC:SHAP RAMP")
             cmd.append("SOUR:ARB:COUN 1")
             cmd.append("SOUR:ARB:VOLT:RAMP:END:TIME 0")
             cmd.append("SOUR:ARB:VOLT:RAMP:STAR:TIME 0")
             sCmd = cmd.join("; :")
             VISA_Driver.writeAndLog(self, sCmd)
     elif quant.name.endswith("Amplitude"):
         # Voltage Amplitude
         # Current Amplitude
         if quant.name.startswith("Voltage"):
             cmd = "SOUR:VOLT"
             maxOutpDiff = 0.005  # Never change by more than 5mV
         else:
             cmd = "SOUR:CURR"
             maxOutpDiff = 0.001  # Never change by more than 1 mA
         initValue = VISA_Driver.askAndLog(self, cmd + "?")
         outpDiff = value - float(initValue)
         if outpDiff == 0:
             # Don't send if already at right value
             return value
         elif outpDiff > maxOutpDiff:
             # If program is trying to move to a value too far away instantly,
             #  then override by changing value
             value = initValue + maxOutpDiff
         elif outpDiff < -maxOutpDiff:
             value = initValue - maxOutpDiff
         # Enter the (modified or unmodified) value
         VISA_Driver.writeAndLog(self, cmd + " " + str(value))
         return value
     elif quant.name.endswith(" Ramp"):
         if quant.name.startswith("Voltage"):
             cmd = "SOUR:VOLT"
             cmd2 = "SOUR:ARB:VOLT:RAMP"
             maxSweepRate = 0.005  # Never sweep faster than 5mV/sec
         elif quant.name.startswith("Current"):
             cmd = "SOUR:CURR"
             cmd2 = "SOUR:ARB:CURR:RAMP"
             maxSweepRate = 0.001  # Never sweep faster than 1mA/sec
         self.log("getting init value for ramp")
         initValue = float(VISA_Driver.askAndLog(self, cmd + "?"))
         outpDiff = value - initValue
         if sweepRate == 0 or sweepRate > maxSweepRate:
             sweepRate = maxSweepRate
         rTime = abs(outpDiff) / sweepRate
         cmd = []
         cmd.append(cmd2 + ":END:LEV " + str(value))
         cmd.append(cmd2 + ":RTIM " + str(rTime))
         cmd.append(cmd2 + ":STAR:LEV " + str(initValue))
         cmd.append("TRIG")  # Sends an immediate trigger for both source and measure actions
         sCmd = "; :".join(cmd)
         VISA_Driver.writeAndLog(self, sCmd)
     elif quant.name.startswith("Measure "):
         # Enable appropriate functions, if something has been updated
         if self.isConfigUpdated():
             # Determine which variables are being measured
             quantDict = {
                 "Measure Current": ["CURR", False],
                 "Measure Voltage": ["VOLT", False],
                 "Measure Resistance": ["RES", False],
             }
             for key, list in quantDict.items():
                 list[1] = self.getValue(key)
                 if list[1]:
                     VISA_Driver.writeAndLog(self, "FUNC:ON " + list[0])
                 else:
                     VISA_Driver.writeAndLog(self, "FUNC:OFF " + list[0])
         return value
     elif quant.name == "Measurement Speed Method":
         # No commands sent to device for this quantity
         return value
     else:
         return VISA_Driver.performSetValue(self, quant, value, options=options, sweepRate=sweepRate)
开发者ID:Labber-software,项目名称:Drivers,代码行数:84,代码来源:Keysight_B2961A.py

示例10: performSetValue

# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import writeAndLog [as 别名]
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     self.log('performSetValue called: '+quant.name+' value: '+str(value))
     if quant.name == 'Source on_off':
         if value == 'On':
             VISA_Driver.writeAndLog(self,'OUTP:STAT 1')
             return 'On'
         else:
             #Sweep source to zero before turning off, to avoid sudden jumps
             func = self.getValue('Source function')
             if func == 'Voltage':
                 self.sendValueToOther('Voltage Amplitude',0)
                 while self.sendValueToOther('Voltage Amplitude',0) != 0:
                     self.wait(0.1)
             elif func == 'Current':
                 self.sendValueToOther('Current Amplitude',0)
                 while self.sendValueToOther('Voltage Amplitude',0) != 0:
                     self.wait(0.1)
             VISA_Driver.writeAndLog(self,'OUTP:STAT 0')
             return 'Off'
     elif quant.name.endswith('Amplitude'):
         #Voltage Amplitude
         #Current Amplitude
         if quant.name.startswith('Voltage'):
             cmd = 'SOUR:VOLT'
             maxOutpDiff = 0.0005 #5mV/s
             #Program sets source every 0.1 seconds, so sweepRate = outpDiff/0.1 = 10*outpDiff
             #Note minimum output change is 5uV.
         else:
             cmd = 'SOUR:CURR'
             maxOutpDiff = 0.0001
         initValue = float(VISA_Driver.askAndLog(self,cmd+'?'))
         outpDiff = value-initValue
         if outpDiff == 0:
             #Don't send if already at right value
             return value
         elif outpDiff > maxOutpDiff:
             #If program is trying to move to a value too far away instantly,
             #  then override by changing value
                 value = initValue+maxOutpDiff
         elif outpDiff < -maxOutpDiff:
                 value = initValue-maxOutpDiff
         #Enter the (modified or unmodified) value
         VISA_Driver.writeAndLog(self,cmd+' '+str(value))
         return value
     elif quant.name.startswith('Measure '):
         #Determine which variables are being measured
         quantDict = {'Measure Current':['CURR',False], \
                      'Measure Voltage':['VOLT',False], \
                      'Measure Resistance':['RES',False]}
         for key,list in quantDict.items():
             list[1] = self.getValue(key)
         
         #If only one, turn off concurrency
         if sum(list[1] for list in quantDict.values()) == 1:
             VISA_Driver.writeAndLog(self,'FUNC:CONC 0')
         else:
             VISA_Driver.writeAndLog(self,'FUNC:CONC 1')
         
         #Enable appropriate functions
         for key,list in quantDict.items():
             if list[1]:
                 VISA_Driver.writeAndLog(self,'FUNC:ON '+'"'+list[0]+'"')
             else:
                 VISA_Driver.writeAndLog(self,'FUNC:OFF '+'"'+list[0]+'"')
         return value
     elif quant.name.endswith('Range Mode'):
         #convert auto/manual to auto on, auto off
         comboDict = {'Manual':'0','Automatic':'1'}
         value = comboDict[value]
         #Check source mode
         func = self.getValue('Source function')
         if quant.name.startswith('Voltage'):
             if func == 'Voltage':
                 #If quant matches source mode, set source range
                 VISA_Driver.writeAndLog(self,'SOUR:VOLT:RANG:AUTO '+value)
             else:
                 #Otherwise, set measurement range
                 VISA_Driver.writeAndLog(self,'SENS:VOLT:RANG:AUTO '+value)
         elif quant.name.startswith('Current'):
             if func == 'Current':
                 VISA_Driver.writeAndLog(self,'SOUR:CURR:RANG:AUTO '+value)
             else:
                 VISA_Driver.writeAndLog(self,'SENS:CURR:RANG:AUTO '+value)
         elif quant.name.startswith('Resistance'):
             #If using manual resistance mode, do nothing
             if self.getValue('Resistance Measurement Mode') == 'Automatic':   
                 VISA_Driver.writeAndLog(self,'SENS:RES:RANG:AUTO '+value)
         return int(value)
     elif quant.name == 'Voltage Manual Range' or quant.name == 'Current Manual Range' :
         #Check source mode
         func = self.getValue('Source function')
         if quant.name.startswith('Voltage'):
             if func == 'Voltage':
                 #If quant matches source mode, set source range
                 VISA_Driver.writeAndLog(self,'SOUR:VOLT:RANG '+str(value))
             else:
                 #Otherwise, set compliance rainge and measurement range
                 VISA_Driver.writeAndLog(self,'SENS:VOLT:PROT '+str(value*1.1))
                 VISA_Driver.writeAndLog(self,'SENS:VOLT:RANG '+str(value))
         elif quant.name.startswith('Current'):
#.........这里部分代码省略.........
开发者ID:Labber-software,项目名称:Drivers,代码行数:103,代码来源:Keithley_6430_SMU.py


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