This commit is contained in:
@@ -102,16 +102,16 @@ def scan_contrast(positioner, pos_range, pos_step, roi = None, average = 1, upda
|
||||
positioner.write(mn)
|
||||
else:
|
||||
print "Invalid fit for ", positioner.name, mn, range_scan
|
||||
time.sleep(1.0) # Wait restoring positions
|
||||
time.sleep(SETTLING_TIME) # Wait restoring positions
|
||||
return r
|
||||
|
||||
|
||||
def update_roi_pos(cur_data, former_data):
|
||||
roi=get_focus_scan_roi()
|
||||
calc_roi = Roi(roi.x,roi.y,roi.width, roi.height)
|
||||
try:
|
||||
roi=get_focus_scan_roi()
|
||||
calc_roi = Roi(roi.x,roi.y,roi.width, roi.height)
|
||||
xoff, yoff, error, diffphase, _ = calculate_shift(former_data,cur_data, calc_roi)
|
||||
print "Calculated shift: ", xoff, yoff, error, diffphase
|
||||
print "Calculated shift: ", xoff, yoff, error, diffphase,
|
||||
if (abs(xoff) <= MAX_SHIFT) and (abs(yoff) <= MAX_SHIFT):
|
||||
x,y=int(roi.x - xoff), int(roi.y - yoff)
|
||||
print "Updating ROI location to ", x, y
|
||||
@@ -144,10 +144,11 @@ def scan_focus(positioner, pos_range, pos_step, average = 1, update_position = T
|
||||
|
||||
def before_read(pos,scan):
|
||||
global former_data
|
||||
if str(eiger.grabMode)=="Single":
|
||||
eiger.start()
|
||||
image.waitNext(20000)
|
||||
|
||||
if str(eiger.grabMode)=="Single":
|
||||
eiger.start()
|
||||
else:
|
||||
time.sleep(eiger.exposure)
|
||||
image.waitNext(20000)
|
||||
cur_data = image.data
|
||||
try:
|
||||
print "----- Pos: ", pos
|
||||
@@ -178,7 +179,7 @@ def scan_focus(positioner, pos_range, pos_step, average = 1, update_position = T
|
||||
|
||||
|
||||
r = lscan( positioner, [sensor,], -pos_range, pos_range, pos_step, \
|
||||
latency=eiger.exposure+SETTLING_TIME, relative=True, initial_move=False, restore_position=False, \
|
||||
latency=SETTLING_TIME, relative=True, initial_move=False, restore_position=False, \
|
||||
before_read=before_read, after_read=after_read, before_pass=before_pass)
|
||||
|
||||
ydata, xdata = r[sensor], r[positioner]
|
||||
@@ -206,5 +207,5 @@ def scan_focus(positioner, pos_range, pos_step, average = 1, update_position = T
|
||||
print "Invalid fit for ", positioner.name, mn, range_scan
|
||||
apply_focus_scan_pos(initial_state)
|
||||
if initial_roi_location: roi.location=initial_roi_location
|
||||
time.sleep(1.0) # Wait restoring positions
|
||||
time.sleep(0.) # Wait restoring positions
|
||||
return r
|
||||
|
||||
Reference in New Issue
Block a user