This commit is contained in:
2016-03-17 10:54:59 +01:00
parent 0b90ffd6a8
commit 0f1bf29a8e
19 changed files with 641 additions and 84 deletions

View File

@@ -3,16 +3,14 @@ def error(msg):
raise Exception (msg)
#def sete(e, all=True, wavelengt=False):
e = 0
all = False
wavelengt = False
beam_err = BEAMLINE_XNAME + '-ES-DAQ:BEAM-ERROR'
beam_set = BEAMLINE_XNAME + '-ES-DAQ:BEAM-SET'
ring_current_cutoff = 300.0
if wavelength:
e = 12.39842/e
e = 12.39842/e
if e < 4.7 or e > 17.5:
error('ERROR:Energy out of range: 4.7 to 17.5 keV')
@@ -22,34 +20,33 @@ msg = 'Working... (aiming @ '+ str(e) +' keV)'
caput(beam_err, (msg[:40]) if len(msg) > 40 else msg)
if caget('ALIRF-GUN:CUR-LOWLIM', 'd') < ring_current_cutoff:
error('ERROR:Current is too low: < ' + str(ring_current_cutoff) + 'mA')
error('ERROR:Current is too low: < ' + str(ring_current_cutoff) + 'mA')
if caget('X06DA-FE-AB1:CLOSE_EPS') == 'CLOSE':
error('ERROR:ABSORBER closed; aborting...')
if caget('X06DA-FE-PH1:OPEN_EPS') != "OPEN":
error('ERROR:FE Shutter closed; aborting...')
if fe_absorber.read()!= 'OPEN':
raise Exception ('FrontEndAbsorber closed') # FrontEnd absorber shutter state
if fe_shutter.read() != "OPEN":
raise Exception ('FrontendShutter closed')
e0 = get_energy(False);
dE = abs(e-e0)
print '... started to move monochromator motors'
print '... alignment will take some minutes '
act = 0
act = 0
# do a setenergy to move theta 1 and 2 to calculated position in case they are not synchronized.
theta1 = caget('X06DA-OP-MO1:ROX1.RBV', 'd')
theta1 = th1.read() #TODO: setpoint?
etheta1 = a2e(abs(theta1),1,1,1,True)
theta2 = caget('X06DA-OP-MO1:ROX2.RBV', 'd')
theta2 = th2.read()
etheta2 = a2e(ABS(theta2),1,1,1,True)
if abs (etheta1-etheta2) > 0.01:
set_energy(e)
while abs(e-e0) > 3e-5/tan(angle(e)):
set_energy(e)
e0 = get_energy(False)
while abs(e-e0) > 3e-5/tan(angle(e, deg=False)): #TODO: deg==false? WHILE ABS(e-e0) GT 3e-5/TAN(ANGLE(e)) DO BEGIN
set_energy(e)
e0 = get_energy(False)
@@ -59,16 +56,15 @@ while abs(e-e0) > 3e-5/tan(angle(e)):
# -------- for sete, /all, remove all filters
if all:
caput('X06DA-ES-FI1:SET',0)
caput('X06DA-ES-FI2:SET',0)
caput('X06DA-ES-FI3:SET',0)
caput('X06DA-ES-FI4:SET',0)
filter1.write("None")
filter2.write("None")
filter3.write("None")
filter4.write("None")
time.sleep(0.5)
#-------- rock FIRST crystal until its peak is reached -------------
ff = 1
while ff:
rock() #TODO: #ROCK,1,dt = (dE>1.)*4e-2/e,ffail=ff
while rock(th1)==False: #TODO: #ROCK,1,dt = (dE>1.)*4e-2/e,ffail=ff
pass
# finer final rock
time.sleep(1.0)
@@ -77,10 +73,9 @@ rock()
e0 = get_energy()
caput('X06DA-OP-MO:E-GET',e0)
print e0
print ''
print caget('X06DA-OP-MO:E-GET')
mono_energy.write(e0)
print caget(mono_energy.read())
caput(beam_err, 'Finito')
caput(beam_set, 'DONE')