Apply changes to meet customer specification #27

Merged
foefl merged 14 commits from main_adapted into main 2026-01-07 09:30:57 +00:00
3 changed files with 25 additions and 2 deletions
Showing only changes of commit cc72ee2ee5 - Show all commits

13
cli.py
View File

@ -5,7 +5,7 @@ from typing import cast
from dopt_basics import cli from dopt_basics import cli
from dopt_sensor_anomalies import _interface from dopt_sensor_anomalies import _interface, constants
@dc.dataclass() @dc.dataclass()
@ -13,6 +13,7 @@ class CliArgs:
img_path: str img_path: str
calib_value_x: float calib_value_x: float
calib_value_y: float calib_value_y: float
anomaly_threshold: float
def main() -> int: def main() -> int:
@ -34,6 +35,15 @@ def main() -> int:
help="calibration value in pixels per mcm for y axis, type: float", help="calibration value in pixels per mcm for y axis, type: float",
type=float, type=float,
) )
parser.add_argument(
"--anomaly_threshold",
help=(
f"optional anomaly threshold to set, default: "
f"{constants.ANOMALY_THRESHOLD_DEFAULT}, type: float"
),
default=constants.ANOMALY_THRESHOLD_DEFAULT,
type=float,
)
args = cast(CliArgs, parser.parse_args()) args = cast(CliArgs, parser.parse_args())
with cli.LoadingAnimation( with cli.LoadingAnimation(
@ -44,6 +54,7 @@ def main() -> int:
args.img_path, args.img_path,
args.calib_value_x, args.calib_value_x,
args.calib_value_y, args.calib_value_y,
args.anomaly_threshold,
) )
if status != 0: if status != 0:
loader.stop(interrupt=True) loader.stop(interrupt=True)

View File

@ -6,7 +6,7 @@ from unittest.mock import patch
from dopt_basics import cli from dopt_basics import cli
from dopt_sensor_anomalies import _interface from dopt_sensor_anomalies import _interface, constants
@dc.dataclass() @dc.dataclass()
@ -14,6 +14,7 @@ class CliArgs:
img_path: str img_path: str
calib_value_x: float calib_value_x: float
calib_value_y: float calib_value_y: float
anomaly_threshold: float
@patch("dopt_sensor_anomalies._find_paths.STOP_FOLDER_NAME", "src") @patch("dopt_sensor_anomalies._find_paths.STOP_FOLDER_NAME", "src")
@ -37,6 +38,15 @@ def main() -> int:
help="calibration value in pixels per mcm for y axis, type: float", help="calibration value in pixels per mcm for y axis, type: float",
type=float, type=float,
) )
parser.add_argument(
"--anomaly_threshold",
help=(
f"optional anomaly threshold to set, default: "
f"{constants.ANOMALY_THRESHOLD_DEFAULT}, type: float"
),
default=constants.ANOMALY_THRESHOLD_DEFAULT,
type=float,
)
args = cast(CliArgs, parser.parse_args()) args = cast(CliArgs, parser.parse_args())
with cli.LoadingAnimation( with cli.LoadingAnimation(
@ -47,6 +57,7 @@ def main() -> int:
args.img_path, args.img_path,
args.calib_value_x, args.calib_value_x,
args.calib_value_y, args.calib_value_y,
args.anomaly_threshold,
) )
if status != 0: if status != 0:
loader.stop(interrupt=True) loader.stop(interrupt=True)

1
run_cli_mocked.ps1 Normal file
View File

@ -0,0 +1 @@
pdm run python .\cli_mocked.py ".\prototypes\img\window_19_fail_model.bmp" 0.251 0.251