本文整理汇总了Python中gda.epics.CAClient.caget方法的典型用法代码示例。如果您正苦于以下问题:Python CAClient.caget方法的具体用法?Python CAClient.caget怎么用?Python CAClient.caget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gda.epics.CAClient
的用法示例。
在下文中一共展示了CAClient.caget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DisplayEpicsPVClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [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()
示例2: HexapodAxis
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [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
示例3: SingleEpicsPositionerClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [as 别名]
class SingleEpicsPositionerClass(ScannableMotionBase):
'''Create PD for single EPICS positioner'''
def __init__(self, name, pvinstring, pvoutstring, pvstatestring, pvstopstring, 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)
self.statecli=CAClient(pvstatestring)
self.stopcli=CAClient(pvstopstring)
def rawGetPosition(self):
output=0.0
try:
if not self.outcli.isConfigured():
self.outcli.configure()
output=float(self.outcli.caget())
#self.outcli.clearup()
return float(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 not int(self.status)
except:
print "problem with isMoving string: "+self.status+": Returning busy status"
return 1
def stop(self):
print "calling stop"
if self.stopcli.isConfigured():
self.stopcli.caput(1)
else:
self.stopcli.configure()
self.stopcli.caput(1)
示例4: DisplayEpicsPVClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [as 别名]
class DisplayEpicsPVClass(ScannableMotionBase):
'''Create PD to display single EPICS PV'''
def __init__(self, name, pvstring, unitstring, formatstring):
self.setName(name);
self.setInputNames([name])
self.Units=[unitstring]
self.setOutputFormat([formatstring])
self.setLevel(8)
self.outcli=CAClient(pvstring)
def rawGetPosition(self):
output=0.0
try:
if not self.outcli.isConfigured():
self.outcli.configure()
output=float(self.outcli.caget())
#print output
#sleep(10)
#self.outcli.clearup()
output = self.getOutputFormat()[0] % output
return float(output)
except:
print "Error returning position"
return 0
def rawAsynchronousMoveTo(self,position):
return
def rawIsBusy(self):
return 0
示例5: EpicsReadWritePVClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [as 别名]
class EpicsReadWritePVClass(ScannableMotionBase):
'''Create PD to display single EPICS PV'''
def __init__(self, name, pvstring, unitstring, formatstring):
self.setName(name);
self.setInputNames([name])
self.Units=[unitstring]
self.setOutputFormat([formatstring])
self.setLevel(8)
self.outcli=CAClient(pvstring)
def rawGetPosition(self):
output=0.0
try:
if not self.outcli.isConfigured():
self.outcli.configure()
output=float(self.outcli.caget())
output = self.getOutputFormat()[0] % output
return float(output)
except:
print "Error returning position"
return 0
def rawAsynchronousMoveTo(self,position):
self.new_position=position # need this attribute for some other classes
try:
if self.outcli.isConfigured():
self.outcli.caput(position)
else:
self.outcli.configure()
self.outcli.caput(position)
except:
print "error moving to position %f" % float(position)
def rawIsBusy(self):
return 0
示例6: caget
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [as 别名]
def caget(pvstring):
'caget from Jython'
cli=CAClient(pvstring)
cli.configure()
out=cli.caget()
cli.clearup()
return out
示例7: GasRigClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [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: SingleEpicsPositionerClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [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
示例9: HexapodAxisStatus
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [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
示例10: PVWithSeparateReadbackAndToleranceScannable
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [as 别名]
class PVWithSeparateReadbackAndToleranceScannable(ScannableBase):
def __init__(self, name, pv_set, pv_read, timeout, tolerance = 0.0005): #BL16B-EA-PSU-01
self.name = name
self.inputNames = [name]
self.outputFormat = ['%6.4f']
self.timeout = timeout
self.tol = tolerance
self._time_triggered = None
self._last_target = None
self._pv_set = CAClient(pv_set)
self._pv_read = CAClient(pv_read)
self._pv_set.configure()
self._pv_read.configure()
def asynchronousMoveTo(self, value):
self._pv_set.caput(value)
self._time_triggered = time.time()
self._last_target = value
def isBusy(self):
if self._last_target == None:
return False
i = (float(self._pv_read.caget()))
if abs(i - self._last_target) <= self.tol:
return False
if (time.time() - self._time_triggered) > self.timeout:
raise Exception('Timed out after %fs setting current to %f. The current has hung at %f, and the voltage is %f\n*Is the voltage set too low?*' % ((self.timeout, self.last_target) + self.getPosition()))
return True
def getPosition(self):
return float(self._pv_read.caget())
示例11: AlicatMassFlowController
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [as 别名]
class AlicatMassFlowController(ScannableMotionBase):
'''
scannable for set and get mass flow in a scannable way. It also provides method to query other mass flow properties.
'''
def __init__(self,name, rootPV, tolerance=0.01, formatstring="%.3f"):
'''
Constructor
'''
self.setName(name)
self.setInputNames([name])
self.setOutputFormat([formatstring])
self.setLevel(5)
self.currentflowcli=CAClient(rootPV+READ_MASS_FLOW)
self.setflowtargetcli=CAClient(rootPV+SET_MASS_FLOW_TARGET)
self.readflowtargetcli=CAClient(rootPV+READ_MASS_FLOW_TARGET)
self.currentgastypecli=CAClient(rootPV+READ_GAS_TYPE)
self.setfgastype1cli=CAClient(rootPV+SELECT_GAS_TYPE_1)
self.setfgastype2cli=CAClient(rootPV+SELECT_GAS_TYPE_2)
self.setgastypenumbercli=CAClient(rootPV+SET_GAS_TYPE_BY_NUMBER)
self.pressurecli=CAClient(rootPV+READ_PRESSURE_IN_BAR)
self.temperaturecli=CAClient(rootPV+READ_TEMPERATURE)
self.volumetricflowcli=CAClient(rootPV+READ_VOLUMETRIC_FLOW)
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
def getTolerance(self):
return self.mytolerance
def setTolerance(self, value):
self.mytolerance=value
def getCurrentFlow(self):
try:
if not self.currentflowcli.isConfigured():
self.currentflowcli.configure()
output=float(self.currentflowcli.caget())
self.currentflowcli.clearup()
else:
output=float(self.currentflowcli.caget())
return output
except:
print "Error returning current flow value"
return 0
def setTarget(self, target):
try:
if not self.setflowtargetcli.isConfigured():
self.setflowtargetcli.configure()
self.setflowtargetcli.caput(target)
self.setflowtargetcli.clearup()
else:
self.setflowtargetcli.caput(target)
except:
print "error set to target flow value"
def getTarget(self):
try:
if not self.readflowtargetcli.isConfigured():
self.readflowtargetcli.configure()
output=float(self.currentflowcli.caget())
self.readflowtargetcli.clearup()
else:
output=float(self.readflowtargetcli.caget())
return output
except:
print "Error returning flow target value"
return 0
def getGasType(self):
#self.currentgastypecli does not work in EPICS
try:
if not self.setgastypenumbercli.isConfigured():
self.setgastypenumbercli.configure()
output=int(self.setgastypenumbercli.caget())
self.setgastypenumbercli.clearup()
else:
output=int(self.setgastypenumbercli.caget())
return gasTypes[output]
except:
print "Error returning current gas type"
return 0
def setGasType(self,name):
key=gasTypes.keys()[(gasTypes.values()).index(name)]
if int(key)>=0 or int(key) <16:
try:
if not self.setfgastype1cli.isConfigured():
self.setfgastype1cli.configure()
self.setfgastype1cli.caput(name)
self.setfgastype1cli.clearup()
else:
self.setfgastype1cli.caput(name)
except:
print "error set to gas type 1"
else:
try:
if not self.setfgastype2cli.isConfigured():
#.........这里部分代码省略.........
示例12: ScalerChannelEpicsPVClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [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()
#.........这里部分代码省略.........
示例13: PositionCompareMotorWithLimitsClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [as 别名]
class PositionCompareMotorWithLimitsClass(ScannableMotionBase):
'''Create a scannable for a single motor'''
def __init__(self, name, pvinstring, pvoutstring, pvstopstring, tolerance, unitstring, formatstring, upperlimit, lowerlimit):
self.setName(name);
self.setInputNames([name])
self.Units=[unitstring]
self.setOutputFormat([formatstring])
self.setLevel(5)
self.incli=CAClient(pvinstring)
self.outcli=CAClient(pvoutstring)
self.stopcli=CAClient(pvstopstring)
self._tolerance=tolerance
self.setUpperGdaLimits(upperlimit)
self.setLowerGdaLimits(lowerlimit)
def setLowerGdaLimits(self, lowerlimit):
ScannableMotionBase.setLowerGdaLimits(lowerlimit)
def getLowerGdaLimits(self):
return ScannableMotionBase.getLowerGdaLimits()
def setUpperGdaLimits(self, upperlimit):
ScannableMotionBase.setUpperGdaLimits(upperlimit)
def getUpperGdaLimits(self):
return ScannableMotionBase.getUpperGdaLimits()
def setTolerance(self, tolerance):
self._tolerance=tolerance
def getTolerance(self):
return self._tolerance
def atScanStart(self):
if not self.incli.isConfigured():
self.incli.configure()
if not self.outcli.isConfigured():
self.outcli.configure()
if not self.stopcli.isConfigured():
self.stopcli.configure()
def rawGetPosition(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 rawAsynchronousMoveTo(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 rawIsBusy(self):
return ( not abs(self.rawGetPosition() - self.getTargetPosition()) < self._tolerance)
def atScanEnd(self):
if self.incli.isConfigured():
self.incli.clearup()
if self.outcli.isConfigured():
self.outcli.clearup()
if self.stopcli.isConfigured():
self.stopcli.clearup()
def stop(self):
if not self.stopcli.isConfigured():
self.stopcli.configure()
self.stopcli.caput(1)
self.stopcli.clearup()
else:
self.stopcli.caput(1)
def toString(self):
return self.name + " : " + str(self.getPosition())
示例14: SamplePressure
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [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)
#.........这里部分代码省略.........
示例15: EPICSODQBPMClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caget [as 别名]
class EPICSODQBPMClass(ScannableBase):
'''PD for OD QBPM device
Inputs: None
Outputs: Range, C1, C2, C3, C4, X, Y
self.set_range(value) - set gain 0 = highest
calibration sequence:
self.dark_current() save dark current at current gain (beam off)
self.set_zero() calibrate zero x,y (beam on)
self.setxy(xval, yval) calibrate gains to give position in mm (go to xval, yval; beam on) - NOT TESTED
Additional methods: config() loads qbpm parameters'''
# a=A1*(current4-A2) etc
# X=GX*(a-b)/(a+b) etc
# a,b,c,d=chan 4,2,1,3
def __init__(self, name, pvrootstring,help=None):
self.setName(name);
if help is not None: self.__doc__+='\nHelp specific to '+self.name+':\n'+help
#[self.A1,self.A2,self.B1,self.B2,self.C1,self.C2,self.D1,self.D2,self.GX, self.GY]=xyparamvec
self.pvrootstring=pvrootstring
self.setInputNames([])
self.setExtraNames(['Range','C1','C2','C3','C4','X','Y']);
#self.setReportingUnits([' ','uA','uA','uA','uA','mm','mm'])
self.setOutputFormat(['%.0f','%.9f','%.9f','%.9f','%.9f','%.3f','%.3f'])
self.setLevel(9)
self.rangecli=CAClient(pvrootstring+':RANGE_MENU');self.rangecli.configure()
self.c1cli=CAClient(pvrootstring+':PHD1:I');self.c1cli.configure()
self.c2cli=CAClient(pvrootstring+':PHD2:I');self.c2cli.configure()
self.c3cli=CAClient(pvrootstring+':PHD3:I');self.c3cli.configure()
self.c4cli=CAClient(pvrootstring+':PHD4:I');self.c4cli.configure()
self.xcli=CAClient(pvrootstring+':XPOS');self.xcli.configure()
self.ycli=CAClient(pvrootstring+':YPOS');self.ycli.configure()
self.IR1cli=CAClient(pvrootstring+':PHD1:I_R');self.IR1cli.configure()
self.IR2cli=CAClient(pvrootstring+':PHD2:I_R');self.IR2cli.configure()
self.IR3cli=CAClient(pvrootstring+':PHD3:I_R');self.IR3cli.configure()
self.IR4cli=CAClient(pvrootstring+':PHD4:I_R');self.IR4cli.configure()
def getPosition(self):
self.rangestring=self.rangecli.caget()
self.c1string=self.c1cli.caget()
self.c2string=self.c2cli.caget()
self.c3string=self.c3cli.caget()
self.c4string=self.c4cli.caget()
self.xstring=self.xcli.caget()
self.ystring=self.ycli.caget()
return [float(self.rangestring),float(self.c1string), float(self.c2string),float(self.c3string),float(self.c4string),float(self.xstring),float(self.ystring)]
# def asynchronousMoveTo(self,new_position):
# self.rangecli.caput(new_position)
def isBusy(self):
return 0
def set_params(self,params):
[A1,A2,B1,B2,C1,C2,D1,D2,GX,GY]=params
self.configcli=CAClient(self.pvrootstring+':A1_SP');self.configcli.configure(); self.configcli.caput(A1); self.configcli.clearup();
self.configcli=CAClient(self.pvrootstring+':A2_SP');self.configcli.configure(); self.configcli.caput(A2); self.configcli.clearup();
self.configcli=CAClient(self.pvrootstring+':B1_SP');self.configcli.configure(); self.configcli.caput(B1); self.configcli.clearup();
self.configcli=CAClient(self.pvrootstring+':B2_SP');self.configcli.configure(); self.configcli.caput(B2); self.configcli.clearup();
self.configcli=CAClient(self.pvrootstring+':C1_SP');self.configcli.configure(); self.configcli.caput(C1); self.configcli.clearup();
self.configcli=CAClient(self.pvrootstring+':C2_SP');self.configcli.configure(); self.configcli.caput(C2); self.configcli.clearup();
self.configcli=CAClient(self.pvrootstring+':D1_SP');self.configcli.configure(); self.configcli.caput(D1); self.configcli.clearup();
self.configcli=CAClient(self.pvrootstring+':D2_SP');self.configcli.configure(); self.configcli.caput(D2); self.configcli.clearup();
self.configcli=CAClient(self.pvrootstring+':GX_SP');self.configcli.configure(); self.configcli.caput(GX); self.configcli.clearup();
self.configcli=CAClient(self.pvrootstring+':GY_SP');self.configcli.configure(); self.configcli.caput(GY); self.configcli.clearup();
def get_params(self):
self.configcli=CAClient(self.pvrootstring+':A1_SP');self.configcli.configure(); A1=float(self.configcli.caget());self.configcli.clearup()
self.configcli=CAClient(self.pvrootstring+':A2_SP');self.configcli.configure(); A2=float(self.configcli.caget()); self.configcli.clearup()
self.configcli=CAClient(self.pvrootstring+':B1_SP');self.configcli.configure(); B1=float(self.configcli.caget()); self.configcli.clearup()
self.configcli=CAClient(self.pvrootstring+':B2_SP');self.configcli.configure(); B2=float(self.configcli.caget()); self.configcli.clearup()
self.configcli=CAClient(self.pvrootstring+':C1_SP');self.configcli.configure(); C1=float(self.configcli.caget()); self.configcli.clearup()
self.configcli=CAClient(self.pvrootstring+':C2_SP');self.configcli.configure(); C2=float(self.configcli.caget()); self.configcli.clearup()
self.configcli=CAClient(self.pvrootstring+':D1_SP');self.configcli.configure(); D1=float(self.configcli.caget()); self.configcli.clearup()
self.configcli=CAClient(self.pvrootstring+':D2_SP');self.configcli.configure(); D2=float(self.configcli.caget()); self.configcli.clearup()
self.configcli=CAClient(self.pvrootstring+':GX_SP');self.configcli.configure(); GX=float(self.configcli.caget()); self.configcli.clearup()
self.configcli=CAClient(self.pvrootstring+':GY_SP');self.configcli.configure(); GY=float(self.configcli.caget()); self.configcli.clearup()
return [A1,A2,B1,B2,C1,C2,D1,D2,GX,GY]
def get_rawcounts(self):
self.IR1=float(self.IR1cli.caget())
self.IR2=float(self.IR2cli.caget())
self.IR3=float(self.IR3cli.caget())
self.IR4=float(self.IR4cli.caget())
return [self.IR1, self.IR2, self.IR3, self.IR4]
def set_range(self, newrange):
self.rangecli.caput(newrange)
def factory_reset(self):
params=[A1,A2,B1,B2,C1,C2,D1,D2,GX,GY]=[1,0,1,0,1,0,1,0,1,1]
self.set_params(params)
def dark_current(self):
#offsets not persistent - do dark current with beam off
[A1,A2,B1,B2,C1,C2,D1,D2,GX,GY]=self.get_params()
self.configcli=CAClient(self.pvrootstring+':PHD4:I_R');self.configcli.configure(); A2=float(self.configcli.caget()); self.configcli.clearup()
self.configcli=CAClient(self.pvrootstring+':PHD2:I_R');self.configcli.configure(); B2=float(self.configcli.caget()); self.configcli.clearup()
#.........这里部分代码省略.........