本文整理汇总了Python中visa.instrument函数的典型用法代码示例。如果您正苦于以下问题:Python instrument函数的具体用法?Python instrument怎么用?Python instrument使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了instrument函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _find_connection
def _find_connection(self):
"""Find the appropriate GPIB connection
"""
instrument_list = []
print visa.get_instruments_list()
for instrument in visa.get_instruments_list():
if instrument.startswith("GPIB"):
temp_conn = visa.instrument(instrument)
try:
response = temp_conn.ask("*IDN?")
except VisaIOError:
# Need to release connection somehow!
print "Cannot connect with %s" % instrument
temp_conn.write("GTL")
raise
if response.startswith("*IDN LE"):
instrument_list.append(instrument)
if len(instrument_list)==0:
raise ScopeException("Cannot find LeCroy684 GPIB")
elif len(instrument_list)==1:
return visa.instrument(instrument_list[0])
else:
print "Select instrument:"
for i, instrument in enumerate(instrument_list):
temp_conn = visa.instrument(instrument)
print "\t%s:\t%s" % (i, temp_conn.ask("*IDN?"))
number = raw_input("Make selection [number]: ")
return visa_instrument(instrument_list[number])
开发者ID:Sussex-Invisibles,项目名称:leCroyComms,代码行数:28,代码来源:scope.py
示例2: get_instrument
def get_instrument(self, name, param_type=None):
"""Return an instrument instance
name : the name of the instrument
name can be
- a number (item in the list of detected instrument)
- a string representing the visa resource name or id
param_type : 'number', 'resource_name', 'resource_id'
if None, try to automatically detect the param_type
"""
if param_type is None:
if type(name) is int:
param_type = 'number'
else:
if name.find('::')>=0:
param_type = "resource_name"
else:
param_type = "resource_id"
if param_type=='number':
return visa.instrument(self.resource_names[name])
elif param_type=='resource_name':
return visa.instrument(name)
else:
return visa.instrument(self.resource_names[self.resource_ids.index(name)])
开发者ID:mookins,项目名称:PyTektronixScope,代码行数:25,代码来源:VisaList.py
示例3: WriteVToKeithley
def WriteVToKeithley(self, voltage):
"""Sets the Keithley to a specified voltage and returns a single reading"""
try:
wx.Sleep(0.2)
visa.instrument("GPIB::22").write("SOUR:VOLT " + str(voltage))
wx.Sleep(0.2)
return visa.instrument("GPIB::22").ask("READ?")
except:
self.errorMessage("An error talking to the keithley has occurred")
开发者ID:aricsanders,项目名称:pyMeasureOld,代码行数:9,代码来源:SimpleIVFrame1.py
示例4: OnButton1Button
def OnButton1Button(self, event):
[vStart, vStop, numSteps] = [self.VoltStart.GetValue(), self.VoltStop.GetValue(), self.numSteps.GetValue()]
vList = self.MakeVList(vStart, vStop, numSteps)
self.outFile = []
self.IntializeKeithley()
for index, v in enumerate(vList):
self.outFile.append([index, self.WriteVToKeithley(v)])
visa.instrument("GPIB::22").write("CURR:RANG:AUTO ON")
self.errorMessage("Done!")
self.WriteVToKeithley(0)
开发者ID:aricsanders,项目名称:pyMeasureOld,代码行数:12,代码来源:SimpleIVFrame1.py
示例5: connect
def connect(self):
if (self.communicationProtocol is 'serial') or (self.communicationProtocol is 'usb'):
if self.instrumentAddress is not None:
#if user specified instrument address, try connecting to it
try:
self.handle = visa.instrument(self.instrumentAddress)
#set termination characters so instrument knows when to stop listening and execute a command
self.handle.term_chars = self.terminationCharacters
if self.get_id() == self.id:
print '%s connected to %s.' % (self.name, self.instrumentAddress)
else:
#wrong instrument
raise Exception('The instrument you are attempting to connect to does not match its corresponding object class')
self.disconnect()
except:
print 'Could not connect to %s.' % self.instrumentAddress
else:
#if user did not specify instrument address, try connecting to all available addresses
for instrumentAddress in INSTRUMENT_ADDRESSES:
if self.instrumentAddress is None:
try:
self.handle = visa.instrument(instrumentAddress)
#set termination characters so instrument knows when to stop listening and execute a command
self.handle.term_chars = self.terminationCharacters
if self.get_id() == self.id:
print '%s connected to %s.' % (self.name, instrumentAddress)
self.instrumentAddress = instrumentAddress
break
else:
#wrong instrument
self.disconnect()
except:
pass
elif self.communicationProtocol is 'ethernet':
#check if device can connect via ethernet
if self.ipAddress is None:
print 'Error. This instrument has not been configured to connect via ethernet. Please specify the instrument\'s IP address in its corresponding JSON file.'
else:
try:
self.handle = visa.instrument(self.ipAddress)
#set termination characters so instrument knows when to stop listening and execute a command
self.handle.term_chars = self.terminationCharacters
if self.get_id() == self.id:
print '%s connected to %s.' % (self.name, self.ipAddress)
else:
#wrong instrument
raise Exception('The instrument you are attempting to connect to does not match its corresponding object class')
self.disconnect()
except:
print 'Could not connect to %s.' % ipAddress
开发者ID:alexoz,项目名称:MTest,代码行数:52,代码来源:mtest.py
示例6: detect
def detect(self):
try:
from visa import get_instruments_list, instrument, no_parity
except:
return []
devlist = get_instruments_list()
retval = []
for handle in devlist:
if (handle.find("COM") != -1):
try:
instr = instrument(handle, baud_rate=921600, data_bits=8, stop_bits=1, parity=no_parity, timeout = 0.1, term_chars = "\r\n")
version = instr.ask("VE")
except:
version = ""
if (version.find("AG-UC8") != -1 ):
for ax in range(1,5): # motion controller - probe axes
try:
print "probe AG-UC8 axis ", ax
ID = instr.ask(str(ax) + " TS")[3:]
err = int(instr.ask("TE")[-1])
print ID
if(ID != "" and err == 0):
retval.append([handle,"Ax:"+str(ax)+" "+version,ax])
else:
print "Error "+err
except:
print "exception"
return retval
开发者ID:vpaeder,项目名称:terapy,代码行数:29,代码来源:aguc8.py
示例7: __init__
def __init__(self, name, address, reset=False):
Instrument.__init__(self, name)
self._address = address
self._visa = visa.instrument(self._address)
self.add_parameter('identification',
flags=Instrument.FLAG_GET)
self.add_parameter('internal_temperature',
flags=Instrument.FLAG_GET,
type=types.FloatType,
units='deg C')
self.add_parameter('probe1_temperature',
flags=Instrument.FLAG_GET,
type=types.FloatType,
units='deg C')
self.add_parameter('probe2_temperature',
flags=Instrument.FLAG_GET,
type=types.FloatType,
units='deg C')
self.add_parameter('humidity',
flags=Instrument.FLAG_GET,
type=types.FloatType,
units='percent')
if reset:
self.reset()
else:
self.get_all()
开发者ID:AdriaanRol,项目名称:measurement,代码行数:33,代码来源:Thorlabs_TSP01.py
示例8: __init__
def __init__(self, name, address, reset=False):
Instrument.__init__(self, name)
self._address = address
self._visa = visa.instrument(self._address)
self.add_parameter('identification',
flags=Instrument.FLAG_GET)
self.add_parameter('power',
flags=Instrument.FLAG_GET,
type=types.FloatType,
units='W')
self.add_parameter('head_info',
flags=Instrument.FLAG_GET,
type=types.StringType)
self.add_parameter('wavelength',
flags=Instrument.FLAG_GETSET,
type=types.FloatType,
units='m')
if reset:
self.reset()
else:
self.get_all()
开发者ID:CaoXiPitt,项目名称:Qtlab,代码行数:27,代码来源:Thorlabs_PM100D.py
示例9: __init__
def __init__(self, name, address, reset=False):
'''
Input:
name (string) : name of the instrument
address (string) : GPIB address
'''
logging.info(__name__ + ' : Initializing instrument JDSU_SWS15101')
Instrument.__init__(self, name, tags=['physical'])
# Add some global constants
self._address = address
self._visainstrument = visa.instrument(self._address)
self.add_parameter('power',
flags=Instrument.FLAG_GETSET, units='mW', minval=0, maxval=10, type=types.FloatType)
self.add_parameter('diode_current',
flags=Instrument.FLAG_GETSET, units='mA', minval=0, maxval=150, type=types.FloatType)
self.add_parameter('wavelength',
flags=Instrument.FLAG_GETSET, units='nm', minval=1460, maxval=1600, type=types.FloatType)
self.add_parameter('output_status',
flags=Instrument.FLAG_GETSET, type=types.BooleanType)
self.add_parameter('FSCWaveL',
flags=Instrument.FLAG_SET, units='pm', minval=-22.4, maxval=+22.4, type=types.FloatType)
self.add_function ('get_all')
开发者ID:CaoXiPitt,项目名称:Qtlab,代码行数:25,代码来源:JDSU_SWS15101.py
示例10: signal_analyzer_init
def signal_analyzer_init():
signal_analyzer = visa.instrument(SIGNAL_ANALYZER_ADDR)
signal_analyzer_preset(signal_analyzer)
signal_analyzer.write('UNIT:POW DBM')
signal_analyzer.write('INIT:CONT 0')
return signal_analyzer
开发者ID:loxodes,项目名称:antenna_rotator,代码行数:7,代码来源:signal_analyzer_control.py
示例11: __init__
def __init__(self):
resource_names = []
find_list, return_counter, instrument_description = \
vpp43.find_resources(visa.resource_manager.session, "?*")
resource_names.append(instrument_description)
for i in range(return_counter - 1):
resource_names.append(vpp43.find_next(find_list))
# print "\nVisa resources found:"
# for a in range(len(resource_names)):
# print a, resource_names[a]
# print "Attempting to Identify Instruments. Please Wait..."
resource_ids = []
for a in range(len(resource_names)):
interface_type, _ = \
vpp43.parse_resource(visa.resource_manager.session, resource_names[a])
if interface_type == visa.VI_INTF_ASRL:
resource_ids.append("RS232 not Supported")
else:
try:
tempscope = visa.instrument(resource_names[a], timeout = 10)
scopename = tempscope.ask("*IDN?")
scopename = scopename.split(',')
resource_ids.append(scopename[0] + '-' + scopename[1] + \
' ' + scopename[2])
except visa.VisaIOError:
resource_ids.append(" No Instrument Found ")
except:
resource_ids.append(" Error Communicating with this device")
self.resource_names = resource_names
self.resource_ids = resource_ids
开发者ID:mookins,项目名称:PyTektronixScope,代码行数:33,代码来源:VisaList.py
示例12: __init__
def __init__(self):
self.PicoVisa = visa.instrument("GPIB0::20::INSTR",delay=0.04)
self.PicoVisa.write("HDR0")
self.PicoVisa.write("ARN 1")
self.PicoVisa.write("REM 1")
self.TCSVisa = VisaSubs.InitializeSerial("ASRL5",idn="ID?",term_chars="\\n")
address = ('localhost',18871)
self.Server = SocketUtils.SockServer(address)
self.ResThermometer = 1
self.Temperature = 0.0
self.PicoChannel = 0
self.PicoRange = 0
self.SetTemp = -1
self.Status = -1
self.TCSHeater = [0,0,0]
self.TCSRange = [1,1,1]
self.TCSCurrent = [0,0,0]
self.ConstCurrent = False
self.CurrentConst = 0
self.DeltaTemp = 0
self.MaxTemp = 5000
self.MaxCurrent = 25000
self.ErrorTemp = 10 # The acceptable error in temperature
self.ErrorDeltaTemp = 10 # The acceptable stability
self.Sweep = False
self.SweepStart = 0
self.SweepFinish = 0
self.SweepRate = 0 # rate in mK/s
self.SweepTime = 0
self.SweepDirection = 1.0
return
开发者ID:ectof,项目名称:Fridge,代码行数:31,代码来源:TDaemon.py
示例13: detect
def detect(self):
try:
from visa import get_instruments_list, instrument
except:
return []
devlist = get_instruments_list()
retval = []
for handle in devlist:
if (handle.find("GPIB") != -1):
instr = instrument(handle)
version = instr.ask("*IDN?")
if (version.find("ESP300") != -1 ):
for ax in range(1,4): # motion controller - probe axes
#print "probe axis #%d" % (ax)
try:
print "probe ESP axis ", ax
ID = instr.ask(str(ax) + " ID?")
err = int(instr.ask("TE?"))
print " ..returns ", ID, " and error ", err
if(ID != "Unknown" and err == 0):
retval.append([handle,"Ax:"+str(ax)+" "+version,ax])
except:
print "exception"
return retval
开发者ID:vpaeder,项目名称:terapy,代码行数:25,代码来源:esp300.py
示例14: __init__
def __init__(self, GPIB):
# Set Address
self.pulse = visa.instrument("GPIB::%s"%GPIB)
# Select Channel A and turn output off
self.pulse.write("CHA")
self.pulse.write("D1")
开发者ID:mwchalmers,项目名称:UnmaintainedMeasCode,代码行数:7,代码来源:pulsedIV_driver.py
示例15: __init__
def __init__(self, resource, *args, **kwargs):
if type(resource) is str:
self.instrument = visa.instrument(resource, *args, **kwargs)
else:
self.instrument = resource
self.buffer = io.BytesIO()
开发者ID:lude-ma,项目名称:python-ivi,代码行数:7,代码来源:pyvisa.py
示例16: get830
def get830():
try:
global sr830
sr830 = visa.instrument('GPIB::' + str(sr830ch))
return True
except:
return False
开发者ID:johnpeck,项目名称:protoscript,代码行数:7,代码来源:sr830_sweep.py
示例17: __init__
def __init__(self, name, address):
'''
Initializes the Cryocon62, and comunicates with the wrapper.
Input:
name (string) : name of the instrument
address (string) : GPIB address
Output:
None
'''
logging.info(__name__ + ' : Initializing instrument')
Instrument.__init__(self, name, tags=['physical'])
self._address = address
self._visainstrument = visa.instrument(self._address)
self.add_parameter('temperature', type=types.FloatType,
channel_prefix='ch%d_',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('units', type=types.StringType,
channel_prefix='ch%d_',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('sensor_index', type=types.IntType,
channel_prefix='ch%d_',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('vbias', type=types.StringType,
channel_prefix='ch%d_',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('channel_name', type=types.StringType,
channel_prefix='ch%d_',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('sensor_name', type=types.StringType,
channel_prefix='ch%d_',
flags=Instrument.FLAG_GET, channels=(1,2))
开发者ID:CaoXiPitt,项目名称:Qtlab,代码行数:35,代码来源:Cryocon62.py
示例18: refreshDevices
def refreshDevices(self):
"""Refresh the list of known devices on this bus.
Currently supported are GPIB devices and GPIB over USB.
"""
try:
addresses = visa.get_instruments_list()
additions = set(addresses) - set(self.devices.keys())
deletions = set(self.devices.keys()) - set(addresses)
for addr in additions:
try:
if addr.startswith('GPIB'):
instName = addr
elif addr.startswith('USB'):
instName = addr + '::INSTR'
else:
continue
instr = visa.instrument(instName, timeout=self.defaultTimeout['s'])
self.devices[addr] = instr
self.sendDeviceMessage('GPIB Device Connect', addr)
except Exception, e:
print 'Failed to add ' + addr + ':' + str(e)
for addr in deletions:
del self.devices[addr]
self.sendDeviceMessage('GPIB Device Disconnect', addr)
开发者ID:HaeffnerLab,项目名称:Haeffner-Lab-LabRAD-Tools,代码行数:25,代码来源:gpib_server_v1.11.py
示例19: __init__
def __init__(self, name, address, reset=False):
Instrument.__init__(self, name)
self._address = address
self._visa = visa.instrument(self._address,
baud_rate=9600, data_bits=8, stop_bits=1,
parity=visa.no_parity, term_chars='\r\n')
开发者ID:AdriaanRol,项目名称:measurement,代码行数:7,代码来源:Millennia_Pro.py
示例20: get830
def get830():
try:
sr830 = visa.instrument('GPIB::' + str(sr830ch))
print('SR830 ready on gpib channel ' + str(sr830ch))
return sr830
except:
print('SR830 not found on gpib channel ' + str(sr830ch))
开发者ID:johnpeck,项目名称:protoscript,代码行数:7,代码来源:checkout.py
注:本文中的visa.instrument函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论