Removed focus_data
This commit is contained in:
parent
db0dc11274
commit
63bd34f548
1 changed files with 8 additions and 18 deletions
|
|
@ -70,7 +70,6 @@ def move_and_measure(
|
||||||
step_size: dict[str, float],
|
step_size: dict[str, float],
|
||||||
axis: str, delta: dict[str, int],
|
axis: str, delta: dict[str, int],
|
||||||
image1, autofocus_proc: bool,
|
image1, autofocus_proc: bool,
|
||||||
focus_data: list[float],
|
|
||||||
csm: CSMDep,
|
csm: CSMDep,
|
||||||
autofocus: AutofocusDep,
|
autofocus: AutofocusDep,
|
||||||
cam:CamDep) -> tuple:
|
cam:CamDep) -> tuple:
|
||||||
|
|
@ -81,8 +80,7 @@ def move_and_measure(
|
||||||
:params delta: A dictionary of 'x' and 'y' offsets.
|
:params delta: A dictionary of 'x' and 'y' offsets.
|
||||||
:params image1: An image taken before moving to be correlated with image2.
|
:params image1: An image taken before moving to be correlated with image2.
|
||||||
:params autofocus_proc: If true, looping.autofocus will be used after the stage moves.
|
:params autofocus_proc: If true, looping.autofocus will be used after the stage moves.
|
||||||
:params focus_data: A list of focus data returned by the autofocus procedure.
|
:return: All required data for the next move. This includes the updated delta value and offset. Also returns what wrong_axis is i.e. if the direction is 'x', wrong_axis = 'y'.
|
||||||
:return: All required data for the next move. This includes the updated delta value, offset and focus_data. Also returns what wrong_axis is i.e. if the direction is 'x', wrong_axis = 'y'.
|
|
||||||
"""
|
"""
|
||||||
if axis == 'x':
|
if axis == 'x':
|
||||||
csm.move_in_image_coordinates(x = step_size['x'], y = 0)
|
csm.move_in_image_coordinates(x = step_size['x'], y = 0)
|
||||||
|
|
@ -91,20 +89,19 @@ def move_and_measure(
|
||||||
csm.move_in_image_coordinates(x = 0, y = step_size['y'])
|
csm.move_in_image_coordinates(x = 0, y = step_size['y'])
|
||||||
wrong_axis = 'x'
|
wrong_axis = 'x'
|
||||||
if autofocus_proc:
|
if autofocus_proc:
|
||||||
focus_data = autofocus.looping_autofocus(dz = 800)
|
autofocus.looping_autofocus(dz = 800)
|
||||||
image2 = cv2.resize(np.array(Image.open(cam.grab_jpeg().open())), dsize=(0,0), fx= 1, fy= 1)
|
image2 = cv2.resize(np.array(Image.open(cam.grab_jpeg().open())), dsize=(0,0), fx= 1, fy= 1)
|
||||||
offset = [x * 1 for x in fft_image_tracking.displacement_between_images(image_0 = image1, image_1 = image2, sigma=10, fractional_threshold=0.1, pad=True)] # Units is pixels
|
offset = [x * 1 for x in fft_image_tracking.displacement_between_images(image_0 = image1, image_1 = image2, sigma=10, fractional_threshold=0.1, pad=True)] # Units is pixels
|
||||||
delta['x'] = int(offset[1])
|
delta['x'] = int(offset[1])
|
||||||
delta['y'] = int(offset[0])
|
delta['y'] = int(offset[0])
|
||||||
|
|
||||||
return delta, offset, focus_data, wrong_axis
|
return delta, offset, wrong_axis
|
||||||
|
|
||||||
def acquie_z_predict_points(
|
def acquie_z_predict_points(
|
||||||
stream_resolution: list[int],
|
stream_resolution: list[int],
|
||||||
direction: int,
|
direction: int,
|
||||||
axis: str,
|
axis: str,
|
||||||
delta: dict[str, int],
|
delta: dict[str, int],
|
||||||
focus_data: list[float],
|
|
||||||
data,
|
data,
|
||||||
csm: CSMDep,
|
csm: CSMDep,
|
||||||
cam: CamDep,
|
cam: CamDep,
|
||||||
|
|
@ -118,7 +115,6 @@ def acquie_z_predict_points(
|
||||||
:param direction: The direction the stage moves.
|
:param direction: The direction the stage moves.
|
||||||
:params axis: The axis which is being measured. This must be 'x' or 'y'.
|
:params axis: The axis which is being measured. This must be 'x' or 'y'.
|
||||||
:params delta: A dictionary of 'x' and 'y' offsets.
|
:params delta: A dictionary of 'x' and 'y' offsets.
|
||||||
:params focus_data: A list of focus data returned by the autofocus procedure.
|
|
||||||
:params stage_coords: A list of all previous positions the stage has been.
|
:params stage_coords: A list of all previous positions the stage has been.
|
||||||
:params cor_lat_steps: A list of all correlation values.
|
:params cor_lat_steps: A list of all correlation values.
|
||||||
:return: Stage_coords and cor_lat_steps are lists of data tracked throughout the test. Delta is updated and tracked after each move.
|
:return: Stage_coords and cor_lat_steps are lists of data tracked throughout the test. Delta is updated and tracked after each move.
|
||||||
|
|
@ -131,13 +127,12 @@ def acquie_z_predict_points(
|
||||||
image1 = cv2.resize(
|
image1 = cv2.resize(
|
||||||
np.array(Image.open(cam.grab_jpeg().open())), dsize=(0, 0), fx=1, fy=1
|
np.array(Image.open(cam.grab_jpeg().open())), dsize=(0, 0), fx=1, fy=1
|
||||||
)
|
)
|
||||||
delta, offset, focus_data, wrong_axis = move_and_measure(
|
delta, offset, wrong_axis = move_and_measure(
|
||||||
step_size=generate_move_dicts(medium_step, stream_resolution, direction),
|
step_size=generate_move_dicts(medium_step, stream_resolution, direction),
|
||||||
axis=axis,
|
axis=axis,
|
||||||
delta=delta,
|
delta=delta,
|
||||||
image1=image1,
|
image1=image1,
|
||||||
autofocus_proc=True,
|
autofocus_proc=True,
|
||||||
focus_data=focus_data,
|
|
||||||
csm=csm,
|
csm=csm,
|
||||||
autofocus=autofocus,
|
autofocus=autofocus,
|
||||||
cam=cam,
|
cam=cam,
|
||||||
|
|
@ -155,7 +150,6 @@ def check_stage_operation(
|
||||||
direction: int,
|
direction: int,
|
||||||
axis: str,
|
axis: str,
|
||||||
delta: dict[str, int],
|
delta: dict[str, int],
|
||||||
focus_data: list[float],
|
|
||||||
data,
|
data,
|
||||||
minimum_offset_small: dict[str, float],
|
minimum_offset_small: dict[str, float],
|
||||||
csm: CSMDep,
|
csm: CSMDep,
|
||||||
|
|
@ -171,7 +165,6 @@ def check_stage_operation(
|
||||||
:param direction: The direction the stage moves.
|
:param direction: The direction the stage moves.
|
||||||
:params axis: The axis which is being measured. This must be 'x' or 'y'.
|
:params axis: The axis which is being measured. This must be 'x' or 'y'.
|
||||||
:params delta: A dictionary of 'x' and 'y' offsets.
|
:params delta: A dictionary of 'x' and 'y' offsets.
|
||||||
:params focus_data: A list of focus data returned by the autofocus procedure.
|
|
||||||
:params stage_coords: A list of all previous positions the stage has been.
|
:params stage_coords: A list of all previous positions the stage has been.
|
||||||
:params cor_lat_steps: A list of all correlation values.
|
:params cor_lat_steps: A list of all correlation values.
|
||||||
:params minimum_offset_small: A dictionary containing the minimum values for a successful correlation.
|
:params minimum_offset_small: A dictionary containing the minimum values for a successful correlation.
|
||||||
|
|
@ -184,13 +177,12 @@ def check_stage_operation(
|
||||||
image1 = cv2.resize(
|
image1 = cv2.resize(
|
||||||
np.array(Image.open(cam.grab_jpeg().open())), dsize=(0, 0), fx=1, fy=1
|
np.array(Image.open(cam.grab_jpeg().open())), dsize=(0, 0), fx=1, fy=1
|
||||||
)
|
)
|
||||||
delta, offset, focus_data, wrong_axis = move_and_measure(
|
delta, offset, wrong_axis = move_and_measure(
|
||||||
step_size=generate_move_dicts(small_step, stream_resolution, direction),
|
step_size=generate_move_dicts(small_step, stream_resolution, direction),
|
||||||
axis=axis,
|
axis=axis,
|
||||||
delta=delta,
|
delta=delta,
|
||||||
image1=image1,
|
image1=image1,
|
||||||
autofocus_proc=False,
|
autofocus_proc=False,
|
||||||
focus_data=focus_data,
|
|
||||||
csm=csm,
|
csm=csm,
|
||||||
autofocus=autofocus,
|
autofocus=autofocus,
|
||||||
cam=cam,
|
cam=cam,
|
||||||
|
|
@ -204,7 +196,7 @@ def check_stage_operation(
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Correlation failed. Refocusing to check. Attempt {failure_count + 1}/3"
|
f"Correlation failed. Refocusing to check. Attempt {failure_count + 1}/3"
|
||||||
)
|
)
|
||||||
focus_data = autofocus.looping_autofocus(dz=1000)
|
autofocus.looping_autofocus(dz=1000)
|
||||||
image2 = cv2.resize(
|
image2 = cv2.resize(
|
||||||
np.array(Image.open(cam.grab_jpeg().open())), dsize=(0, 0), fx=1, fy=1
|
np.array(Image.open(cam.grab_jpeg().open())), dsize=(0, 0), fx=1, fy=1
|
||||||
)
|
)
|
||||||
|
|
@ -310,7 +302,7 @@ class RangeofMotionThing(lt.Thing):
|
||||||
:params direction: The direction which is being measured. This must be 1 or -1.
|
:params direction: The direction which is being measured. This must be 1 or -1.
|
||||||
:return: Results dictionary containing stage positions, correlations and the final position.
|
:return: Results dictionary containing stage positions, correlations and the final position.
|
||||||
"""
|
"""
|
||||||
focus_data = autofocus.looping_autofocus(dz = 1000)
|
autofocus.looping_autofocus(dz = 1000)
|
||||||
|
|
||||||
starting_position = list(stage.position.values())
|
starting_position = list(stage.position.values())
|
||||||
|
|
||||||
|
|
@ -346,7 +338,6 @@ class RangeofMotionThing(lt.Thing):
|
||||||
direction=direction,
|
direction=direction,
|
||||||
axis=axis,
|
axis=axis,
|
||||||
delta=delta,
|
delta=delta,
|
||||||
focus_data=focus_data,
|
|
||||||
data=rom_data,
|
data=rom_data,
|
||||||
csm=csm,
|
csm=csm,
|
||||||
cam=cam,
|
cam=cam,
|
||||||
|
|
@ -375,7 +366,7 @@ class RangeofMotionThing(lt.Thing):
|
||||||
else:
|
else:
|
||||||
csm.move_in_image_coordinates(x = 0, y = step_sizes_big['y'])
|
csm.move_in_image_coordinates(x = 0, y = step_sizes_big['y'])
|
||||||
|
|
||||||
focus_data = autofocus.looping_autofocus(dz = 800)
|
autofocus.looping_autofocus(dz = 800)
|
||||||
|
|
||||||
rom_data.stage_coords.append(stage.position)
|
rom_data.stage_coords.append(stage.position)
|
||||||
|
|
||||||
|
|
@ -385,7 +376,6 @@ class RangeofMotionThing(lt.Thing):
|
||||||
direction=direction,
|
direction=direction,
|
||||||
axis=axis,
|
axis=axis,
|
||||||
delta=delta,
|
delta=delta,
|
||||||
focus_data=focus_data,
|
|
||||||
data = rom_data,
|
data = rom_data,
|
||||||
minimum_offset_small=minimum_offset_small,
|
minimum_offset_small=minimum_offset_small,
|
||||||
csm=csm,
|
csm=csm,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue