Skip to content

Commit 5e83f87

Browse files
authored
Update boundary.py
Fixed problem when impossible to create a boundary due to Simplex problem
1 parent b4a0c14 commit 5e83f87

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/segger/prediction/boundary.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,18 @@ def generate_boundaries(df, x="x_location", y="y_location", cell_id="segger_cell
341341
def generate_boundary(t, x="x_location", y="y_location"):
342342
if len(t) < 3:
343343
return None
344-
bi = BoundaryIdentification(t[[x, y]].values)
345-
bi.calculate_part_1(plot=False)
346-
bi.calculate_part_2(plot=False)
347-
geom = bi.find_cycles()
348344

345+
try:
346+
bi = BoundaryIdentification(t[[x, y]].values)
347+
bi.calculate_part_1(plot=False)
348+
bi.calculate_part_2(plot=False)
349+
geom = bi.find_cycles()
350+
except Exception as e:
351+
print(f"Failed to generate a boundary for the set of points of size len(t)={len(t)}")
352+
print("Warning:")
353+
print(e)
354+
print("Skipping this set")
355+
return None
349356
return geom
350357

351358

0 commit comments

Comments
 (0)