示例#1
0
class BimorphVoltageMonitor(ScannableMotionBase):
    def __init__(self, name, pvName, unitstring, formatstring):
        self.setName(name)
        self.voltageMonitorPv = CAClient(pvName)
        self.Units = [unitstring]
        self.setOutputFormat([formatstring])

    #def __init__(self, name, pvName, unitstring, formatstring):
    #	self.setName(name)
    #	self.voltageMonitorPv = CAClient(pvName)
    #	self.Units = [unitstring]
    #	self.setOutputFormat([formatstring])

    def getPosition(self):
        # return self.currentposition
        try:
            if self.voltageMonitorPv.isConfigured():
                return float(self.voltageMonitorPv.caget())
            else:
                self.voltageMonitorPv.configure()
                return float(self.voltageMonitorPv.caget())
        except:
            print "Error getting position"

    def asynchronousMoveTo(self, new_position):
        pass

    def isBusy(self):
        return 0
示例#2
0
class KepkoCurrent(ScannableMotionBase):
    def __init__(self, name, pv):
        self.setName(name)
        self.setInputNames(['Ampere'])
        self.setOutputFormat(['%2.4f'])
        self.setLevel(6)
        self.ch = CAClient(pv)
        self.ch.configure()

    def atScanStart(self):
        return

    def atScanEnd(self):
        return

    def getPosition(self):
        return float(self.ch.caget()) * 0.4

    def asynchronousMoveTo(self, newpos):
        self.ch.caput(newpos / 0.4)
        sleep(0.5)
        return None

    def isBusy(self):
        return False
示例#3
0
class BeamCurrent(ScannableMotionBase):
    def __init__(self, name):
        self.setName(name)
        self.setInputNames([])
        self.setExtraNames([])
        self.setOutputFormat([])
        self.setLevel(7)
        self.MinLevel = 1
        self.ricur = CAClient("SR21C-DI-DCCT-01:SIGNAL")
        self.ricur.configure()
        self.shutter = CAClient("FE05I-PS-SHTR-02:STA")
        self.shutter.configure()
        self.wasOff = False

    def isBusy(self):
        if float(self.ricur.caget()) < self.MinLevel:
            if self.wasOff == False:
                self.wasOff = True
            return True
        return False

    def getPosition(self):
        return None

    def asynchronousMoveTo(self, newPosition):
        self.MinLevel = newPosition
示例#4
0
 def __init__(self, name, pvSet, pvGet, formatstring):
     self.setName(name)
     self.setInputNames([name])
     self.setOutputFormat([formatstring])
     self.setLevel(6)
     self.chIn = CAClient(pvSet)
     self.chOut = CAClient(pvGet)
示例#5
0
def sample_stage_home():
    if is_live():
        print('Homing sample stage')
        caClient = CAClient()
        try:
            caClient.configure()
            caClient.caput('BL08I-EA-TABLE-01:HM:HMGRP', 'All', 1)
            caClient.caput('BL08I-EA-TABLE-01:HM:HOME', 1, 30)
        finally:
            caClient.clearup()
    else:
        print('Homing sample stage (dummy)')
        SampleX.getMotor().home()
        SampleY.getMotor().home()
        SampleX_coarse.getMotor().home()
        SampleY_coarse.getMotor().home()
        SampleX_fine.getMotor().home()
        SampleY_fine.getMotor().home()

        SampleX.waitWhileBusy()
        SampleY.waitWhileBusy()
        SampleX_coarse.waitWhileBusy()
        SampleY_coarse.waitWhileBusy()
        SampleX_fine.waitWhileBusy()
        SampleY_fine.waitWhileBusy()

    print('Finished homing sample stage')
示例#6
0
    def __init__(self, port, panel):
        self.port = port
        panelDict = {'U1': 'I', 'U2': 'J'}
        if panel.upper() not in ['U1', 'U2', 'I', 'J']:
            print "-> patch panel choice is invalid: allowed values are U1 or U2"
            print "-> U1 panel selected as default."
            self.panel = 'U1'
        else:
            self.panel = panel
        panelStr = panelDict[panel.upper()]
        rootComStr = "BL06" + panelStr + "-EA-USER-01:ASYN"
        self.addrStr = rootComStr + "%1u." % self.port
        pvIn = rootComStr + "%1u.TINP" % self.port
        pvOut = rootComStr + "%1u.AOUT" % self.port
        self.chIn = CAClient(pvIn)
        self.chIn.configure()
        self.chOut = CAClient(pvOut)
        self.chOut.configure()

        self.baudList = [
            "Unknown", "300", "600", "1200", "2400", "4800", "9600"
        ]
        self.baudList += ["19200", "38400", "57600", "115200", "230400"]
        self.bitList = ["Unknown", "5", "6", "7", "8"]
        self.stopList = ["Unknown", "1", "2"]
        self.parityList = ["Unknown", "None", "Even", "Odd"]
        self.flowList = ["Unknown", "None", "Hardware"]

        self.getParameters()
        self.report()
