本文整理汇总了Python中VISA_Driver.VISA_Driver.performSetValue方法的典型用法代码示例。如果您正苦于以下问题:Python VISA_Driver.performSetValue方法的具体用法?Python VISA_Driver.performSetValue怎么用?Python VISA_Driver.performSetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VISA_Driver.VISA_Driver
的用法示例。
在下文中一共展示了VISA_Driver.performSetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the Set Value instrument operation. This function should
return the actual value set by the instrument"""
# create new channels if needed
if quant.name in ('S11 - Enabled', 'S21 - Enabled', 'S12 - Enabled',
'S22 - Enabled'):
# get updated list of measurements in use
param = quant.name[:3]
self.getActiveMeasurements()
# clear old measurements for this parameter
if param in self.dMeasParam:
for name in self.dMeasParam[param]:
self.writeAndLog("CALC:PAR:DEL '%s'" % name)
# create new measurement, if enabled is true
if value:
newName = 'LabC_%s' % param
self.writeAndLog("CALC:PAR:SDEF '%s','%s'" % (newName, param))
# show on PNA screen
iTrace = 1 + ['S11', 'S21', 'S12', 'S22'].index(param)
self.writeAndLog("DISP:WIND:TRAC%d:FEED '%s'" % (iTrace, newName))
# add to dict with list of measurements
self.dMeasParam[param] = [newName]
elif quant.name in ('Wait for new trace',):
# do nothing
pass
else:
# run standard VISA case
value = VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
return value
示例2: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the Set Value instrument operation. This function should
return the actual value set by the instrument"""
# perform special setValue for delay commands
name = str(quant.name)
if name.endswith(('Start time', 'Start reference',
'Stop time', 'Stop reference')):
# get pulse channel in use
lName = name.split(' ')
key = '%s - %s' % (lName[0], lName[2])
sChannel = '%d' % self.dChCmd[key]
# get buddy quantity
if lName[3] == 'time':
sTime = quant.getCmdStringFromValue(value)
sRef = self.getCmdStringFromValue('%s - %s reference' %
(lName[0], lName[2]))
else:
sTime = self.getCmdStringFromValue('%s - %s time' %
(lName[0], lName[2]))
sRef = quant.getCmdStringFromValue(value)
sCmd = 'DLAY %s,%s,%s' % (sChannel, sRef, sTime)
self.writeAndLog(sCmd)
return value
else:
# for all other quantities, call the generic VISA driver
return VISA_Driver.performSetValue(self, quant, value, sweepRate,
options=options)
示例3: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the Set Value instrument operation. This function should
return the actual value set by the instrument"""
if quant.name == 'Channel 1 Voltage':
self.setVoltage(1, value)
elif quant.name == 'Channel 2 Voltage':
self.setVoltage(2, value)
elif quant.name == 'Channel 3 Voltage':
self.setVoltage(3, value)
elif quant.name == 'Channel 4 Voltage':
self.setVoltage(4, value)
elif quant.name == 'Channel 1 Autosweep':
self.bSweep1 = value
elif quant.name == 'Channel 2 Autosweep':
self.bSweep2 = value
elif quant.name == 'Channel 3 Autosweep':
self.bSweep3 = value
elif quant.name == 'Channel 4 Autosweep':
self.bSweep4 = value
else:
# for all other quantities, call the generic VISA driver
return VISA_Driver.performSetValue(self, quant, value, sweepRate,
options=options)
return value
示例4: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the Set Value instrument operation. This function should return the actual value set by the instrument"""
if quant.name in ('Range type',):
if quant.getValueString(value) == 'Zero-span mode':
# set span to zero
self.sendValueToOther('Span', 0.0)
self.sendValueToOther('# of points', 2.0)
#sweep time should be set to a small value (for example, 10 ms)
self.writeAndLog(':SWE:TIME 1E-3;')
else:
# set lowest possible span to get out of zero-span mode
if self.getValue('Span') < 10:
self.sendValueToOther('Span', 1000000)
if self.getValue('# of points') == 2:
self.sendValueToOther('# of points', 1001)
# sweep time should be set to auto
self.writeAndLog(':SWE:TIME:AUTO 1;')
elif quant.name in ('Wait for new trace',):
# turn on continous acquisition if not waiting
if value == False:
self.writeAndLog(':INIT:CONT ON;')
elif quant.name in ('Trace type CS', 'Trace type CW', 'Measurement Type'):
pass
else:
# run standard VISA case
value = VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
return value
示例5: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the Set Value instrument operation. This function should
return the actual value set by the instrument"""
if quant.name in ('Zero-span mode',):
# set span to zero
if value == True:
quantSpan = self.instrCfg.getQuantity('Span')
self.performSetValue(quantSpan, 0.0)
quantPts = self.instrCfg.getQuantity('# of points')
self.performSetValue(quantPts, 2)
# sweep time should be set to a small value (for example, 10 ms)
self.writeAndLog(':SWE:TIME:AUTO 0;:SWE:TIME 10E-3;')
else:
# set lowest possible span to get out of zero-span mode
quantSpan = self.instrCfg.getQuantity('Span')
self.performSetValue(quantSpan, 100.)
# sweep time should be set to auto
self.writeAndLog(':SWE:TIME:AUTO 1;')
elif quant.name in ('Wait for new trace',):
# turn on continous acquisition if not waiting
if value == False:
self.writeAndLog(':INIT:CONT ON;')
else:
# run standard VISA case
value = VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
return value
示例6: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the Set Value instrument operation. This function should
return the actual value set by the instrument"""
# if quant.name == 'blah':
# self.dsa. _set(value)
# else:
# for all other quantities, call the generic VISA driver
return VISA_Driver.performSetValue(self, quant, value, sweepRate, options=options)
示例7: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the set value operation"""
# check type of quantity: There seems to be a problem with some float type commands... (i.e. oscillator frequency) Use the fixed point version instead.
if quant.name in ("Oscillator Frequency"):
self.writeAndLog(quant.set_cmd + " " + str(int(value * 1000))) # Fixed point version uses mHz
else:
return VISA_Driver.performSetValue(self, quant, value, sweepRate, options=options)
return value
示例8: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the Set Value instrument operation. This function should
return the actual value set by the instrument"""
if quant.name == 'Number of shifts':
self.numRep= value
else:
# for all other quantities, call the generic VISA driver
value = VISA_Driver.performSetValue(self, quant, value, sweepRate, options=options)
return value
示例9: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the Set Value instrument operation. This function should
return the actual value set by the instrument"""
# update visa commands for triggers
if quant.name in ('S11 - Enabled', 'S21 - Enabled', 'S12 - Enabled',
'S22 - Enabled'):
if self.getModel() in ('E5071C',):
# new trace handling, use trace numbers, set all at once
lParam = ['S11', 'S21', 'S12', 'S22']
dParamValue = dict()
for param in lParam:
dParamValue[param] = self.getValue('%s - Enabled' % param)
dParamValue[quant.name[:3]] = value
# add parameters, if enabled
self.dMeasParam = dict()
for (param, enabled) in dParamValue.items():
if enabled:
nParam = len(self.dMeasParam)+1
self.writeAndLog(":CALC:PAR%d:DEF %s" %
(nParam, param))
self.dMeasParam[param] = nParam
# set number of visible traces
self.writeAndLog(":CALC:PAR:COUN %d" % len(self.dMeasParam))
else:
# get updated list of measurements in use
self.getActiveMeasurements()
param = quant.name[:3]
# old-type handling of traces
if param in self.dMeasParam:
# clear old measurements for this parameter
for name in self.dMeasParam[param]:
self.writeAndLog("CALC:PAR:DEL '%s'" % name)
# create new measurement, if enabled is true
if value:
newName = 'LabC_%s' % param
self.writeAndLog("CALC:PAR:EXT '%s','%s'" % (newName, param))
# show on PNA screen
iTrace = 1 + ['S11', 'S21', 'S12', 'S22'].index(param)
# sPrev = self.askAndLog('DISP:WIND:CAT?')
# if sPrev.find('EMPTY')>0:
# # no previous traces
# iTrace = 1
# else:
# # previous traces, add new
# lTrace = sPrev[1:-1].split(',')
# iTrace = int(lTrace[-1]) + 1
self.writeAndLog("DISP:WIND:TRAC%d:FEED '%s'" % (iTrace, newName))
# add to dict with list of measurements
self.dMeasParam[param] = [newName]
elif quant.name in ('Wait for new trace',):
# do nothing
pass
else:
# run standard VISA case
value = VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
return value
示例10: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the Set Value instrument operation. This function should
return the actual value set by the instrument"""
# create new channels if needed
if quant.name in ('Wait for new trace',):
# do nothing
pass
else:
# run standard VISA case
value = VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
return value
示例11: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the Set Value instrument operation. This function should
return the actual value set by the instrument"""
# keep track of if waveform is updated, to avoid sending it many times
if self.isFirstCall(options):
self.bWaveUpdated = False
# if sequence mode, make sure the buffer contains enough waveforms
if self.isHardwareLoop(options):
(seq_no, n_seq) = self.getHardwareLoopIndex(options)
# if first call, clear sequence and create buffer
if seq_no==0:
# variable for keepin track of sequence updating
self.writeAndLog(':AWGC:STOP;')
self.bSeqUpdate = False
# if different sequence length, re-create buffer
if seq_no==0 and n_seq != len(self.lOldU16):
self.lOldU16 = [[np.array([], dtype=np.uint16) \
for n1 in range(self.nCh)] for n2 in range(n_seq)]
elif self.isHardwareTrig(options):
# if hardware triggered, always stop outputting before setting
self.writeAndLog(':AWGC:STOP;')
if quant.name in ('Ch 1', 'Ch 2', 'Ch 3', 'Ch 4',
'Ch 1 - Marker 1', 'Ch 1 - Marker 2',
'Ch 2 - Marker 1', 'Ch 2 - Marker 2',
'Ch 3 - Marker 1', 'Ch 3 - Marker 2',
'Ch 4 - Marker 1', 'Ch 4 - Marker 2'):
# set value, then mark that waveform needs an update
quant.setValue(value)
self.bWaveUpdated = True
elif quant.name in ('Run'):
self.writeAndLog(':AWGC:RUN')
# turn on channels again, to avoid issues when turning on/off run mode
sOutput = ''
for n, bUpdate in enumerate(self.lInUse):
if bUpdate:
sOutput += (':OUTP%d:STAT 1;' % (n+1))
if sOutput != '':
self.writeAndLog(sOutput)
else:
# for all other cases, call VISA driver
value = VISA_Driver.performSetValue(self, quant, value, sweepRate,
options=options)
# if final call and wave is updated, send it to AWG
if self.isFinalCall(options) and self.bWaveUpdated:
(seq_no, n_seq) = self.getHardwareLoopIndex(options)
if self.isHardwareLoop(options):
seq = seq_no
self.reportStatus('Sending waveform (%d/%d)' % (seq_no+1, n_seq))
else:
seq = None
bStart = not self.isHardwareTrig(options)
self.sendWaveformAndStartTek(seq=seq, n_seq=n_seq, bStart=bStart)
return value
示例12: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
if quant.name == 'RF Frequency 1':
self.f1 = float(value)
self.reset()
elif quant.name == 'RF Frequency 2':
self.f2 = float(value)
self.reset()
else:
# for all other quantities, call the generic VISA driver
return VISA_Driver.performSetValue(self, quant, value, sweepRate, options=options)
return value
示例13: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the Set Value instrument operation. This function should
return the actual value set by the instrument"""
# update visa commands for triggers
if quant.name == 'Trig slope':
sTrig = self.getCmdStringFromValue('Trig source')
quant.set_cmd = '%s:TRSL' % sTrig
elif quant.name == 'Trig level':
sTrig = self.getCmdStringFromValue('Trig source')
quant.set_cmd = '%s:TRLV' % sTrig
# run standard VISA case with updated commands
value = VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
return value
示例14: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the Set Value instrument operation. This function should
return the actual value set by the instrument"""
# check quantity
if quant.name == 'Magnetic Field':
if sweepRate != 0:
# sweep rate should be in T/min
self.writeAndLog('$T'+ str(sweepRate*60.0))
self.writeAndLog('$J'+ str(value))
self.writeAndLog('$A1')
else:
# run standard VISA case
value = VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
return value
示例15: performSetValue
# 需要导入模块: from VISA_Driver import VISA_Driver [as 别名]
# 或者: from VISA_Driver.VISA_Driver import performSetValue [as 别名]
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
"""Perform the Set Value instrument operation. This function should
return the actual value set by the instrument"""
# keep track of if waveform is updated, to avoid sending it many times
if self.isFirstCall(options):
self.bWaveUpdated = False
if quant.name in ('Arb. Waveform',):
# set value, then mark that waveform needs an update
quant.setValue(value)
self.bWaveUpdated = True
else:
# for all other cases, call VISA driver
value = VISA_Driver.performSetValue(self, quant, value, sweepRate,
options=options)
# if final call and wave is updated, send it to AWG
if self.isFinalCall(options) and self.bWaveUpdated:
self.sendWaveform()
return value