当前位置: 首页>>代码示例>>Python>>正文


Python CAClient.configured方法代码示例

本文整理汇总了Python中gda.epics.CAClient.configured方法的典型用法代码示例。如果您正苦于以下问题:Python CAClient.configured方法的具体用法?Python CAClient.configured怎么用?Python CAClient.configured使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gda.epics.CAClient的用法示例。


在下文中一共展示了CAClient.configured方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: HexapodAxis

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configured [as 别名]
class HexapodAxis(PseudoDevice):
	'''scannable or pseudo device for an individual, single Hexapod axis, it takes 8 inputs in the following order:
		1. the name string of this object
		2. the PV string for input target value
		3. the PV string for read-back value
		4. the PV string that control or start the motion
		5. the positional tolerance within which the motor is treated as in-position
		6. the unit string used for the measurement, keyworded as 'unitstring'
		7. the format string for the return data, keyworded as 'formatstring'
		8. the hexapod controller instance
		
		for example,
			hpx=HexapodAxis('hpx', 'ME02P-MO-BASE-01:UCS_X','ME02P-MO-BASE-01:UCSXR', 'ME02P-MO-BASE-01:START.PROC', 0.01, 'mm', '%9.4f', hexapodController)
			
	'''
	def __init__(self, name, pvinstring, pvoutstring, pvctrlstring, tolerance=0.01, unitstring='mm', formatstring='%9.4f', controller=None):
		self.setName(name);
		self.setInputNames([name])
		self.Units=[unitstring]
		self.setOutputFormat([formatstring])
		self.setLevel(3)
		self.incli=CAClient(pvinstring)
		self.outcli=CAClient(pvoutstring)
		self.movecli=CAClient(pvctrlstring)
		self.lastpos=0.0
		self.currentpos=0.0
		self.targetpos=0.0
		self._tolerance=tolerance
		self.controller=controller

	def atScanStart(self):
		if not self.incli.isConfigured():
			self.incli.configured()
		if not self.outcli.isConfigured():
			self.outcli.configured()
		if not self.movecli.isConfigured():
			self.movecli.configured()

	def atScanEnd(self):
		if self.incli.isConfigured():
			self.incli.clearup()
		if self.outcli.isConfigured():
			self.outcli.clearup()
		if self.movecli.isConfigured():
			self.movecli.clearup()
			
	def rawGetPosition(self):
		try:
			if self.outcli.isConfigured():
				self.currentpos=float(self.outcli.caget())
			else:
				self.outcli.configure()
				self.currentpos=float(self.outcli.caget())
				self.outcli.clearup()
			return  self.currentpos
		except Exception, err:
			print "Error returning current position" + err
			return 0
开发者ID:jjkraken,项目名称:gda-epics,代码行数:60,代码来源:hexapod.py

示例2: SingleChannelBimorphClass

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configured [as 别名]
class SingleChannelBimorphClass(ScannableMotionBase):
	'''Create PD for single EPICS Bimorph channel'''
	def __init__(self, name, pvinstring, pvoutstring, pvstatestring, unitstring, formatstring):
		self.setName(name);
		self.setInputNames([name])
#		self.setExtraNames([name]);
		self.Units=[unitstring]
		self.setOutputFormat([formatstring])
		self.setLevel(3)
		self.incli=CAClient(pvinstring)
		self.outcli=CAClient(pvoutstring)
		self.statecli=CAClient(pvstatestring)

	def atStart(self):
		if not self.incli.isConfigured():
			self.incli.configured()
		if not self.outcli.isConfigured():
			self.outcli.configured()
		if not self.statecli.isConfigured():
			self.statecli.configured()

	def rawGetPosition(self):
		try:
			if self.outcli.isConfigured():
				output=float(self.outcli.caget())
			else:
				self.outcli.configure()
				output=float(self.outcli.caget())
				#self.outcli.clearup()
			return output
		except:
			print "Error returning position"
			return 0
	def rawAsynchronousMoveTo(self,new_position):
		try:
			if self.incli.isConfigured():
				self.incli.caput(new_position)
			else:
				self.incli.configure()
				self.incli.caput(new_position)
				#self.incli.clearup()
		except:
			print "error moving to position"
	def rawIsBusy(self):
		try:
			if self.statecli.isConfigured():
				self.status=self.statecli.caget()
			else:
				self.statecli.configure()
				self.status=self.statecli.caget()
				#self.statecli.clearup()
			return int(self.status)
		except:
			print "problem with isMoving string: "+self.status+": Returning busy status"
			return 1
开发者ID:openGDA,项目名称:gda-core,代码行数:57,代码来源:epics_pds.py


注:本文中的gda.epics.CAClient.configured方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。