Skip to content

Commit

Permalink
bugfix: properly handle occupancy count with empty prds
Browse files Browse the repository at this point in the history
The size of the occupancy array was not equal to the number of bins when the last bin didn't
have an image in it. Now it's properly zero padded

This is probably related to #19
  • Loading branch information
blackwer committed Dec 7, 2023
1 parent daf142f commit fc66746
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ManifoldEM/S2tessellation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ def quaternion_to_S2(q):


def collect_nearest_neighbors(X, Q):
nbins = X.shape[0]
nbrs = NearestNeighbors(n_neighbors=1, algorithm='ball_tree').fit(X)
_, neighb_bins = nbrs.kneighbors(Q)
bin_counts = np.bincount(neighb_bins.squeeze())
neighb_bins = nbrs.kneighbors(Q, return_distance=False)
bin_counts = np.bincount(neighb_bins.squeeze(), minlength=nbins)
return neighb_bins, bin_counts


Expand Down

0 comments on commit fc66746

Please sign in to comment.