Skip to content

Commit 82c24f4

Browse files
committed
fix: buffer n slices for surfaces method by 5% if range
1 parent 6d98fb9 commit 82c24f4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

LoopStructural/utils/_surface.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,12 @@ def fit(
9696
"Number of isosurfaces must be greater than 1. Either use a positive integer or provide a list or float for a specific isovalue."
9797
)
9898
elif isinstance(values, int):
99+
var = np.nanmax(all_values) - np.nanmin(all_values)
100+
# buffer slices by 5% to make sure that we don't get isosurface does't exist issues
101+
buffer = var * 0.05
99102
isovalues = np.linspace(
100-
np.nanmin(all_values) + np.finfo(float).eps,
101-
np.nanmax(all_values) - np.finfo(float).eps,
103+
np.nanmin(all_values) + buffer,
104+
np.nanmax(all_values) - buffer,
102105
values,
103106
)
104107
logger.info(f'Isosurfacing at values: {isovalues}')

0 commit comments

Comments
 (0)