Skip to content

Commit

Permalink
fix letter variables
Browse files Browse the repository at this point in the history
  • Loading branch information
true-real-michael committed Mar 23, 2024
1 parent ca541f3 commit b3976ee
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
10 changes: 5 additions & 5 deletions octreelib/grid/grid_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ def map_leaf_points(self, function: Callable[[PointCloud], PointCloud]):
@abstractmethod
def map_leaf_points_cuda_ransac(
self,
n_poses_per_batch: int = 10,
threshold: int = 0.01,
n_iterations: int = 1024,
poses_per_batch: int = 1,
threshold: float = 0.01,
hypotheses_number: int = 1024,
):
"""
transform point cloud in the node using the function
:param n_poses_per_batch: Number of poses per batch.
:param poses_per_batch: Number of poses per batch.
:param threshold: Distance threshold.
:param n_iterations: Number of RANSAC iterations (<= 1024).
:param hypotheses_number: Number of RANSAC iterations (<= 1024).
"""
pass

Expand Down
6 changes: 3 additions & 3 deletions octreelib/octree/octree.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ def apply_mask(self, mask: np.ndarray):
"""
start_index = 0
for leaf in filter(lambda v: v.n_points != 0, self._cached_leaves):
n_points = leaf.n_points
leaf.apply_mask(mask[start_index : start_index + n_points])
start_index += n_points
points_number = leaf.n_points
leaf.apply_mask(mask[start_index : start_index + points_number])
start_index += points_number

@property
def n_points(self):
Expand Down
14 changes: 8 additions & 6 deletions octreelib/ransac/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,34 @@ def generate_random_int(rng_states, lower_bound, upper_bound):


@cuda.jit(device=True, inline=True)
def generate_random_indices(initial_point_indices, rng_states, block_size, n_points):
def generate_random_indices(
initial_point_indices, rng_states, block_size, points_number
):
"""
Generate random points from the given block.
:param initial_point_indices: Array to store the initial point indices.
:param rng_states: Random number generator states.
:param block_size: Size of the block.
:param n_points: Number of points to generate.
:param points_number: Number of points to generate.
"""

for i in range(n_points):
for i in range(points_number):
initial_point_indices[i] = generate_random_int(rng_states, 0, block_size)
return initial_point_indices


@cuda.jit(device=True, inline=True)
def generate_unique_random_indices(
initial_point_indices, rng_states, block_size, n_points
initial_point_indices, rng_states, block_size, points_number
):
"""
Generate unique random points from the given block.
:param initial_point_indices: Array to store the initial point indices.
:param rng_states: Random number generator states.
:param block_size: Size of the block.
:param n_points: Number of points to generate.
:param points_number: Number of points to generate.
"""
for ii in range(n_points):
for ii in range(points_number):
initial_point_indices[ii] = generate_random_int(rng_states, 0, block_size)
unique = False
while not unique:
Expand Down
12 changes: 6 additions & 6 deletions test/grid/test_cuda_ransac.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
@pytest.fixture()
def generated_grid_with_planar_clouds():
def generate_planar_cloud(
n_points, plane_coefficients, voxel_corner, edge_length, sigma
points_number, plane_coefficients, voxel_corner, edge_length, sigma
):
voxel_points = (
np.random.rand(n_points, 3) * np.array([edge_length - 6 * sigma] * 3)
np.random.rand(points_number, 3) * np.array([edge_length - 6 * sigma] * 3)
+ voxel_corner
+ 3 * sigma
)
noise = np.random.normal(0, sigma, (n_points,))
noise = np.random.normal(0, sigma, (points_number,))
plane_points_z = (
-plane_coefficients[0] * voxel_points[:, 0]
- plane_coefficients[1] * voxel_points[:, 1]
Expand All @@ -23,7 +23,7 @@ def generate_planar_cloud(
noisy_plane_points_z = plane_points_z + noise
return np.column_stack((voxel_points[:, :2], noisy_plane_points_z))

n_points = 10
points_number = 10
corner = np.array([0, 0, 0])
edge_length = 5
sigma = 0.1
Expand All @@ -33,7 +33,7 @@ def generate_planar_cloud(
grid.insert_points(
0,
generate_planar_cloud(
n_points=n_points,
points_number=points_number,
plane_coefficients=(1, 2, 3, 0.5),
voxel_corner=corner,
edge_length=edge_length,
Expand All @@ -43,7 +43,7 @@ def generate_planar_cloud(
grid.insert_points(
1,
generate_planar_cloud(
n_points=n_points,
points_number=points_number,
plane_coefficients=(-1, 2, 3, 0.5),
voxel_corner=corner,
edge_length=edge_length,
Expand Down

0 comments on commit b3976ee

Please sign in to comment.