示例#7
0
 def __init__(self, name, pv):
     self.setName(name)
     self.setInputNames(['Ampere'])
     self.setOutputFormat(['%2.4f'])
     self.setLevel(6)
     self.ch = CAClient(pv)
     self.ch.configure()
示例#8
0
 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)
示例#9
0
    def __init__(self,
                 name,
                 mca_root_pv,
                 channelAdvanceInternalNotExternal=False):
        self.logger = LoggerFactory.getLogger(
            "McsWaveformChannelController:%s" % name)
        self.verbose = False

        self.name = name
        self.mca_root_pv = mca_root_pv
        self.pv_stop = CAClient(mca_root_pv + 'StopAll')
        self.pv_dwell = CAClient(mca_root_pv + 'Dwell')
        self.pv_channeladvance = CAClient(mca_root_pv + 'ChannelAdvance')
        self.pv_presetReal = CAClient(mca_root_pv + 'PresetReal')
        self.pv_erasestart = CAClient(mca_root_pv + 'EraseStart')
        self.channelAdvanceInternalNotExternal = channelAdvanceInternalNotExternal
        self.channelAdvanceInternal = 0
        self.channelAdvanceExternal = 1

        self.configure()
        self.exposure_time = 1
        self.exposure_time_offset = .0
        self.number_of_positions = 0
        self.started = False
        self.hardware_trigger_provider = None
        self.stream = None
示例#10
0
class EpicsMonitorClass(ScannableMotionBase):
    def __init__(self, name, strPV, strUnit, strFormat):
        self.setName(name)
        self.setInputNames([])
        self.setExtraNames([name])
        self.Units = [strUnit]
        self.setOutputFormat([strFormat])
        self.setLevel(7)
        self.cli = CAClient(strPV)
        self.cli.configure()

    def atScanStart(self):
        if not self.cli.isConfigured():
            self.cli.configure()

    def getPosition(self):
        try:
            if self.cli.isConfigured():
                return float(self.cli.caget())
            else:
                self.cli.configure()
                return float(self.cli.caget())
        except:
            print "Error getting position"

    def asynchronousMoveTo(self, new_position):
        pass

    def isBusy(self):
        return False
示例#11
0
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
示例#12
0
	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)
示例#13
0
    def setupEpics(self, rootPV):

        self.chDisable = CAClient(rootPV + ":DISABLE")
        self.configChannel(self.chDisable)
        self.chReset = CAClient(rootPV + ":RESET")
        self.configChannel(self.chReset)

        self.chSetGain = CAClient(rootPV + ":GAIN:DMD")
        self.configChannel(self.chSetGain)
        self.chGetGain = CAClient(rootPV + ":GAIN:RBV")
        self.configChannel(self.chGetGain)

        self.chSetLowerLevel = CAClient(rootPV + ":SCA-LOWER:DMD")
        self.configChannel(self.chSetLowerLevel)
        self.chGetLowerLevel = CAClient(rootPV + ":SCA-LOWER:RBV")
        self.configChannel(self.chGetLowerLevel)

        self.chSetHigherLevel = CAClient(rootPV + ":SCA-UPPER:DMD")
        self.configChannel(self.chSetHigherLevel)
        self.chGetHigherLevel = CAClient(rootPV + ":SCA-UPPER:RBV")
        self.configChannel(self.chGetHigherLevel)

        self.chPeakTime = CAClient(rootPV + ":PEAKTIME:DMD")
        self.configChannel(self.chPeakTime)
        self.chSaturation = CAClient(rootPV + ":SATURATION")
        self.configChannel(self.chSaturation)
示例#14
0
 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
示例#15
0
 def __init__(self, name, pvname):
     '''
     Constructor
     '''
     self.setName(name)
     self.pv=pvname
     self.caclient=CAClient(pvname)
     self.pointNumber=0
