本文整理汇总了Python中labrad.devices.DeviceServer.initServer方法的典型用法代码示例。如果您正苦于以下问题:Python DeviceServer.initServer方法的具体用法?Python DeviceServer.initServer怎么用?Python DeviceServer.initServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类labrad.devices.DeviceServer
的用法示例。
在下文中一共展示了DeviceServer.initServer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
"""This method loads default settings from the registry,
sets up instruments, and sets up listeners for GPIB device
connect/disconnect messages."""
DeviceServer.initServer(self)
try:
yield self.client.registry.cd(self.ADRSettingsPath)
self.file_path = yield self.client.registry.get('Log Path')
except Exception as e:
self.logMessage( '{Saving log failed. Check that AFS is working.} ' )
yield self.loadDefaults()
yield util.wakeupCall( 3 ) # on the round ADR, the HP DMM takes forever to initialize. This prevents it from going on before it is ready.
yield self.initializeInstruments()
# subscribe to messages
# the server ones are not used right now, but at some point they could be
connect_func = lambda c, (s, payload): self.gpib_device_connect(*payload)
disconnect_func = lambda c, (s, payload): self.gpib_device_disconnect(*payload)
serv_conn_func = lambda c, (s, payload): self.serversChanged(*payload)
serv_disconn_func = lambda c, (s, payload): self.serversChanged(*payload)
mgr = self.client.manager
self._cxn.addListener(connect_func, source=mgr.ID, ID=10)
self._cxn.addListener(disconnect_func, source=mgr.ID, ID=11)
self._cxn.addListener(serv_conn_func, source=mgr.ID, ID=12)
self._cxn.addListener(serv_disconn_func, source=mgr.ID, ID=13)
yield mgr.subscribe_to_named_message('GPIB Device Connect', 10, True)
yield mgr.subscribe_to_named_message('GPIB Device Disconnect', 11, True)
yield mgr.subscribe_to_named_message('Server Connect', 12, True)
yield mgr.subscribe_to_named_message('Server Disconnect', 13, True)
self.updateState()
示例2: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
print 'loading config info...',
self.reg = self.client.registry()
yield self.loadConfigInfo()
print 'done.'
print self.serialLinks
yield DeviceServer.initServer(self)
示例3: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
print 'Loading config from registry...',
self.reg = self.client.registry()
yield self.loadConfigInfo()
print 'Finished.'
print("Serial links found: %s"%str(self.serialLinks))
yield DeviceServer.initServer(self)
示例4: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
"""Initializes the server"""
print("Server initializing")
self.reg = self.client.registry()
yield self.loadConfigInfo()
yield DeviceServer.initServer(self)
# Set the maximum acceptible pressures. This is a list
# of 6 values corresponding to the 6 sensors.
# Index 0 of thresholdMax corresponds to the maximum acceptible
# value of sensor 1 and index 5, sensor 6. Likewise, index 0 of
# thresholdMin corresponds to sensor 1.
# These values can be left as is (default) or they can be changed
# using the set_thresholds setting.
# In order to use the setting, type:
# [instance name].set_thresholds([low], [high])
# As an example:
# vacuum.set_thresholds([0, 0, 0, 5E-5, 5E-5, 5E-5],
# [0, 0, 0, 5E-4, 5E-4, 5E-4])
# It is a good idea to allow for a wide range of values if you
# know that a sensor is not connected because the unit sometimes
# misreports status codes. This makes it seem as though a sensor
# is connected, and a 'don't-care' value is treated as an error.
self.thresholdMax = [1e-2, 1e-2, 1e-2, 5e-7, 5e-7, 1e-4] * units.bar
# Set the minimum acceptible pressures.
self.thresholdMin = [0, 0, 0, 5E-8, 5E-8, 5E-8] * units.bar
self.alertInterval = 10 # seconds
self.measurements = [0, 0, 0, 0, 0, 0] * units.bar
self.statusCodes = [0, 0, 0, 0, 0, 0]
self.t1 = [0,0,0,0,0,0]
self.t2 = [0,0,0,0,0,0]
示例5: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
self.output = None
self.current = None
print 'loading config info...',
self.reg = self.client.registry()
yield self.loadConfigInfo()
print self.serialLinks
yield DeviceServer.initServer(self)
示例6: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
"""
Makes a connection to the registry where port information and other server
specific settings can be retrieved.
"""
print 'loading config info...',
self.reg = self.client.registry()
yield self.loadConfigInfo()
yield DeviceServer.initServer(self) # starts server after configurations loaded
示例7: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
"""Initialize the Temperature Monitor Server"""
print "Server Initializing"
self.reg = self.client.registry()
yield self.loadConfigInfo()
yield DeviceServer.initServer(self)
# Set the maximum acceptible temperature.
self.thresholdMax = 50 * units.degF
# Set the minimum acceptible temperature.
self.thresholdMin = 30 * units.degF
self.alertInterval = 10 # seconds
self.t1 = 0
self.t2 = 0
示例8: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
"""Initializes the server"""
print("Server Initializing...")
self.reg = self.client.registry()
yield self.loadConfigInfo()
yield DeviceServer.initServer(self)
# Set the maximum acceptible flow rate.
self.thresholdMax = 5 * units.galUS / units.min
# Set the minimum acceptible flow rate.
self.thresholdMin = 1.5* units.galUS / units.min
self.alertInterval = 10 # seconds
self.t1 = 0
self.t2 = 0
示例9: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
"""
This method loads default settings from the registry,
sets up instruments, and sets up listeners for GPIB device
connect/disconnect messages.
"""
yield DeviceServer.initServer(self)
try:
yield self.client.registry.cd(self.ADRSettingsPath)
self.file_path = yield self.client.registry.get('Log Path')
except Exception as e:
self.logMessage('{Saving log failed. '
' Check that AFS is working.} ')
yield self.loadDefaults()
yield self.initializeInstruments()
# subscribe to messages
# the server ones are not used right now, but at some point they could be
serv_conn_func = lambda c, (s, payload): self.serversChanged(*payload)
serv_disconn_func = lambda c, (s, payload): self.serversChanged(*payload)
mgr = self.client.manager
self._cxn.addListener(serv_conn_func, source=mgr.ID, ID=12)
self._cxn.addListener(serv_disconn_func, source=mgr.ID, ID=13)
yield mgr.subscribe_to_named_message('Server Connect', 12, True)
yield mgr.subscribe_to_named_message('Server Disconnect', 13, True)
# listen for device connect/disconnect signals
dev_con_changed = lambda c, payload: self.device_connection_changed(*payload)
try: # in case the device manager is not running
# &&& do this whenever device manager starts or something?
devManager = self.client.gpib_device_manager
yield devManager.device_connection_changed(self.ID)
yield devManager.addListener(listener = dev_con_changed,
source = None,
ID = self.ID)
except Exception as e:
print str(e)
self.updateState()
示例10: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
print "Server Initializing"
self.reg = self.client.registry()
yield self.loadConfigInfo()
yield DeviceServer.initServer(self)
示例11: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
print 'loading config info...',
self.reg = self.client.registry()
yield self.loadConfigInfo()
yield self.reg.cd(['', 'settings'], True)
yield DeviceServer.initServer(self)
示例12: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
print 'loading config info...',
yield self.loadConfigInfo()
print 'done.'
yield DeviceServer.initServer(self)
示例13: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
print 'loading config info...',
self.reg = self.client.registry()
yield self.loadConfigInfo()
yield DeviceServer.initServer(self)
示例14: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
print("Server <%s> of type <%s>"%(self.name,self.deviceName))
self.reg = self.client.registry()
yield self.loadConfigInfo()
print(self.serialLinks)
yield DeviceServer.initServer(self)
示例15: initServer
# 需要导入模块: from labrad.devices import DeviceServer [as 别名]
# 或者: from labrad.devices.DeviceServer import initServer [as 别名]
def initServer(self):
'''Initialize the MKSPDR2000 server.'''
print "Server Initializing"
self.reg = self.client.registry()
yield self.loadConfigInfo()
yield DeviceServer.initServer(self)