@@ -67,28 +67,6 @@ def scipy_delaunay(points_np, query_points_np, use_voronoi_areas, areas_factor):
6767 area_weights = split_point_areas ,
6868 )
6969
70- # --- DEBUG / SAFETY CHECK: Voronoi areas ---
71- if not np .isfinite (split_points ).all ():
72- n_nan = np .isnan (split_points ).sum ()
73- n_inf = np .isinf (split_points ).sum ()
74- print (
75- f"[pure_callback] Voronoi split_points NON-FINITE: "
76- f"n_nan={ n_nan } n_inf={ n_inf } "
77- f"min={ np .nanmin (split_points )} max={ np .nanmax (split_points )} "
78- )
79-
80- # Save everything needed to reproduce offline
81- np .savez (
82- "callback_bad_voronoi_split_points.npz" ,
83- points = points ,
84- split_points = split_points ,
85- )
86-
87- raise FloatingPointError (
88- "voronoi_split_points_numpy produced NaN/inf; "
89- "saved callback_bad_voronoi_split_points.npz"
90- )
91-
9270 # ---------- find_simplex for split cross points ----------
9371 split_points_idx = tri .find_simplex (split_points )
9472
@@ -281,6 +259,28 @@ def split_points_from(points, area_weights, xp=np):
281259 N = points .shape [0 ]
282260 offsets = area_weights
283261
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+
284284 x = points [:, 0 ]
285285 y = points [:, 1 ]
286286
0 commit comments