本文整理汇总了Python中gda.epics.CAClient.clearup方法的典型用法代码示例。如果您正苦于以下问题:Python CAClient.clearup方法的具体用法?Python CAClient.clearup怎么用?Python CAClient.clearup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gda.epics.CAClient
的用法示例。
在下文中一共展示了CAClient.clearup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: caget
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
def caget(pvstring):
'caget from Jython'
cli=CAClient(pvstring)
cli.configure()
out=cli.caget()
cli.clearup()
return out
示例2: DisplayEpicsPVClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
class DisplayEpicsPVClass(ScannableBase):
"""Create PD to display single EPICS PV"""
def __init__(self, name, pvstring, unitstring, formatstring):
self.setName(name)
self.setInputNames([])
self.setExtraNames([name])
self.Units = [unitstring]
self.setOutputFormat([formatstring])
self.setLevel(3)
self.cli = CAClient(pvstring)
def atStart(self):
if not self.cli.isConfigured():
self.cli.configure()
def getPosition(self):
if self.cli.isConfigured():
return float(self.cli.caget())
else:
self.cli.configure()
return float(self.cli.caget())
self.cli.clearup()
def isBusy(self):
return 0
def atEnd(self):
if self.cli.isConfigured():
self.cli.clearup()
示例3: assignStruckChannel
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
def assignStruckChannel(channelNo, nameList, namespace):
allNames = ''
for name in nameList:
namespace[name] = ScalerSubsetScannable(name,globals()['struck1'],[channelNo])
allNames += name + '/'
allNames = allNames[:-1]
print "ch%i: %s" % (channelNo, allNames)
cac = CAClient(ScalerSubsetScannable.struckRootPv+'SCALER.NM%i' % channelNo)
cac.configure()
cac.caput(allNames)
cac.clearup()
示例4: HexapodAxis
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [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.configure()
if not self.outcli.isConfigured():
self.outcli.configure()
if not self.movecli.isConfigured():
self.movecli.configure()
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
示例5: SingleEpicsPositionerClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
class SingleEpicsPositionerClass(ScannableBase):
"""Create PD for single EPICS positioner"""
def __init__(self, name, pvinstring, pvoutstring, pvstatestring, pvstopstring, 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)
self.stopcli = CAClient(pvstopstring)
def atStart(self):
if not self.incli.isConfigured():
self.incli.configure()
if not self.outcli.isConfigured():
self.outcli.configure()
if not self.statecli.isConfigured():
self.statecli.configure()
if not self.stopcli.isConfigured():
self.stopcli.configure()
def getPosition(self):
output = 99
try:
if self.outcli.isConfigured():
# if not isinstance(self.outcli.caget(),type(None)):
# print self.outcli.caget()
return float(self.outcli.caget())
else:
self.outcli.configure()
output = self.outcli.caget()
if output == None:
raise Exception, "null pointer exception in getPosition"
self.outcli.clearup()
return float(output)
except Exception, e:
print "error in getPosition", e.getMessage(), e, output
raise e
示例6: HexapodAxisStatus
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
class HexapodAxisStatus(object):
'''Hexapod axis status class implementing position-compare algorithm with tolerance input. isBusy() method should be used to query the motion status of this axis.'''
def __init__(self, name, pvinstring, pvoutstring, tolerance=0.01):
self.name=name
self.incli=CAClient(pvinstring)
self.outcli=CAClient(pvoutstring)
self.currentpos=0.0
self.targetpos=0.0
self._tolerance=tolerance
def getCurrentPosition(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 of " + self.name + err
return 0
示例7: GasRigClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
class GasRigClass(ScannableMotionBase):
'''Create a scannable for a gas injection rig'''
def __init__(self, name, rootPV):
self.setName(name);
self.setInputNames([name])
self.setLevel(3)
self.setsequencecli=CAClient(rootPV+SEQUENCE_CONTROL)
self.statecli=CAClient(rootPV+SEQUENCE_STATUS)
self.atpressurecli=CAClient(rootPV+AT_PRESSURE_PROC)
def getState(self):
try:
if not self.statecli.isConfigured():
self.statecli.configure()
output=int(self.statecli.caget())
self.statecli.clearup()
else:
output=int(self.statecli.caget())
return sequence[output]
except:
print "Error returning current state"
return 0
def setSequence(self,new_position):
try:
if not self.setsequencecli.isConfigured():
self.setsequencecli.configure()
self.setsequencecli.caput(new_position)
self.setsequencecli.clearup()
else:
self.setsequencecli.caput(new_position)
except:
print "error setting sequence"
def atPressure(self):
try:
if not self.atpressurecli.isConfigured():
self.atpressurecli.configure()
self.atpressurecli.caput(1)
self.atpressurecli.clearup()
else:
self.atpressurecli.caput(1)
except:
print "error setting at_pressure"
示例8: AlicatPressureController
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
class AlicatPressureController(ScannableMotionBase):
'''
classdocs
'''
def __init__(self,name, rootPV, formatstring):
'''
Constructor
'''
self.setName(name);
self.setInputNames([name])
self.setOutputFormat([formatstring])
self.setLevel(3)
self.readmodecli=CAClient(rootPV+READ_MODE)
self.setmodecli=CAClient(rootPV+SET_MODE)
self.readpressurecli=CAClient(rootPV+READ_PRESSURE)
self.settargetcli=CAClient(rootPV+SET_TARGET)
self.readtargetcli=CAClient(rootPV+READ_TARGET)
self.setproportionalgaincli=CAClient(rootPV+SET_PROPORTIONAL_GAIN)
self.readproportionalgaincli=CAClient(rootPV+READ_PROPORTIONAL_GAIN)
self.setderivativegaincli=CAClient(rootPV+SET_DERIVATIVE_GAIN)
self.readderivativegaincli=CAClient(rootPV+READ_DERIVATIVE_GAIN)
def getMode(self):
try:
if not self.readmodecli.isConfigured():
self.readmodecli.configure()
output=int(self.readmodecli.caget())
self.readmodecli.clearup()
else:
output=int(self.readmodecli.caget())
return modes[output]
except:
print "Error returning current mode"
return 0
def setMode(self, mode):
try:
if not self.setmodecli.isConfigured():
self.setmodecli.configure()
self.setmodecli.caput(mode)
self.setmodecli.clearup()
else:
self.setmodecli.caput(mode)
except:
print "error set to mode"
def setTarget(self, target):
try:
if not self.settargetcli.isConfigured():
self.settargetcli.configure()
self.settargetcli.caput(target)
self.settargetcli.clearup()
else:
self.settargetcli.caput(target)
except:
print "error set to target flow value"
def getTarget(self):
try:
if not self.readtargetcli.isConfigured():
self.readtargetcli.configure()
output=float(self.readtargetcli.caget())
self.readtargetcli.clearup()
else:
output=float(self.readtargetcli.caget())
return output
except:
print "Error returning flow target value"
return 0
def getPressure(self):
try:
if not self.readpressurecli.isConfigured():
self.readpressurecli.configure()
output=float(self.readpressurecli.caget())
self.readpressurecli.clearup()
else:
output=float(self.readpressurecli.caget())
return output
except:
print "Error returning pressure"
return 0
def getProportionalGain(self):
try:
if not self.readproportionalgaincli.isConfigured():
self.readproportionalgaincli.configure()
output=float(self.readproportionalgaincli.caget())
self.readproportionalgaincli.clearup()
else:
output=float(self.readproportionalgaincli.caget())
return output
except:
print "Error returning Proportional Gain"
return 0
def setProportionalGain(self, gain):
try:
if not self.setproportionalgaincli.isConfigured():
self.setproportionalgaincli.configure()
#.........这里部分代码省略.........
示例9: DetectorControlClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
class DetectorControlClass(ScannableMotionBase):
"""Create PD for single EPICS ETL detector"""
def __init__(self, name, pvinstring, pvoutstring, unitstring, formatstring):
self.setName(name)
self.setInputNames([name])
self.Units = [unitstring]
self.setOutputFormat([formatstring])
self.setLevel(3)
self.incli = CAClient(pvinstring)
self.outcli = CAClient(pvoutstring)
def atStart(self):
if not self.incli.isConfigured():
self.incli.configure()
if not self.outcli.isConfigured():
self.outcli.configure()
def getPosition(self):
try:
if not self.outcli.isConfigured():
self.outcli.configure()
output = float(self.outcli.caget())
self.outcli.clearup()
else:
output = float(self.outcli.caget())
return output
except:
print "Error returning current position"
return 0
def getTargetPosition(self):
try:
if not self.incli.isConfigured():
self.incli.configure()
target = float(self.incli.caget())
self.incli.clearup()
else:
target = float(self.incli.caget())
return target
except:
print "Error returning target position"
return 0
def asynchronousMoveTo(self, new_position):
try:
if not self.incli.isConfigured():
self.incli.configure()
self.incli.caput(new_position)
self.incli.clearup()
else:
self.incli.caput(new_position)
except:
print "error moving to position"
def isBusy(self):
return self.getPosition() != self.getTargetPosition()
def atEnd(self):
if self.incli.isConfigured():
self.incli.clearup()
if self.outcli.isConfigured():
self.outcli.clearup()
def toString(self):
return self.name + " : " + str(self.getPosition())
示例10: AlicatPressureController
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
class AlicatPressureController(ScannableMotionBase):
'''
construct a scannable for pressure control. It also provides access to other properties.
'''
def __init__(self,name, rootPV, tolerance=0.01, formatstring="%.3f"):
'''
Constructor
'''
self.setName(name)
self.setInputNames([name])
self.setOutputFormat([formatstring])
self.setLevel(3)
self.readmodecli=CAClient(rootPV+READ_MODE)
self.setmodecli=CAClient(rootPV+SET_MODE)
self.readpressurecli=CAClient(rootPV+READ_PRESSURE)
self.settargetcli=CAClient(rootPV+SET_TARGET)
self.readtargetcli=CAClient(rootPV+READ_TARGET)
self.setproportionalgaincli=CAClient(rootPV+SET_PROPORTIONAL_GAIN)
self.readproportionalgaincli=CAClient(rootPV+READ_PROPORTIONAL_GAIN)
self.setderivativegaincli=CAClient(rootPV+SET_DERIVATIVE_GAIN)
self.readderivativegaincli=CAClient(rootPV+READ_DERIVATIVE_GAIN)
self.mytolerance=tolerance
self.isConfigured=False
def configure(self):
if not self.isConfigured:
if not self.readmodecli.isConfigured():
self.readmodecli.configure()
if not self.setmodecli.isConfigured():
self.setmodecli.configure()
if not self.settargetcli.isConfigured():
self.settargetcli.configure()
if not self.readtargetcli.isConfigured():
self.readtargetcli.configure()
if not self.readpressurecli.isConfigured():
self.readpressurecli.configure()
self.isConfigured=True
def deconfigure(self):
if self.isConfigured:
if self.readmodecli.isConfigured():
self.readmodecli.clearup()
if self.setmodecli.isConfigured():
self.setmodecli.clearup()
if self.settargetcli.isConfigured():
self.settargetcli.clearup()
if self.readtargetcli.isConfigured():
self.readtargetcli.clearup()
if self.readpressurecli.isConfigured():
self.readpressurecli.clearup()
self.isConfigured=False
def getMode(self):
try:
if not self.readmodecli.isConfigured():
self.readmodecli.configure()
output=int(self.readmodecli.caget())
self.readmodecli.clearup()
else:
output=int(self.readmodecli.caget())
return modes[output]
except:
print "Error returning current mode"
return 0
def setMode(self, mode):
try:
if not self.setmodecli.isConfigured():
self.setmodecli.configure()
self.setmodecli.caput(mode)
self.setmodecli.clearup()
else:
self.setmodecli.caput(mode)
except:
print "error set to mode"
def setTarget(self, target):
try:
if not self.settargetcli.isConfigured():
self.settargetcli.configure()
self.settargetcli.caput(target)
self.settargetcli.clearup()
else:
self.settargetcli.caput(target)
except:
print "error set to target flow value"
def getTarget(self):
try:
if not self.settargetcli.isConfigured():
self.settargetcli.configure()
output=float(self.settargetcli.caget())
self.settargetcli.clearup()
else:
output=float(self.settargetcli.caget())
return output
except:
print "Error returning target value"
return 0
#.........这里部分代码省略.........
示例11: ScalerChannelEpicsPVClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
class ScalerChannelEpicsPVClass(ScannableBase):
def __init__(self, name, strChTP, strChCNT, strChSn):
self.setName(name);
self.setInputNames([]);
self.setExtraNames([name]);
# self.Units=[strUnit];
#self.setLevel(5);
self.setOutputFormat(["%20.12f"]);
self.chTP=CAClient(strChTP);
self.chCNT=CAClient(strChCNT);
self.chSn=CAClient(strChSn);
self.tp = -1;
# self.setTimePreset(time)
def atStart(self):
if not self.chTP.isConfigured():
self.chTP.configure()
if not self.chCNT.isConfigured():
self.chCNT.configure()
if not self.chSn.isConfigured():
self.chSn.configure()
#Scannable Implementations
def getPosition(self):
return self.getCount();
def asynchronousMoveTo(self,newPos):
self.setCollectionTime(newPos);
self.collectData();
def isBusy(self):
return self.getStatus()
def atEnd(self):
if self.chTP.isConfigured():
self.chTP.clearup()
if self.chCNT.isConfigured():
self.chCNT.clearup()
if self.chSn.isConfigured():
self.chSn.clearup()
#Scaler 8512 implementations
def getTimePreset(self):
if self.chTP.isConfigured():
newtp = self.chTP.caget()
else:
self.chTP.configure()
newtp = float(self.chTP.caget())
self.chTP.clearup()
self.tp = newtp
return self.tp
#Set the Time Preset and start counting automatically
def setTimePreset(self, newTime):
self.tp = newTime
newtp = newTime;
if self.chTP.isConfigured():
tp = self.chTP.caput(newtp)
else:
self.chTP.configure()
tp = self.chTP.caput(newtp)
self.chTP.clearup()
# Thread.sleep(1000)
def getCount(self):
if self.chSn.isConfigured():
output = self.chSn.caget()
else:
self.chSn.configure()
output = self.chSn.caget()
self.chSn.clearup()
return float(output)
#Detector implementations
#Tells the detector to begin to collect a set of data, then returns immediately.
#public void collectData() throws DeviceException;
#Set the Time Preset and start counting automatically
def collectData(self):
#self.setTimePreset(self.tp)
if self.chCNT.isConfigured():
tp = self.chCNT.caput(1)
else:
self.chCNT.configure()
tp = self.chCNT.caput(1)
self.chCNT.clearup()
# Thread.sleep(1000)
#Tells the detector how long to collect for during a call of the collectData() method.
#public void setCollectionTime(double time) throws DeviceException;
def setCollectionTime(self, newTime):
self.setTimePreset(newTime)
#Returns the latest data collected.
#public Object readout() throws DeviceException;
def getCollectionTime(self):
nc=self.getTimePreset()
#.........这里部分代码省略.........
示例12: caput_wait
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
def caput_wait(pvstring, value, timeout=10):
cli=CAClient(pvstring)
cli.configure()
cli.caput(timeout, value)
cli.clearup()
示例13: cagetArray
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
def cagetArray(pvstring):
cli=CAClient(pvstring)
cli.configure()
out=cli.cagetArrayDouble()
cli.clearup()
return out
示例14: caput
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
def caput(pvstring,value):
'caput from Jython'
cli=CAClient(pvstring)
cli.configure()
cli.caput(value)
cli.clearup()
示例15: SamplePressure
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import clearup [as 别名]
class SamplePressure(ScannableBase, MonitorListener):
"""
create a sannable to provide control of gas pressure in the sample.
It will reports to users when the system pressure is less than the sample pressure requested.
"""
def __init__(self, name, systempressure):
"""
Constructor
"""
self.setName(name)
self.setInputNames([name])
self.increment = 0.01
self.target = 0.0
self.lastTarget = 0.0
self.sampleP = 0.0
self.currentpressure = 0.0
self.pressureTolerance = 0.002
self.outcli = CAClient(CurrentPressure)
self.incli = CAClient(TargetPressure)
self.sysp = systempressure
self.initialiseTarget()
def atScanStart(self):
"""intialise parameters before scan"""
# TODOS check requested sample pressure can be reached
if not self.outcli.isConfigured():
self.outcli.configure()
if not self.incli.isConfigured():
self.incli.configure()
self.target = self.getPosition()
def atScanEnd(self):
"""clean up resources"""
if self.outcli.isConfigured():
self.outcli.clearup()
if self.incli.isConfigured():
self.incli.clearup()
def atPointStart(self):
pass
def atPointEnd(self):
pass
def getPosition(self):
"""
return the current gas pressure in sample
"""
try:
if not self.outcli.isConfigured():
self.outcli.configure()
output = float(self.outcli.caget())
self.outcli.clearup()
else:
output = float(self.outcli.caget())
return output
except:
print "Error returning current position"
return 0
def asynchronousMoveTo(self, new_position):
"""
move the sample pressure to the specified value asynchronously.
"""
try:
self.lastTarget = round(self.getLastTarget(), 3)
self.sampleP = round(self.getPosition(), 3)
self.target = round(float(new_position), 3)
thread.start_new_thread(self.setSamplePressure, (self.sampleP, self.target, self.increment))
except:
print "error moving sample pressure to (%s): %f" % (sys.exc_info()[0], float(new_position))
raise
def isBusy(self):
return abs(self.getPosition() - self.getTarget()) > self.getTolerance()
def stop(self):
"""
stop or abort pressure move in the sample.
"""
self.asynchronousMoveTo(self.getPosition())
if self.outcli.isConfigured():
self.outcli.clearup()
if self.incli.isConfigured():
self.incli.clearup()
def setSamplePressure(self, SampleP, target, increment):
# SET FINAL SAMPLE PRESSURE AND INCREMENTS
if SampleP < target:
SampleP = round(self.lastTarget + increment, 3) # increments in bar
if SampleP > target:
return
try:
if not self.incli.isConfigured():
self.incli.configure()
while SampleP <= target: # final sample pressure in bar
# interruptable()
self.incli.caput(SampleP)
# print "set sample pressure to "+str(SampleP)+", target is "+str(target)
#.........这里部分代码省略.........