From e3522e56d844e8d7f9b374cee99480aff8c26e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Langenk=C3=A4mper?= Date: Tue, 23 Jul 2024 10:22:54 +0200 Subject: [PATCH] fixes negative sqrt input silently failing --- src/resources/scripts/delphi_apply.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/resources/scripts/delphi_apply.py b/src/resources/scripts/delphi_apply.py index 1e983ae5..ff3092a0 100644 --- a/src/resources/scripts/delphi_apply.py +++ b/src/resources/scripts/delphi_apply.py @@ -103,7 +103,15 @@ s = 1.5 * laserdist are = np.sqrt(s * np.power(s - laserdist, 3)) s = (a + b + c) / 2. - apx = np.sqrt(s * (s - a) * (s - b) * (s - c)) + sqrtinp = s * (s - a) * (s - b) * (s - c) + if sqrtinp < 0: + print(json.dumps({ + "error": True, + "message": "Computed pixel area is invalid.", + "method": detection + })) + exit(1) + apx = np.sqrt(sqrtinp) if apx == 0: print(json.dumps({ "error": True,