本文整理汇总了Python中gda.epics.CAClient.removeMonitor方法的典型用法代码示例。如果您正苦于以下问题:Python CAClient.removeMonitor方法的具体用法?Python CAClient.removeMonitor怎么用?Python CAClient.removeMonitor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gda.epics.CAClient
的用法示例。
在下文中一共展示了CAClient.removeMonitor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EpicsPVWithMonitorListener
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import removeMonitor [as 别名]
class EpicsPVWithMonitorListener(PseudoDevice, MonitorListener, Runnable):
'''create a scannable that monitors the EPICS PV value changes and update its value passively.
This value is used by a running thread to control the scan processing this object participates in.
'''
def __init__(self, name, pvstring, unitstring, formatstring):
self.setName(name)
self.setInputNames([name])
self.Units=[unitstring]
self.setOutputFormat([formatstring])
self.setLevel(5)
self.outcli=CAClient(pvstring)
self.currenttemp=float(self.rawGetPosition())
self.monitor=None
self.thread=None
self.runThread=False
def atScanStart(self):
'''prepare to start scan: creating channel, monitor, and start control thread'''
if not self.outcli.isConfigured():
self.outcli.configure()
self.monitor=self.outcli.camonitor(self)
self.thread=Thread(self,"Thread: "+self.getName())
self.runThread=True
self.thread.start()
def atScanEnd(self):
'''clean up after scan finished successfully: remove monitor, destroy channel, and stop control thread'''
if self.outcli.isConfigured():
self.outcli.removeMonitor(self.monitor)
self.monitor=None
self.outcli.clearup()
self.runThread=False
self.thread=None
def rawGetPosition(self):
''' return current position.'''
output=0.0
if not self.outcli.isConfigured():
self.outcli.configure()
output=float(self.outcli.caget())
self.outcli.clearup()
else:
output=float(self.outcli.caget())
return float(output)
def rawAsynchronousMoveTo(self,position):
'''Not implemented, this is only a monitoring object'''
print "object " + self.getName()+" cannot be moved."
return
def rawIsBusy(self):
'''monitoring object never busy'''
return 0
def monitorChanged(self, mevent):
self.currenttemp = float(mevent.getDBR().getDoubleValue()[0])
def run(self):
# print "Thread: " + self.getName() + " started"
while (self.runThread):
if (JythonServerFacade.getInstance().getScanStatus() == JythonStatus.RUNNING and self.currenttemp >= float(MAXTEMP)):
JythonServerFacade.getInstance().pauseCurrentScan()
print "Scan paused as temperature " + self.getName() +" returns: "+str(self.currenttemp)
elif (JythonServerFacade.getInstance().getScanStatus() == JythonStatus.PAUSED and self.currenttemp <= float(MINTEMP)):
print "Scan resumed as temperature " + self.getName() +" returns: "+str(self.currenttemp)
JythonServerFacade.getInstance().resumeCurrentScan()
sleep(10)
def stop(self):
'''clean up after scan finished successfully: remove monitor, destroy channel,
and stop control thread on emergence stop or unexpected crash. If required, can be used to manually clean up the object.'''
if not self.monitor == None:
self.outcli.removeMonitor(self.monitor)
self.monitor=None
if self.outcli.isConfigured():
self.outcli.clearup()
if not self.thread == None:
self.runThread=False
self.thread=None