Closedown

This commit is contained in:
2015-12-01 09:34:45 +01:00
parent 90922834eb
commit 967b7eae92
2 changed files with 11 additions and 2 deletions

View File

@@ -55,6 +55,6 @@ def fit(ydata, xdata = None):
else:
p.addMarker(max_x, None, "Max="+str(round(max_x,2)), Color.Gray)
print "Invalid gaussian fit: " + str(mean)
return (None, None, None)
#fit([1,2,3, 3,3,3,4,5,6,12,33,23,15,3,2,1, 1, 1, 1, 1])

View File

@@ -28,8 +28,17 @@ def rock(axis = th1, ffail = False, tt = 0.2, seti0 = False, dx = None, noref =
#MVR,axis,-dx
#SCAN,axis,0,2*dx,20,/fit,/centre,SILENT = silent,FFAIL = ffail,time=tt,/deriv,$
#data=d
axis_pos = axis.read()
lscan(axis, beam_ref, -dx, dx, 20, latency = 0.3, relative = True, context = None, before_read = None, after_read = None)
LSCAN()
(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)
else
print 'fit failed - centering on maximum'
max_x= xdata[ydata.index(max(ydata))]
caput(axis, max_x)
if seti0 and not ffail:
time.sleep(2)