本文整理汇总了Python中gda.epics.CAClient.caput方法的典型用法代码示例。如果您正苦于以下问题:Python CAClient.caput方法的具体用法?Python CAClient.caput怎么用?Python CAClient.caput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gda.epics.CAClient
的用法示例。
在下文中一共展示了CAClient.caput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EpicsReadWritePVClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [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
示例2: SingleChannelBimorphClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [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
示例3: assignStruckChannel
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [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: PVWithSeparateReadbackAndToleranceScannable
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [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())
示例5: AdcControl
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [as 别名]
class AdcControl(ScannableMotionBase):
def __init__(self, name):
self.setName(name)
num = int(name[-1])
#EPICS PVs
mode="BL11I-EA-ADC-0%d:MODE" % num
rate="BL11I-EA-ADC-0%d:CLOCKRATE" % num
enable="BL11I-EA-ADC-0%d:ENABLE" % num
samples="BL11I-EA-ADC-0%d:SAMPLES:OUT" % num
clock="BL11I-EA-ADC-0%d:EXTCLOCK" % num
reenable="BL11I-EA-ADC-0%d:REENABLE" % num
offset="BL11I-EA-ADC-0%d:OFFSET:OUT" % num
average="BL11I-EA-ADC-0%d:AVERAGE:OUT" % num
softtrig="BL11I-EA-ADC-0%d:SOFTTRIGGER.VAL" % num
self.setInputNames(["ADC Mode","Clock Rate","Enable","Samples"])
self.setExtraNames([])
self.setOutputFormat(["%s","%s","%s","%d"])
self.mode=CAClient(mode)
self.rate=CAClient(rate)
self.enableField=CAClient(enable)
self.samples=CAClient(samples)
self.clock=CAClient(clock)
self.reenable=CAClient(reenable)
self.adcoffset=CAClient(offset)
self.average=CAClient(average)
self.softtrig=CAClient(softtrig)
def continuousMode(self):
try:
if not self.mode.isConfigured():
self.mode.configure()
self.mode.caput(0)
except FactoryException, e:
print "create channel error (%s): %s" % (self.mode.getChannel().getName(),e)
except CAException, e:
print "caput Error (%s): %s" % (self.mode.getChannel().getName(),e)
示例6: EventReceiver
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [as 别名]
class EventReceiver(ScannableMotionBase):
def __init__(self, name, delay=evrdelaypv, delayrbv=evrdelayrbv, width=evrwidthpv, widthrbv=evrwidthrbv, enable=evrenablepv, polarity=evrpolaritypv):
self.setName(name)
self.setInputNames(["delay", "width"])
self.setExtraNames([])
self.delay=CAClient(delay)
self.delayrbv=CAClient(delayrbv)
self.width=CAClient(width)
self.widthrbv=CAClient(widthrbv)
self._enable=CAClient(enable)
self.polarity=CAClient(polarity)
# function generator controls
def enableField(self):
try:
if not self._enable.isConfigured():
self._enable.configure()
self._enable.caput(1)
except FactoryException, e:
print "create channel error (%s): %s" % (self._enable.getChannel().getName(),e)
except CAException, e:
print "caput Error (%s): %s" % (self._enable.getChannel().getName(),e)
示例7: GasRigClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [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: AlicatMassFlowController
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [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():
#.........这里部分代码省略.........
示例9: PositionCompareMotorWithLimitsClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [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())
示例10: ScalerChannelEpicsPVClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [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()
#.........这里部分代码省略.........
示例11: SamplePressure
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [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)
#.........这里部分代码省略.........
示例12: caput_wait
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [as 别名]
def caput_wait(pvstring, value, timeout=10):
cli=CAClient(pvstring)
cli.configure()
cli.caput(timeout, value)
cli.clearup()
示例13: EPICSODQBPMClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [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()
#.........这里部分代码省略.........
示例14: GasRigValveClass
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [as 别名]
class GasRigValveClass(ScannableMotionBase):
'''Create a scannable for a gas injection rig'''
def __init__(self, name, rootPV):
self.setName(name);
self.setInputNames([name])
self.setLevel(5)
self.controlcli=CAClient(rootPV+VALVE_CONTROL)
self.statecli=CAClient(rootPV+VALVE_STATUS)
self.modecli=CAClient(rootPV+VALVE_MODE)
self.interlockscli=CAClient(rootPV+VALVE_INTERLOCKS)
self.operationscli=CAClient(rootPV+VALVE_OPERATIONS)
def getStatus(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 STATUS_SEQUENCE[output]
except:
print "Error returning current state"
return 0
def getMode(self):
try:
if not self.modecli.isConfigured():
self.modecli.configure()
output=int(self.modecli.caget())
self.modecli.clearup()
else:
output=int(self.modecli.caget())
return MODE_SEQUENCE[output]
except:
print "Error returning current state"
return 0
def getInterlocks(self):
try:
if not self.interlockscli.isConfigured():
self.interlockscli.configure()
output=int(self.interlockscli.caget())
self.interlockscli.clearup()
else:
output=int(self.interlockscli.caget())
return INTERLOCKS_SEQUENCE[output]
except:
print "Error returning current state"
return 0
def getOperations(self):
try:
if not self.operationscli.isConfigured():
self.operationscli.configure()
output=int(self.operationscli.caget())
self.operationscli.clearup()
else:
output=int(self.operationscli.caget())
return output
except:
print "Error returning current state"
return 0
def setControl(self,new_position):
try:
if not self.controlcli.isConfigured():
self.controlcli.configure()
self.controlcli.caput(new_position)
self.controlcli.clearup()
else:
self.controlcli.caput(new_position)
except:
print "error setting sequence"
def on(self):
self.setControl(0)
def off(self):
self.setControl(1)
def reset(self):
self.setControl(2)
#### methods for scannable
def getPosition(self):
return self.getStatus()
def asynchronousMoveTo(self, new_position):
self.setControl(float(new_position))
def isBusy(self):
return False
def atScanStart(self):
pass
def atPointStart(self):
pass
def stop(self):
pass
#.........这里部分代码省略.........
示例15: caput
# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import caput [as 别名]
def caput(pvstring,value):
'caput from Jython'
cli=CAClient(pvstring)
cli.configure()
cli.caput(value)
cli.clearup()