示例#16
0
	def prepareKBMirrorRastering(self, expotime):
		if self.pvName:
			self.ch=CAClient(self.pvName);  self.configChannel(self.ch);
			self.cachedCh=float(self.ch.caget())
			if "FREQ" in self.pvName:
				self.ch.caput(1.0/expotime)
			elif "PERIOD" in self.pvName:
				self.ch.caput(expotime)
示例#17
0
 def __init__(self, name, strPV):
     self.setName(name)
     self.setInputNames([])
     self.setExtraNames([name])
     #		self.Units=[strUnit];
     self.setLevel(7)
     self.setOutputFormat(["%20.12f"])
     self.ch = CAClient(strPV)
示例#18
0
 def __init__(self, name, rootPV):
     self.setName(name);
     self.setInputNames([name])
     self.setLevel(5)
     self.setsequencecli=CAClient(rootPV+SEQUENCE_CONTROL)
     self.statecli=CAClient(rootPV+SEQUENCE_STATUS)
     self.systemincli=CAClient(SystemTargetPressure)
     self.sampleincli=CAClient(SampleTargetPressure)
示例#19
0
 def __init__(self, name, pvVoltage, pvStatus, formatstring):
     self.setName(name)
     self.chVoltage = CAClient(pvVoltage)
     self.chStatus = CAClient(pvStatus)
     self.Units = ['V']
     self.setOutputFormat([formatstring])
     self.delay = 5
     self.timeout = 30
示例#20
0
	def __init__(self, name, strPV, strUnit, strFormat):
		self.setName(name);
		self.setInputNames([])
		self.setExtraNames([name]);
		self.Units=[strUnit]
		self.setOutputFormat([strFormat])
		self.setLevel(3)
		self.cli=CAClient(strPV)
示例#21
0
    def __init__(self, rootPV):
        from gda.epics import CAClient

        self.rootPV = rootPV + ":"
        self.channel = CAClient()

        self.callbackSet = False
        self.t = None
 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)
示例#23
0
 def __init__(self, name):
     self.setName(name)
     self.setInputNames([name])
     self.setOutputFormat(["%1.0f"])
     self.secsBefore = 2
     self.secsAfter = 580
     self.tupv = CAClient("SR-CS-FILL-01:COUNTDOWN")
     self.tupv.configure()
     self.setLevel(7)
示例#24
0
 def __init__(self, name, pv):
     '''
     create a scannable for specified PV
     '''
     self.setName(name)
     self.setInputNames(['exposure'])
     self.pv = pv
     self.cli = CAClient(pv)
     self._busy = False
示例#25
0
 def __init__(self, name, pvcontrolstring, pvstatestring, unitstring,
              formatstring):
     self.setName(name)
     self.setInputNames([name])
     self.Units = [unitstring]
     self.setOutputFormat([formatstring])
     self.setLevel(3)
     self.incli = CAClient(pvcontrolstring)
     self.statecli = CAClient(pvstatestring)
 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)
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)
示例#28
0
	def setupEpics(self, rootPV):
		#Epics PV for the Number of elements available
		self.chHead=CAClient(rootPV + ":ELEMENTCOUNTER");  self.configChannel(self.chHead);

#		Epics PVs for the channels:
		self.chData=[];
		for i in range(self.numberOfChannels):
			self.chData.append( CAClient(rootPV + ":CH" + str(i+1) + "DATA"));
			self.configChannel(self.chData[i]);
示例#29
0
    def __init__(self, name, waveformPV, viewPanelName="Plot 2"):
        self.name = name
        self.delay = 1
        self.chData = CAClient(waveformPV)
        self.configChannel(self.chData)

        self.width = 1024
        self.height = 768
        self.panel = viewPanelName
示例#30
0
	def connect(self):
		try:
			self.ch=CAClient(self.initPV);
			self.ch.configure();
			self.detector =vars(gdamain)[self.detectorName];
			print "PIXIS Camera is connected successfully."
		except:
			exceptionType, exception, traceback=sys.exc_info();
			logger.dump("PIXIS Camera can not be connected ", exceptionType, exception, traceback)
示例#31
0
 def asynchronousMoveTo(self, time):
     t3 = CAClient()
     t3.caput(self.pvieos, "\n")
     sleep(1)
     temp2 = "DEL " + str(time)
     if self.verbose:
         print temp2
     self.incli.caput(temp2)
     sleep(1)
