Skip to content

Commit ed85d09

Browse files
committed
fix: Use np.ptp instad of .ptp. Closes #360
1 parent e2147d5 commit ed85d09

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/pyntcloud/plot/matplotlib_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def plot_with_matplotlib(cloud, **kwargs):
2222

2323
colors = get_colors(cloud, kwargs["use_as_color"], kwargs["cmap"])
2424

25-
ptp = cloud.xyz.ptp()
25+
ptp = np.ptp(cloud.xyz)
2626

2727
plt.figure(figsize=(10, 10))
2828
ax = plt.axes(projection='3d')

src/pyntcloud/plot/pythreejs_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def plot_with_pythreejs(cloud, **kwargs):
6969

7070
colors = get_colors(cloud, kwargs["use_as_color"], kwargs["cmap"])
7171

72-
ptp = cloud.xyz.ptp()
72+
ptp = np.ptp(cloud.xyz)
7373

7474
children = []
7575
widgets = []

src/pyntcloud/structures/voxelgrid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def compute(self):
7777
"""ABC API."""
7878
xyzmin = self._points.min(0)
7979
xyzmax = self._points.max(0)
80-
xyz_range = self._points.ptp(0)
80+
xyz_range = np.ptp(self._points, 0)
8181

8282
if self.regular_bounding_box:
8383
#: adjust to obtain a minimum bounding box with all sides of equal length
@@ -88,7 +88,7 @@ def compute(self):
8888
for n, size in enumerate(self.sizes):
8989
if size is None:
9090
continue
91-
margin = (((self._points.ptp(0)[n] // size) + 1) * size) - self._points.ptp(0)[n]
91+
margin = (((xyz_range[n] // size) + 1) * size) - xyz_range[n]
9292
xyzmin[n] -= margin / 2
9393
xyzmax[n] += margin / 2
9494
self.x_y_z[n] = ((xyzmax[n] - xyzmin[n]) / size).astype(int)

0 commit comments

Comments
 (0)