pysdic.PointCloud.remove_not_finite#

PointCloud.remove_not_finite(inplace=False)[source]#

Remove points from the point cloud that contain non-finite values (NaN or Inf).

This method returns a new PointCloud object with all points containing NaN or Inf values removed. The properties associated with the points are also updated accordingly.

See also

  • is_finite() method for getting a boolean mask of finite points.

  • remove_points() method for removing points at specified indices.

Parameters:

inplace (bool, optional) – If True, modifies the current point cloud in place and returns itself. If False, returns a new PointCloud instance (default is False).

Returns:

A new PointCloud object containing only the finite points or the modified current instance if inplace is True.

Return type:

PointCloud

Examples

Create a PointCloud from a NumPy array with some non-finite values.

 1import numpy as np
 2from pysdic import PointCloud
 3
 4# Create a point cloud with some non-finite values
 5points_with_nan = np.array([[0.0, 1.0, 2.0],
 6                            [np.nan, 1.0, 2.0],
 7                            [3.0, np.inf, 4.0],
 8                            [5.0, 6.0, 7.0]])
 9
10point_cloud = PointCloud.from_array(points_with_nan)

Removing non-finite points from the point cloud.

1# Remove non-finite points
2finite_point_cloud = point_cloud.remove_not_finite()
3print(finite_point_cloud.points)
4# Output: A NumPy array of shape (2, 3) containing only the finite points