Skip to content

Commit

Permalink
Switch to progressbar
Browse files Browse the repository at this point in the history
  • Loading branch information
asistradition committed Feb 10, 2022
1 parent 572a801 commit 5543a31
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions inferelator_prior/velocity/calc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as _np
from scipy.sparse import issparse as _is_sparse

from tqdm import trange

def calc_velocity(expr, time_axis, neighbor_graph, n_neighbors, wrap_time=120):
"""
Expand Down Expand Up @@ -68,7 +68,7 @@ def _find_local(expr, neighbor_graph, n_neighbors):
n, m = expr.shape
neighbor_sparse = _is_sparse(neighbor_graph)

for i in range(n):
for i in trange(n):
n_slice = neighbor_graph[i, :]
if neighbor_sparse:
if n_slice.data.shape[0] > n_neighbors:
Expand All @@ -78,7 +78,4 @@ def _find_local(expr, neighbor_graph, n_neighbors):
else:
keepers = _np.argsort(n_slice)[-1 * n_neighbors:]

if i % 100 == 0:
print("Extracted {n} neighbors for sample {i} / {t}".format(n=len(keepers), i=i, t=n))

yield i, _np.insert(keepers, 0, i)

0 comments on commit 5543a31

Please sign in to comment.