After debugging the dispersion tool during machine development shift
This commit is contained in:
@ -53,9 +53,10 @@ class Dispersion:
|
||||
self.pgroup='%s/%s' % (dirpath,self.scanname)
|
||||
self.scandir='/sf/data/'+self.pgroup
|
||||
|
||||
self.setBranch('Athos Dump') # enfore Athos dump settings for now
|
||||
self.setBranch(branch) # enfore Athos dump settings for now
|
||||
self.Nsteps = 2
|
||||
self.Nsamples = 1
|
||||
self.bsc = None
|
||||
|
||||
def setBranch(self,branch = 'Aramis'):
|
||||
self.sc = None
|
||||
@ -65,8 +66,11 @@ class Dispersion:
|
||||
self.setupAramis()
|
||||
elif branch == 'Athos':
|
||||
self.setupAthos()
|
||||
elif branch =='Bunch Compressor 2':
|
||||
self.setupBC2()
|
||||
else:
|
||||
self.branch = None
|
||||
return self.branch
|
||||
|
||||
def setup(self,scl = 1, Nsteps=5, Nsamples=10):
|
||||
# the setup is done from the main thread. Therefore I have to define the BSC here
|
||||
@ -74,8 +78,10 @@ class Dispersion:
|
||||
self.Ns= Nsamples
|
||||
self.scale = scl
|
||||
# define stream
|
||||
print('Getting BSCache')
|
||||
self.bsc = BSCache(100000,10000) # 100 second timeout, size for 100 second data taken
|
||||
self.bsc.get_vars(self.sensor) # this starts the stream into the cache
|
||||
print('Getting BSCache done')
|
||||
|
||||
def scan(self):
|
||||
# core routine to do all action. Will be a thread of the slic scanner wrapper
|
||||
@ -97,33 +103,70 @@ class Dispersion:
|
||||
val = self.adj.get_current_value(readback=False)
|
||||
if self.adj2SV:
|
||||
self.adj2 = PVAdjustable(self.adj2SV,pvname_readback = self.adj2RB, accuracy = 0.1,ID = self.adjSV, name = self.name)
|
||||
val2 = self.adj.get_current_value(readback=False)
|
||||
dval = self.amp*scl * 0
|
||||
val2 = self.adj2.get_current_value(readback=False)
|
||||
dval = self.amp*self.scale
|
||||
print(self.adjSV,' - Scan Range:',val-dval,'to',val+dval)
|
||||
if self.adj2SV:
|
||||
print(self.adj2SV,' - Scan Range:',val2+dval,'to',val2-dval)
|
||||
|
||||
# create scanner backend
|
||||
if self.adj2SV:
|
||||
self.sc=self.scanner.a2scan(self.adj, val-dval, val+dval,
|
||||
self.adj2, val+dval, val-dval,
|
||||
self.Ns, # steps
|
||||
self.adj2, val2+dval, val2-dval,
|
||||
n_intervals = self.N-1, # steps
|
||||
n_pulses = self.Ns, # samples
|
||||
filename=self.branch, # relative directory for data
|
||||
start_immediately = False, # wait for execution to performe pre-action items
|
||||
return_to_initial_values=True) # return to initial values
|
||||
else:
|
||||
self.sc=self.scanner.ascan(self.adj, val-dval, val+dval,
|
||||
self.Ns, # steps
|
||||
n_intervals = self.N-1, # steps
|
||||
n_pulses = self.Ns, # samples
|
||||
filename=self.branch, # relative directory for data
|
||||
start_immediately = False, # wait for execution to performe pre-action items
|
||||
return_to_initial_values=True) # return to initial values
|
||||
|
||||
# get aux data first
|
||||
self.auxdata = getAux(self.aux)
|
||||
self.preaction()
|
||||
self.sc.run()
|
||||
self.auxdata = getAux(self.aux)
|
||||
self.postaction()
|
||||
self.bsc.stop() # stop the queue
|
||||
|
||||
|
||||
|
||||
#################################
|
||||
# definition of the individual branches
|
||||
|
||||
def setupBC2(self):
|
||||
# branch and name tag
|
||||
self.branch='Bunch Compressor 2'
|
||||
self.name ='BC2'
|
||||
|
||||
# pre-scan item - needs an adjustment of the dipole current of about 2.3e-3 - to be implemented later.
|
||||
self.pre = {}
|
||||
self.pre['SFB_COMPRESSION_BC2_AR:ONOFF1']={'Val':0,'InitVal':0}
|
||||
self.pre['SFB_COMPRESSION_BC2_AR:ONOFF2']={'Val':0,'InitVal':0}
|
||||
self.pre['SFB_ORBIT_S10:ONOFF1']={'Val':0,'InitVal':0}
|
||||
for pv in self.pre.keys():
|
||||
self.pre[pv]['adj']=PVAdjustable(pv)
|
||||
|
||||
# adjustable
|
||||
self.adjSV = 'S10:SET-E-GAIN-OP'
|
||||
self.adjRB = 'S10:GET-E-GAIN-OP'
|
||||
self.adj2SV = 'S20:SET-E-GAIN-OP' # counter adjustable
|
||||
self.adj2RB = 'S20:GET-E-GAIN-OP'
|
||||
self.amp = 5 # the amplitude of the scan, which can be scaled
|
||||
|
||||
|
||||
# acquisition
|
||||
sensor1 = getBSChannels('S10[BM].*-DBPM.*:[XY]1$')
|
||||
sensor2 = getBSChannels('S1.*-RLLE-DSP:.*-VS$')
|
||||
self.sensor = sensor1+sensor2
|
||||
|
||||
# auxiliar data to be read one
|
||||
self.aux = getRFCalibrationChannels(sensor2,'SINBC02-MBND100:ENERGY-OP')
|
||||
|
||||
def setupAthosDump(self):
|
||||
# branch and name tag
|
||||
self.branch='Athos_Dump'
|
||||
@ -175,12 +218,12 @@ class Dispersion:
|
||||
self.amp = 20 # the amplitude of the scan, which can be scaled
|
||||
|
||||
# acquisition
|
||||
sensor1 = getBSChannels('SAR.*DBPM.*:[XY]1$')
|
||||
sensor1 = getBSChannels('SAR[CMU].*DBPM.*:[XY]1$')
|
||||
sensor2 = getBSChannels('S[23].*-RLLE-DSP:.*-VS$')
|
||||
self.sensor = sensor1+sensor2
|
||||
|
||||
# auxiliar data to be read one
|
||||
self.aux = self.getRFCalibrationChannels(sensor2,'S10BC02-MBND100:ENERGY-OP')
|
||||
self.aux = getRFCalibrationChannels(sensor2,'S10BC02-MBND100:ENERGY-OP')
|
||||
|
||||
|
||||
def setupAthos(self):
|
||||
@ -204,7 +247,7 @@ class Dispersion:
|
||||
self.adjRB = 'S20:GET-E-GAIN-OP'
|
||||
self.adj2SV = 'S30:SET-E-GAIN-OP' # counter adjustable
|
||||
self.adj2RB = 'S30:GET-E-GAIN-OP'
|
||||
self.amp = 10 # the amplitude of the scan, which can be scaled
|
||||
self.amp = 5 # the amplitude of the scan, which can be scaled
|
||||
|
||||
# acquisition
|
||||
sensor1 = getBSChannels('SAT[SDC].*DBPM.*:[XY]2$')
|
||||
@ -212,7 +255,7 @@ class Dispersion:
|
||||
self.sensor = sensor1+sensor2
|
||||
|
||||
# auxiliar data to be read one
|
||||
self.aux = self.getRFCalibrationChannels(sensor2,'S10BC02-MBND100:ENERGY-OP')
|
||||
self.aux = getRFCalibrationChannels(sensor2,'S10BC02-MBND100:ENERGY-OP')
|
||||
|
||||
|
||||
#########################
|
||||
|
Reference in New Issue
Block a user