Skip to content

Commit

Permalink
Merge pull request #82 from biigle/fixNegativeSqrtInp
Browse files Browse the repository at this point in the history
Fix for negative sqrt silently failing
  • Loading branch information
mzur authored Jul 23, 2024
2 parents a7c9666 + e3522e5 commit c28b7ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/resources/scripts/delphi_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c28b7ea

Please sign in to comment.