Typehint added and import removed.
This commit is contained in:
parent
1afaa53413
commit
ab9a324122
1 changed files with 22 additions and 21 deletions
|
|
@ -14,7 +14,6 @@ this is 10% of the expected motion is the measured axis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import cv2
|
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
import time
|
import time
|
||||||
|
|
@ -94,6 +93,7 @@ def _predict_z(
|
||||||
|
|
||||||
return z_dest - stage.position["z"]
|
return z_dest - stage.position["z"]
|
||||||
|
|
||||||
|
|
||||||
def _move_and_measure(
|
def _move_and_measure(
|
||||||
step_size: dict[str, float],
|
step_size: dict[str, float],
|
||||||
axis: Literal["x", "y"],
|
axis: Literal["x", "y"],
|
||||||
|
|
@ -175,6 +175,7 @@ def _acquire_z_predict_points(
|
||||||
autofocus=autofocus,
|
autofocus=autofocus,
|
||||||
cam=cam,
|
cam=cam,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info(f"Offset measured as {data.delta[axis]}")
|
logger.info(f"Offset measured as {data.delta[axis]}")
|
||||||
|
|
||||||
data.measure(stage.position, offset)
|
data.measure(stage.position, offset)
|
||||||
|
|
@ -282,7 +283,7 @@ def _motion_detection(
|
||||||
stage: StageDep,
|
stage: StageDep,
|
||||||
cam: CamDep,
|
cam: CamDep,
|
||||||
logger: lt.deps.InvocationLogger,
|
logger: lt.deps.InvocationLogger,
|
||||||
) -> dict:
|
) -> dict[str, int]:
|
||||||
"""Move the stage until motion is detected along a specified axis and direction.
|
"""Move the stage until motion is detected along a specified axis and direction.
|
||||||
|
|
||||||
:params axis: The axis in which the stage is moving. This must be 'x' or 'y'.
|
:params axis: The axis in which the stage is moving. This must be 'x' or 'y'.
|
||||||
|
|
@ -523,9 +524,9 @@ class RangeofMotionThing(lt.Thing):
|
||||||
direction=axis_dir[1],
|
direction=axis_dir[1],
|
||||||
)
|
)
|
||||||
# Save results from single axis and direction
|
# Save results from single axis and direction
|
||||||
rom_results[f"{'positive' if axis_dir[1] == 1 else 'negative'} {axis_dir[0]}"] = (
|
rom_results[
|
||||||
axis_dir_results
|
f"{'positive' if axis_dir[1] == 1 else 'negative'} {axis_dir[0]}"
|
||||||
)
|
] = axis_dir_results
|
||||||
|
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
total_time = (end_time - start_time) / 60
|
total_time = (end_time - start_time) / 60
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue