本文整理汇总了Python中labrad.devices.DeviceServer类的典型用法代码示例。如果您正苦于以下问题:Python DeviceServer类的具体用法?Python DeviceServer怎么用?Python DeviceServer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DeviceServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initServer
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
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
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]
示例4: initServer
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)
示例5: initServer
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
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
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
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
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: stopServer
def stopServer(self):
print 'closing all acqiris connections...',
acqiris.closeAll()
print 'done.'
yield DeviceServer.stopServer(self)
示例11: initServer
def initServer(self):
print "Server Initializing"
self.reg = self.client.registry()
yield self.loadConfigInfo()
yield DeviceServer.initServer(self)
示例12: initServer
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)
示例13: initServer
def initServer(self):
print 'loading config info...',
yield self.loadConfigInfo()
print 'done.'
yield DeviceServer.initServer(self)
示例14: __init__
def __init__(self, args):
DeviceServer.__init__(self)
self.ADRSettingsPath = ADR_SETTINGS_BASE_PATH
selectedADR = DEFAULT_ADR
if '-a' in args: # Use -a to specify ADR
index = args.index('-a')
args.pop(index)
selection = str( args.pop(index) ) # if we do not pop these off, twisted will complain because this is not an allowed argument
if selection in AVAILABLE_ADRS:
selectedADR = selection
else:
print '%s is not a valid ADR selection.' %selection
self.ADRSettingsPath.append(selectedADR)
self.name = selectedADR
self.deviceName = selectedADR
print '%s selected.' %selectedADR
self.alive = True
self.state = { 'T_FAA': numpy.NaN*units.K,
'T_GGG': numpy.NaN*units.K,
'T_3K' : numpy.NaN*units.K,
'T_60K': numpy.NaN*units.K,
'datetime' : datetime.datetime.now(),
'cycle': 0,
'magnetV': numpy.NaN*units.V,
'RuOxChan':'FAA',
'RuOxChanSetTime':datetime.datetime.now(),
'PSCurrent':numpy.NaN*units.A,
'PSVoltage':numpy.NaN*units.V,
'maggingUp':False,
'regulating':False,
'regulationTemp':0.1,
'PID_cumulativeError':0}
self.lastState = self.state.copy()
self.ADRSettings ={ 'PID_KP':0.75,
'PID_KI':0,
'PID_KD':15,
'PID_MaxI':1,
'magup_dV': 0.003, #[V/step] How much do we increase the voltage by every second when maggin up? HPD Manual uses 10mV=0.01V, 2.5V/30min=1.4mV/s ==> Let's use a middle rate of 3mV/step. (1 step is about 1s)
'magnet_voltage_limit': 0.1, #Back EMF limit in Volts
'current_limit': 9, #Max Current in Amps
'voltage_limit': 2, #Max Voltage in Volts. At 9A, we usually get about 2.5-2.7V or 1.69V (with or without the external diode protection box), so this shouldn't need to be more than 3 or 2
'dVdT_limit': 0.008, #Keep dV/dt to under this value [V/s]
'dIdt_magup_limit': 9./(30*60), #limit on the rate at which we allow current to increase in amps/s (we want 9A over 30 min)
'dIdt_regulate_limit': 9./(40*60),#limit on the rate at which we allow current to change in amps/s (we want 9A over 40 min)
'step_length': 1.0, #How long is each regulation/mag up cycle in seconds. **Never set this less than 1.0sec.** The SRS SIM922 only measures once a second and this would cause runaway voltages/currents.
'magnet_max_temp': 5,
'FAA MP Chan': 2,
'GGG MP Chan': 1,
'Power Supply':['Agilent 6641A PS','addr'],
'Ruox Temperature Monitor':['SIM921','addr'], #['ACBridgeWithMultiplexer',[['SIM921 Server','addr'],['SIM925 Server','addr']]],
'Diode Temperature Monitor':['SIM922','addr'],
'Magnet Voltage Monitor':['SIM922','addr'],
'Heat Switch':['Heat Switch','addr'],
'Compressor':['CP2800 Compressor','addr']}
self.instruments = {'Power Supply':'None',
'Ruox Temperature Monitor':'None',
'Diode Temperature Monitor':'None',
'Magnet Voltage Monitor':'None',
'Heat Switch':'None',
'Compressor':'None'}
dt = datetime.datetime.now()
self.dateAppend = dt.strftime("_%y%m%d_%H%M")
self.logMessages = []
示例15: __init__
def __init__(self, args):
DeviceServer.__init__(self)
self.ADRSettingsPath = ADR_SETTINGS_BASE_PATH
selectedADR = DEFAULT_ADR
if '-a' in args: # Use -a to specify ADR
index = args.index('-a')
args.pop(index)
# If we do not pop these off, twisted will complain because
# this is not an allowed argument.
selection = str( args.pop(index) )
if selection in AVAILABLE_ADRS:
selectedADR = selection
else:
print('%s is not a valid ADR selection.' %selection)
self.ADRSettingsPath.append(selectedADR)
self.name = selectedADR
self.deviceName = selectedADR
print('%s selected.' %selectedADR)
self.alive = True # to turn off the update state look when server is closed
self.state = {
'T_FAA': numpy.NaN * units.K,
'T_GGG': numpy.NaN * units.K,
'T_3K' : numpy.NaN * units.K,
'T_60K': numpy.NaN * units.K,
'datetime' : datetime.datetime.utcnow(),
'cycle': 0,
'magnetV': numpy.NaN * units.V,
'RuOxChan': 'FAA',
'RuOxChanSetTime': datetime.datetime.utcnow(),
'PSCurrent': numpy.NaN * units.A,
'PSVoltage': numpy.NaN * units.V,
'maggingUp': False,
'regulating': False,
'regulationTemp': 0.1,
'PID_cumulativeError': 0
}
self.lastState = self.state.copy()
# These are defaults. They can be overridden in the registry by
# including a setting with the same name.
self.ADRSettings = {
'PID_KP': 0.75,
'PID_KI': 0,
'PID_KD': 15,
'PID_MaxI': 1,
'magup_dV': 0.003, #[V/step] How much do we increase the voltage by every second when maggin up? HPD Manual uses 10mV=0.01V, 2.5V/30min=1.4mV/s ==> Let's use a middle rate of 3mV/step. (1 step is about 1s)
'magnet_voltage_limit': 0.1, #Back EMF limit in Volts
'current_limit': 9, #Max Current in Amps
'voltage_limit': 2, #Max Voltage in Volts. At 9A, we usually get about 2.5-2.7V or 1.69V (with or without the external diode protection box), so this shouldn't need to be more than 3 or 2
'dVdT_limit': 0.008, #Keep dV/dt to under this value [V/s]
'dIdt_magup_limit': 9. / (30*60), #limit on the rate at which we allow current to increase in amps/s (we want 9A over 30 min)
'dIdt_regulate_limit': 9./(40*60),#limit on the rate at which we allow current to change in amps/s (we want 9A over 40 min)
'step_length': 1.0, #How long is each regulation/mag up cycle in seconds. **Never set this less than 1.0sec.** The SRS SIM922 only measures once a second and this would cause runaway voltages/currents.
'magnet_max_temp': 5,
'FAA MP Chan': 2,
'GGG MP Chan': 1,
'Power Supply':['Agilent 6641A PS','addr'],
'Ruox Temperature Monitor':['SIM921','addr'], #['AC Bridge with Multiplexer',[['SIM921 Server','addr'],['SIM925 Server','addr']]],
'Diode Temperature Monitor':['SIM922','addr'],
'Magnet Voltage Monitor':['SIM922','addr'],
'Heat Switch':['Heat Switch','addr'],
'Compressor':['CP2800 Compressor','addr']
}
self.instruments = {'Power Supply':'None',
'Ruox Temperature Monitor':'None',
'Diode Temperature Monitor':'None',
'Magnet Voltage Monitor':'None',
'Heat Switch':'None',
'Compressor':'None'}
self.startDatetime = datetime.datetime.utcnow()
self.tempDataChest = dataChest(['ADR Logs',self.name])
dts = dateStamp()
iso = self.startDatetime.isoformat().split('+')[0] # strip timezone (or dateStamp will fail)
dtstamp = dts.dateStamp(iso)
self.tempDataChest.createDataset("temperatures",
[('time',[1],'utc_datetime','')],
[('temp60K',[1],'float64','Kelvin'),('temp03K',[1],'float64','Kelvin'),
('tempGGG',[1],'float64','Kelvin'),('tempFAA',[1],'float64','Kelvin')],
dateStamp=dtstamp)
self.tempDataChest.addParameter("X Label", "Time")
self.tempDataChest.addParameter("Y Label", "Temperature")
self.tempDataChest.addParameter("Plot Title",
self.startDatetime.strftime("ADR temperature history "
"for run starting on %y/%m/%d %H:%M"))
self.logMessages = []