Skip to content

Commit

Permalink
speed up peak detection by removing datapoints below the limit
Browse files Browse the repository at this point in the history
  • Loading branch information
erdogant committed Oct 25, 2023
1 parent 67eadb7 commit cd732f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion findpeaks/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,10 @@ def topology(X, limit=None, reverse=True, verbose=3):
groups0 = {}

# Get indices orderd by value from high to low
indices = [(i, j) for i in range(h) for j in range(w)]
# indices = [(i, j) for i in range(h) for j in range(w)]
indices = [(i, j) for i in range(h) for j in range(w) if _get_indices(X, (i, j)) > limit]
indices.sort(key=lambda p: _get_indices(X, p), reverse=reverse)
# indices = indices[list(map(lambda x: _get_indices(X, x)>limit, indices))].tolist()

# Maintains the growing sets
uf = union_find.UnionFind()
Expand Down

0 comments on commit cd732f7

Please sign in to comment.