本文整理汇总了Python中smellie.smellie_logger.SMELLIELogger.warn方法的典型用法代码示例。如果您正苦于以下问题:Python SMELLIELogger.warn方法的具体用法?Python SMELLIELogger.warn怎么用?Python SMELLIELogger.warn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smellie.smellie_logger.SMELLIELogger
的用法示例。
在下文中一共展示了SMELLIELogger.warn方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_parameters
# 需要导入模块: from smellie.smellie_logger import SMELLIELogger [as 别名]
# 或者: from smellie.smellie_logger.SMELLIELogger import warn [as 别名]
def set_parameters(self):
"""
set superK control parameters. Most of these should not be configurable and hard-coded for safety.
"""
if self.isConnected:
SMELLIELogger.debug('SNODROP DEBUG: SuperKDriver.set_parameters()')
superKControls = superKControlStructure()
superKControls.trigLevelSetpointmV = c_uint16(1000)
superKControls.displayBacklightPercent = c_uint8(0)
superKControls.trigMode = c_uint8(1)
superKControls.internalPulseFreqHz = c_uint16(0)
superKControls.burstPulses = c_uint16(1)
superKControls.watchdogIntervalSec = c_uint8(0)
superKControls.internalPulseFreqLimitHz = c_uint32(24000) #doesn't do anything. Possibly a manufacturer option disabled in firmware.
setSuperKControls(self.COMPort,superKControls)
#check parameters have been set correctly:
new_superKControls=self.get_parameters()
if (superKControls.trigLevelSetpointmV!=new_superKControls.trigLevelSetpointmV or
superKControls.displayBacklightPercent!=new_superKControls.displayBacklightPercent or
superKControls.trigMode!=new_superKControls.trigMode or
superKControls.internalPulseFreqHz!=new_superKControls.internalPulseFreqHz or
superKControls.burstPulses!=new_superKControls.burstPulses or
superKControls.watchdogIntervalSec!=new_superKControls.watchdogIntervalSec or
superKControls.internalPulseFreqLimitHz!=new_superKControls.internalPulseFreqLimitHz):
SMELLIELogger.warn('SNODROP WARN: Error upon setting SuperK control bits. Specified values have not all been set. Check system.')
raise SuperKDriverHWError("Error upon setting SuperK control bits. Specified values have not all been set. Check system.{}.")
else:
raise SuperKDriverLogicError("SuperK port not open.")
示例2: log_exception
# 需要导入模块: from smellie.smellie_logger import SMELLIELogger [as 别名]
# 或者: from smellie.smellie_logger.SMELLIELogger import warn [as 别名]
def log_exception(exception_string):
"""
Logs exceptions to logging server at highest level (warn).
:param exception: The exception to log
"""
SMELLIELogger.warn(exception_string)
示例3: go_ready
# 需要导入模块: from smellie.smellie_logger import SMELLIELogger [as 别名]
# 或者: from smellie.smellie_logger.SMELLIELogger import warn [as 别名]
def go_ready(self, step_number, low_wavelength, high_wavelength):
"""
undocumented
"""
if self.isConnected:
SMELLIELogger.debug('SNODROP DEBUG: SuperKDriver.go_ready({},{},{})'.format(step_number, low_wavelength, high_wavelength))
trigger_mode = self.get_trigger_mode()
if trigger_mode==1:
SMELLIELogger.warn('SNODROP WARN: SuperK laser being armed. Ready to pulse when triggered externally.')
elif trigger_mode==0:
for x in range(6):
SMELLIELogger.warn('SNODROP WARN: SuperK laser being armed. Laser will pulse with internal trigger. In {} seconds...'.format(5-x))
sleep(1)
# set the wavelengths of the Varia
self.set_wavelengths(low_wavelength,high_wavelength)
# set the Varia ND filter (the step number to the stepper motor controller)
#NDFilter_set_position(step_number)
# turn the lock off then turn the emission on (in this order)
self.set_laser_lock(False)
self.set_laser_emission(True)
else:
raise SuperKDriverLogicError("SuperK port not open.")
示例4: go_safe
# 需要导入模块: from smellie.smellie_logger import SMELLIELogger [as 别名]
# 或者: from smellie.smellie_logger.SMELLIELogger import warn [as 别名]
def go_safe(self):
"""
undocumented
"""
if self.isConnected:
SMELLIELogger.debug('SNODROP DEBUG: SuperKDriver.go_safe()')
# turn the emission off then turn the emission on (in this order)
self.set_laser_emission(False)
self.set_laser_lock(True)
# re-apply safe settings (external trigger etc.)
self.set_parameters()
SMELLIELogger.warn('SNODROP WARN: SuperK laser being set to safe mode.')
else:
raise SuperKDriverLogicError("SuperK port not open.")
示例5: get_superK_status
# 需要导入模块: from smellie.smellie_logger import SMELLIELogger [as 别名]
# 或者: from smellie.smellie_logger.SMELLIELogger import warn [as 别名]
def get_superK_status(self):
"""
Check the status of the SuperK Laser status bits.
:returns: superk status bits
"""
if self.isConnected:
superKStatus = getSuperKStatusBits(self.COMPort)
SMELLIELogger.debug('SNODROP DEBUG: SuperKDriver.get_superK_status()')
#check if any errors are present. If so, log and throw exception.
if (superkStatus.bit2==1 or superkStatus.bit5==1 or superkStatus.bit6==1 or superkStatus.bit7==1 or superkStatus.bit8==1 or superkStatus.bit9==1 or superkStatus.bit10==1 or superkStatus.bit15==1):
SMELLIELogger.warn('SNODROP WARN: Error reported in SuperK status bits. Check system.')
raise SuperKDriverHWError("Error reported in SuperK status bits. Check system.")
return superKStatus
else:
raise SuperKDriverLogicError("SuperK port not open.")
示例6: get_varia_status
# 需要导入模块: from smellie.smellie_logger import SMELLIELogger [as 别名]
# 或者: from smellie.smellie_logger.SMELLIELogger import warn [as 别名]
def get_varia_status(self):
"""
Check the status of the SuperK Varia status bits.
:returns: varia status bits
"""
if self.isConnected:
variaStatus = getvariaStatusBits(self.COMPort)
SMELLIELogger.debug('SNODROP DEBUG: SuperKDriver.get_varia_status()')
#check if any errors are present. If so, log and throw exception.
#variaStatus.bit8 is the shutter of the infrared outlet of the Varia which is blanked off (option provided by manufacturer which we don't use). Sensor indicator works but has no relevance for our use.
if (variaStatus.bit5==1 or variaStatus.bit6==1 or variaStatus.bit9==1 or variaStatus.bit15==1):
SMELLIELogger.warn('SNODROP WARN: Error reported in SuperK status bits. Check system.')
raise SuperKDriverHWError("Error reported in SuperK status bits. Check system.")
return variaStatus
else:
raise SuperKDriverLogicError("SuperK port not open.")
示例7: is_emission_on
# 需要导入模块: from smellie.smellie_logger import SMELLIELogger [as 别名]
# 或者: from smellie.smellie_logger.SMELLIELogger import warn [as 别名]
def is_emission_on(self):
"""
Check the status of the SuperK emission.
:returns: True if the emission is on (pulsing or ready to pulse).
"""
if self.isConnected:
SMELLIELogger.debug('SNODROP DEBUG: SuperKDriver.is_emission_on()')
superKStatus = getSuperKStatusBits(self.COMPort)
if (superKStatus.bit0 == 0):
emission_on = False
SMELLIELogger.notice('SNODROP NOTICE: SuperK laser emission OFF.')
elif (superKStatus.bit0 == 1):
emission_on = True
SMELLIELogger.notice('SNODROP NOTICE: SuperK laser emission ON.')
else:
SMELLIELogger.warn('SNODROP WARN: Unknown SuperK laser emission state. Check system.')
raise SuperKDriverLogicError("Unknown response for emission value.")
emission_on = None
return emission_on
示例8: set_trigger_mode
# 需要导入模块: from smellie.smellie_logger import SMELLIELogger [as 别名]
# 或者: from smellie.smellie_logger.SMELLIELogger import warn [as 别名]
def set_trigger_mode(self, trig_mode=1, internal_trigger_rate=0):
"""
undocumented
"""
if self.isConnected:
SMELLIELogger.debug('SNODROP DEBUG: SuperKDriver.set_trigger_mode({},{})'.format(trig_mode,internal_trigger_rate))
if (trig_mode<=1):
if (internal_trigger_rate<=TRIG_GEN_MAX_FREQUENCY):
superKControls = superKControlStructure()
superKControls.trigLevelSetpointmV = c_uint16(1000)
superKControls.displayBacklightPercent = c_uint8(0)
superKControls.trigMode = c_uint8(trig_mode)
superKControls.internalPulseFreqHz = c_uint16(internal_trigger_rate)
superKControls.burstPulses = c_uint16(1)
superKControls.watchdogIntervalSec = c_uint8(0)
superKControls.internalPulseFreqLimitHz = c_uint32(24000) #doesn't do anything. Possibly a manufacturer option disabled in firmware.
setSuperKControls(self.COMPort,superKControls)
#send warning about change of trigger mode.
new_superKControls=self.get_parameters()
if (superKControls.trigMode==0):
SMELLIELogger.warn('SNODROP WARN: SuperK Laser trigger mode is set to INTERNAL (mode {}). Rate is set to {}.'.format(new_superKControls.trigMode,new_superKControls.internalPulseFreqHz))
elif (superKControls.trigMode==1):
SMELLIELogger.warn('SNODROP WARN: SuperK Laser trigger mode is set to EXTERNAL (mode {}).'.format(new_superKControls.trigMode))
#check parameters have been set correctly:
if (superKControls.trigMode!=new_superKControls.trigMode or superKControls.internalPulseFreqHz!=new_superKControls.internalPulseFreqHz):
SMELLIELogger.warn('SNODROP WARN: Error upon setting SuperK trigger mode. Specified values have not been set. Check system. (Tried setting:Mode{},Rate={}. Returned:Mode{},Rate={}'.format(superKControls.trigMode, superKControls.internalPulseFreqHz, new_superKControls.trigMode, new_superKControls.internalPulseFreqHz))
raise SuperKDriverHWError('Error upon setting SuperK trigger mode. Specified values have not been set. Check system. (Tried setting:Mode{},Rate={}. Returned:Mode{},Rate={}'.format(superKControls.trigMode, superKControls.internalPulseFreqHz, new_superKControls.trigMode, new_superKControls.internalPulseFreqHz))
else:
SMELLIELogger.warn('SNODROP WARN: Specified pulse rate faster than maximum in config file.')
raise SuperKDriverLogicError("Specified pulse rate faster than maximum in config file. Check settings and config file.")
else:
SMELLIELogger.warn('SNODROP WARN: This trigger mode not enabled.')
raise SuperKDriverLogicError("This SuperK trigger mode not enabled.")
else:
raise SuperKDriverLogicError("SuperK port not open.")
示例9: is_laser_locked
# 需要导入模块: from smellie.smellie_logger import SMELLIELogger [as 别名]
# 或者: from smellie.smellie_logger.SMELLIELogger import warn [as 别名]
def is_laser_locked(self):
"""
Poll the SuperK driver for its lock status.
:returns: True if the internal-lock is on.
"""
if self.isConnected:
SMELLIELogger.debug('SNODROP DEBUG: SuperKDriver.is_laser_locked()')
#interlock circuit
interlock_locked = self.is_interlock_locked()
#internal interlock
superKStatus = getSuperKStatusBits(self.COMPort)
if (superKStatus.bit1 == 0):
laser_locked = False
elif (superKStatus.bit1 == 1):
laser_locked = True
else:
raise SuperKDriverLogicError("Unknown response for interlock value.")
interlock_locked = None
#combination of external interlock and SuperK internal interlock
if (laser_locked or interlock_locked):
is_locked = True
SMELLIELogger.notice('SNODROP NOTICE: SuperK laser locked.')
elif (laser_locked==False and interlock_locked==False):
is_locked = False
SMELLIELogger.notice('SNODROP NOTICE: SuperK laser unlocked.')
else:
SMELLIELogger.warn('SNODROP WARN: Unknown SuperK laser lock state. Check system.')
raise SuperKDriverLogicError("Unknown response for interlock value.")
is_locked = None
return is_locked
else:
raise SuperKDriverLogicError("SuperK port not open.")
return None