Skip to content

Commit e3522e5

Browse files
committed
fixes negative sqrt input silently failing
1 parent a7c9666 commit e3522e5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/resources/scripts/delphi_apply.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,15 @@
103103
s = 1.5 * laserdist
104104
are = np.sqrt(s * np.power(s - laserdist, 3))
105105
s = (a + b + c) / 2.
106-
apx = np.sqrt(s * (s - a) * (s - b) * (s - c))
106+
sqrtinp = s * (s - a) * (s - b) * (s - c)
107+
if sqrtinp < 0:
108+
print(json.dumps({
109+
"error": True,
110+
"message": "Computed pixel area is invalid.",
111+
"method": detection
112+
}))
113+
exit(1)
114+
apx = np.sqrt(sqrtinp)
107115
if apx == 0:
108116
print(json.dumps({
109117
"error": True,

0 commit comments

Comments
 (0)