diff --git a/script/test2.py b/script/test2.py index d3cec62..ec26f62 100644 --- a/script/test2.py +++ b/script/test2.py @@ -1,6 +1,13 @@ +axis = th1 +ffail = False +tt = 0.2 +seti0 = False +dx = None +noref = False + -if !noref: +if noref == False: caput('X06DA-OP-MO:MONOBEAM', -1 ) e = get_energy() if dx is None: @@ -21,15 +28,15 @@ print time.strftime('%X %x') #SCAN,axis,0,2*dx,20,/fit,/centre,SILENT = silent,FFAIL = ffail,time=tt,/deriv,$ #data=d axis_pos = axis.read() -result = lscan(axis, beam_ref, -dx, dx, 20, latency = 0.3, relative = True, context = None, before_read = None, after_read = None) +result = lscan(axis, mono_beam, -dx, dx, 20, latency = 0.3, relative = True, context = None, before_read = None, after_read = None) (ydata, xdata) = (result.getReadable(0), result.getPositions(0)) (norm, mean, sigma) = fit(ydata, xdata) if (mean is not None) and (mean <= (axis_po + dx)) and (mean >= (axis_po - dx)): - caput(axis, mean) + axis.move(mean) else: print 'fit failed - centering on maximum' max_x= xdata[ydata.index(max(ydata))] - caput(axis, max_x) + axis.move(max_x) if seti0 and not ffail: time.sleep(2) @@ -37,6 +44,6 @@ if seti0 and not ffail: #add after_rock BPM1:SUM as reference for monitoring monochromator thermal drift if (noref==False) and not ffail: time.sleep(3) # wait a bit until mono theta finish moving - br = beam_ref.read() + br = mono_beam.read() caput('X06DA-OP-MO:MONOBEAM', br) print 'rock_success new mono beam at ' + str(br) + ' at' + str(e) + ' keV'