Skip to content

Commit 552e9e7

Browse files
Jammy2211Jammy2211
authored andcommitted
fix?
1 parent 60c5647 commit 552e9e7

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

autoarray/structures/mesh/delaunay_2d.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ def scipy_delaunay(points_np, query_points_np, use_voronoi_areas, areas_factor):
5959
xp=np,
6060
)
6161

62+
areas = np.maximum(areas, 0.0)
6263
split_point_areas = areas_factor * np.sqrt(areas)
64+
split_point_areas = np.where(np.isfinite(split_point_areas), split_point_areas, 0.0)
6365

6466
# ---------- Compute split cross points for Split regularization ----------
6567
split_points = split_points_from(
@@ -259,28 +261,6 @@ def split_points_from(points, area_weights, xp=np):
259261
N = points.shape[0]
260262
offsets = area_weights
261263

262-
if not np.isfinite(offsets).all():
263-
n_nan = np.isnan(offsets).sum()
264-
n_inf = np.isinf(offsets).sum()
265-
print(
266-
f"[pure_callback] Voronoi offsets NON-FINITE: "
267-
f"n_nan={n_nan} n_inf={n_inf} "
268-
f"min={np.nanmin(offsets)} max={np.nanmax(offsets)}"
269-
)
270-
271-
# Save everything needed to reproduce offline
272-
np.savez(
273-
"callback_bad_voronoi_offsets.npz",
274-
points=points,
275-
offsets=offsets,
276-
)
277-
278-
raise FloatingPointError(
279-
"voronoi_offsets_numpy produced NaN/inf; "
280-
"saved callback_bad_voronoi_offsets.npz"
281-
)
282-
283-
284264
x = points[:, 0]
285265
y = points[:, 1]
286266

0 commit comments

Comments
 (0)