示例#32
0
	def __init__(self, name, pvstring, unitstring, formatstring):
		self.setName(name);
		self.setInputNames([])
		self.setExtraNames([name]);
		self.Units=[unitstring]
		self.setOutputFormat([formatstring])
		self.setLevel(8)
		self.cli=CAClient(pvstring)
		print self.name + " connecting to: " + pvstring
		self.cli.configure()
	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()
		self.configcli=CAClient(self.pvrootstring+':PHD1:I_R');self.configcli.configure(); C2=float(self.configcli.caget()); self.configcli.clearup()
		self.configcli=CAClient(self.pvrootstring+':PHD3:I_R');self.configcli.configure(); D2=float(self.configcli.caget()); self.configcli.clearup()
		self.set_params([A1,A2,B1,B2,C1,C2,D1,D2,GX,GY])
		print 'new dark currents (i4,i2,i1,i3):', [A2, B2, C2, D2]
示例#34
0
 def getChannelInputStreamCAClients(self, channel_pv_suffix):
     if installation.isLive():
         pv_waveform = CAClient(self.binpoint_root_pv + channel_pv_suffix +
                                'BINPOINT')
         pv_count = CAClient(self.binpoint_root_pv + channel_pv_suffix +
                             'BINPOINT:NLAST.B')
     else:
         pv_waveform = []
         pv_count = self.number_of_positions
     return pv_waveform, pv_count
示例#35
0
	def __init__(self, name, pvinstring, pvoutstring, unitstring, formatstring,help=None):
		self.setName(name);
		if help is not None: self.__doc__+='\nHelp specific to '+self.name+':\n'+help
		self.setInputNames([name])
		self.Units=[unitstring]
		self.setOutputFormat([formatstring])
		self.setLevel(5)
		self.incli=CAClient(pvinstring)
		self.incli.configure()
		self.outcli=CAClient(pvoutstring)
		self.outcli.configure()
	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;
示例#37
0
 def __init__(self, name):
     self.name = name
     self.epicsClient = CAClient("camserver")
     #self.epicsClient.configure()
     print "epicsClient: " + str(self.epicsClient)
     self.camserverCommandClient = CAClient(self.camserverWriterPV)
     print "camserverCommandClient: " + str(self.camserverCommandClient)
     self.camserverWriterClient = CAClient(self.camserverWriterPV)
     print "camserverWriterClient: " + str(self.camserverWriterClient)
     self.camserverReaderClient = CAClient(self.camserverReaderPV)
     print "camserverReaderClient: " + str(self.camserverReaderClient)
	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 __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)
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)
    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()
示例#43
0
	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 __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 __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)
示例#46
0
	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
示例#47
0
 def __init__(self, name, hv=adcppv, el=adcepv, gate=adcgatepv):
     self.setName(name)
     self.setInputNames([])
     self.hv=hv
     self.el=el
     self.gate=gate
     self.voltagecli=CAClient(hv)
     self.electrometercli=CAClient(el)
     self.gatecli=CAClient(gate)
     self.voltagenordcli=CAClient(hv+".NORD")
     self.electrometernordcli=CAClient(el+".NORD")
     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.fastmode = False
     self.numberofgate=0
     self.fastMode=True
     self.updatecounter=0
     self.collectionNumber=1
    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 __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)
示例#50
0
    def __init__(self, name, waveformPV, viewPanelName="Plot 2"):
        self.name = name;
        self.delay=1;
        self.chData=CAClient(waveformPV);
        self.configChannel(self.chData);

        self.width = 1024;
        self.height=768;
        self.panel=viewPanelName
 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)
示例#52
0
	def __init__(self, name, pvstring, unitstring, formatstring):
		self.setName(name)
		self.setInputNames([name])
		self.Units=[unitstring]
		self.setOutputFormat([formatstring])
		self.setLevel(5)
		self.outcli=CAClient(pvstring)
		self.currenttemp=float(self.rawGetPosition())
		self.monitor=None
		self.thread=None
		self.runThread=False
 def __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)
示例#54
0
文件: utils.py 项目: openGDA/gda-core
def caget(pvstring):
	'caget from Jython'
	cli=CAClient(pvstring)
	cli.configure()
	out=cli.caget()
	cli.clearup()
	return out
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
            
示例#56
0
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()
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)
 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 __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)