FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Unverified Commit 5a20a84d authored by Eduardo Gonzalez Solares's avatar Eduardo Gonzalez Solares
Browse files

Work around warning when dividing by zero

parent d2ccf8a5
No related branches found
No related tags found
1 merge request!3Dask
......@@ -88,16 +88,18 @@ def get_coords(coords, cof, center_x, max_x, direct=True):
max_desp = cof[0] * coords[1] ** 2 + cof[1] * coords[1] + cof[2]
dy_cof = max_desp / (max_x - center_x) ** 2
if direct:
sign = (coords[0] - center_x) / np.abs(coords[0] - center_x)
if np.isnan(sign):
sign = 1.0
if coords[0] > center_x:
sign = 1
else:
sign = -1
xi = np.abs(coords[0] - center_x)
return (center_x + sign * (xi + dy_cof * xi ** 2), coords[1])
else:
if coords[0] > center_x + cof[2]:
sign = 1
else:
sign = -1
xi = np.abs(coords[0] - center_x - cof[2])
sign = (coords[0] - center_x - cof[2]) / np.abs(coords[0] - center_x - cof[2])
if np.isnan(sign):
sign = 1.0
return (
center_x + sign * (np.sqrt(1 + 4 * dy_cof * xi) - 1) / (2 * dy_cof),
coords[1],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment