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


Python CAClient.configure方法代码示例

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


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

示例1: caget

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [as 别名]
def caget(pvstring):
	'caget from Jython'
	cli=CAClient(pvstring)
	cli.configure()
	out=cli.caget()
	cli.clearup()
	return out
开发者ID:openGDA,项目名称:gda-core,代码行数:9,代码来源:utils.py

示例2: DisplayEpicsPVClass

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [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
开发者ID:openGDA,项目名称:gda-core,代码行数:32,代码来源:epics_pds.py

示例3: EpicsReadWritePVClass

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [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
开发者ID:openGDA,项目名称:gda-core,代码行数:37,代码来源:epics_pds.py

示例4: DisplayEpicsPVClass

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [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()
开发者ID:fajinyuan,项目名称:gda-dls-beamline-i11,代码行数:32,代码来源:enableDirectPV.py

示例5: HexapodAxis

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [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

示例6: FunctionGenerator

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [as 别名]
class FunctionGenerator(ScannableMotionBase):
    
    def __init__(self, name):
        self.setName(name)
        num = int(name[-1])
        #EPICS PVs
        func="BL11I-EA-FGEN-0%d:FUNC" % num
        output="BL11I-EA-FGEN-0%d:OUT" % num
        freq="BL11I-EA-FGEN-0%d:FREQ" % num
        freqrbv="BL11I-EA-FGEN-0%d:FREQ:RBV" % num
        amp="BL11I-EA-FGEN-0%d:AMP" % num
        amprbv="BL11I-EA-FGEN-0%d:AMP:RBV" % num
        offset="BL11I-EA-FGEN-0%d:OFF" % num
        offsetrbv="BL11I-EA-FGEN-0%d:OFF:RBV" % num
        sym="BL11I-EA-FGEN-0%d:SYMM" % num
        symrbv="BL11I-EA-FGEN-0%d:SYMM:RBV" % num
        
        dutycyc="BL11I-EA-FGEN-0%d:DCYC" % num
        dutycycrbv="BL11I-EA-FGEN-0%d:DCYC:RBV" % num
        trigger="BL11I-EA-FGEN-0%d:TRIGSRC" % num
        burstmode="BL11I-EA-FGEN-0%d:BURSTMODE" % num
        burstncyc="BL11I-EA-FGEN-0%d:BURSTNCYC" % num
        burstncycrbv="BL11I-EA-FGEN-0%d:BURSTNCYC:RBV" % num
        burststate="BL11I-EA-FGEN-0%d:BURST" % num
        disable="BL11I-EA-FGEN-0%d:DISABLE" % num        
        
        self.setInputNames(["frequency","amplitude","shift","symmetry"])
        self.setExtraNames([])
        self.function=CAClient(func)
        self.output=CAClient(output)
        self.frequency=CAClient(freq)
        self.frequencyrbv=CAClient(freqrbv)
        self.amplitude=CAClient(amp)
        self.amplituderbv=CAClient(amprbv)
        self.shiftcli=CAClient(offset)
        self.shiftrbv=CAClient(offsetrbv)
        self.symmetry=CAClient(sym)
        self.symmetryrbv=CAClient(symrbv)
        self.dutycycle=CAClient(dutycyc)
        self.dutycyclerbv=CAClient(dutycycrbv)
        self.triggersrc=CAClient(trigger)
        self.burstmode=CAClient(burstmode)
        self.burstncyc=CAClient(burstncyc)
        self.burstncycrbv=CAClient(burstncycrbv)
        self.burststate=CAClient(burststate)
        self.disable=CAClient(disable)
        
    # function generator controls
    def setFunction(self, function):
        try:
            if not self.function.isConfigured():
                self.function.configure()
            self.function.caputWait(function)
        except FactoryException, e:
            print "create channel error (%s): %s" % (self.function.getChannel().getName(),e)
        except CAException, e:
            print "caput Error (%s): %s" % (self.function.getChannel().getName(),e)
开发者ID:fajinyuan,项目名称:gda-dls-beamline-i11,代码行数:59,代码来源:functiongenerator.py

示例7: ADCChannel

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [as 别名]
class ADCChannel(ScannableMotionBase, MonitorListener):
    
    def __init__(self, name, pv):
        self.setName(name)
        self.setInputNames([])
        self.pvcli=CAClient(pv)
        self.nordcli=CAClient(pv+".NORD")
        self.monitoradded=False
        self.counter=0
        self.numberofgates=0
        self.numberofframes=0
        self.filename=None
        self.filenames=[]
        self.collectionNumber=0 #0 means no collectionNumber
        self.voltagesmonitor=None
        self.firstMonitor = True
        self.voltages = {}
        
    def resetCounter(self):
        self.counter=0
        
    def resetRepetition(self):
        self.collectionNumber=0
        
    def setCollectionNumber(self, num):
        self.collectionNumber=num
        
    def setNumberOfGates(self, num):
        self.numberofgates=num
        
    def setNumberOfFrames(self, num):
        self.numberofframes=num
        
    def getNumberOfGates(self):
        return self.numberofgates
    
    def getNumberOfFrames(self):
        return self.numberofframes
    
    def setFilename(self, filename):
        self.filename=filename
        
    def getFilename(self):
        return self.filename
    
    def getFilenames(self):
        return self.filenames
    
    def getValues(self):
        try:
            if not self.pvcli.isConfigured():
                self.pvcli.configure()
            return self.pvcli.cagetArrayDouble()
        except FactoryException, e:
            print "create channel error (%s): %s" % (self.pvcli.getChannel().getName(),e)
        except CAException, e:
            print "caput Error (%s): %s" % (self.pvcli.getChannel().getName(),e)
开发者ID:fajinyuan,项目名称:gda-dls-beamline-i11,代码行数:59,代码来源:adcchannel.py

示例8: assignStruckChannel

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [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()
开发者ID:openGDA,项目名称:gda-core,代码行数:14,代码来源:ScalerSubsetScannable.py

示例9: DataCapturer

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [as 别名]
class DataCapturer(ScannableMotionBase, MonitorListener):
    
    def __init__(self, name, adc, hv=adcppv, el=adcepv, gate=adcgatepv): 
        self.setName(name)
        self.setInputNames(["HV","Electrometer","gate"])
        self.hv=hv
        self.el=el
        self.gate=gate
        self.voltagecli=CAClient(hv)
        self.electrometercli=CAClient(el)
        self.gatecli=CAClient(gate)
        self.monitoradded=False
        self.filename=None
        self.voltagemonitor=None
        self.electrometermonitor=None
        self.gatemonitor=None
        self.firstMonitor = True
        self.data={hv:[],el:[],gate:[]}
        self.voltages = []      # for holding voltage data array
        self.electrometers=[]   # for holding electrometer data array
        self.gates=[]
        self.firstData = True
        self.updatecounter=0
        self.capturecounter=0
        self.adc=adc
    
    def reset(self):
        self.electrometers = []
        self.voltages = []
        self.gates=[]
        self.updatecounter=0
        self.capturecounter=0
        self.firstData = True
        self.adc.disable()
        self.data={self.hv:[],self.el:[],self.gate:[]}
        
    def setFilename(self, filename):
        self.filename=filename
        
    def getFilename(self):
        return self.filename
    
    def getElectrometer(self, num):
        ''' retrieve electrometer data from Keithley amplifier.
        '''
        try:
            if not self.electrometercli.isConfigured():
                self.electrometercli.configure()
            return self.electrometercli.cagetArrayDouble(num)
        except FactoryException, e:
            print "create channel error (%s): %s" % (self.electrometercli.getChannel().getName(),e)
        except CAException, e:
            print "caget Error (%s): %s" % (self.electrometercli.getChannel().getName(),e)
开发者ID:fajinyuan,项目名称:gda-dls-beamline-i11,代码行数:55,代码来源:pedatacapturer_continuous.py

示例10: SingleEpicsPositionerClass

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [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)
开发者ID:openGDA,项目名称:gda-core,代码行数:58,代码来源:epics_pds.py

示例11: SingleEpicsPositionerClass

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [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
开发者ID:fajinyuan,项目名称:gda-dls-beamline-i11,代码行数:45,代码来源:enableDirectPV.py

示例12: HexapodAxisStatus

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [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
开发者ID:openGDA,项目名称:gda-epics,代码行数:24,代码来源:hexapod.py

示例13: DoseControl

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [as 别名]
class DoseControl(MonitorListener):
    
    def __init__(self, name,pv):
        self.name=name
        self.currentpressure=0.0
        self.outcli=CAClient(pv)
        self.outcli.configure()
        sleep(1)
        self.monitor=self.outcli.camonitor(self)
        
    def waitForGreaterThan(self, target):
        while (self.getCurrentPressure() <= target):
            sleep(0.1)
        
    def getCurrentPressure(self):
        return self.currentpressure
    
    def setSystemPressure(self, sysP,target,flow):
        #SET STARTING SAMPLE PRESSURE
        caput("BL11I-EA-GIR-01:DVPC:SETPOINT:WR", sysP)
        caput("BL11I-EA-GIR-01:MFC1:SETPOINT:WR", flow)
        caput("BL11I-EA-GIR-01:BPR:SETPOINT:WR", target)
        self.waitForGreaterThan(target)
        caput("BL11I-EA-GIR-01:MFC1:SETPOINT:WR", 0)
    
    def setSamplePressure(self,SampleP, target, increment):
        # SET FINAL SAMPLE PRESSURE AND INCREMENTS
        while SampleP <= target:                                #final sample pressure in bar
            SampleP += increment                      #increments in bar
            caput("BL11I-EA-GIR-01:DVPC:SETPOINT:WR", SampleP)
            sleep(5)                      #wait time in seconds

    def monitorChanged(self, mevent):
        try:
            self.currentpressure = float(mevent.getDBR().getDoubleValue()[0])
        except:
            #do nothing
            print
            
开发者ID:fajinyuan,项目名称:gda-dls-beamline-i11,代码行数:40,代码来源:gdaScriptDose.py

示例14: PVWithSeparateReadbackAndToleranceScannable

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [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())
开发者ID:openGDA,项目名称:gda-epics,代码行数:40,代码来源:pvscannables_with_logic.py

示例15: AdcControl

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import configure [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)
开发者ID:fajinyuan,项目名称:gda-dls-beamline-i11,代码行数:40,代码来源:adccontrol.py


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