Skip to content

Commit

Permalink
[MNT] updated numpy functions to accomodate NPY201 style check
Browse files Browse the repository at this point in the history
  • Loading branch information
eric2302 committed Apr 2, 2024
1 parent 3d25eb7 commit 117af21
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion netneurotools/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def _reorder_rows(arr):
idx = list(cl[_reorder_rows(assignments[cl])])
reordered += [assignments[idx]]
row_idx += idx
assignments = np.row_stack(reordered)
assignments = np.vstack(reordered)

# otherwise, just do a massive reordering of all the rows
else:
Expand Down
2 changes: 1 addition & 1 deletion netneurotools/datasets/mirchi.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _get_fc(data_dir=None, resume=True, verbose=1):
fc = [np.corrcoef(ses.T)[np.tril_indices(len(ses.T), k=-1)] for ses in ts]

# return stacked sessions
return np.row_stack(fc)
return np.vstack(fc)


def _get_panas(data_dir=None, resume=True, verbose=1):
Expand Down
4 changes: 2 additions & 2 deletions netneurotools/freesurfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def find_parcel_centroids(*, lhannot, rhannot, method='surface',
centroids.append(roi)
hemiid.append(n)

return np.row_stack(centroids), np.asarray(hemiid)
return np.vstack(centroids), np.asarray(hemiid)


def _geodesic_parcel_centroid(vertices, faces, inds):
Expand Down Expand Up @@ -419,7 +419,7 @@ def _get_fsaverage_coords(version='fsaverage', surface='sphere'):
coords.append(read_geometry(sphere)[0])
hemi.append(np.ones(len(coords[-1])) * n)

return np.row_stack(coords), np.hstack(hemi)
return np.vstack(coords), np.hstack(hemi)


def _get_fsaverage_spins(version='fsaverage', spins=None, n_rotate=1000,
Expand Down
2 changes: 1 addition & 1 deletion netneurotools/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def make_surf_graph(vertices, faces, mask=None):
# get all (direct + indirect) edges from surface
direct_edges, direct_weights = get_direct_edges(vertices, faces)
indirect_edges, indirect_weights = get_indirect_edges(vertices, faces)
edges = np.row_stack((direct_edges, indirect_edges))
edges = np.vstack((direct_edges, indirect_edges))
weights = np.hstack((direct_weights, indirect_weights))

# remove edges that include a vertex in `mask`
Expand Down
2 changes: 1 addition & 1 deletion netneurotools/tests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def test_gen_spinsamples():
# "other hemisphere"
coords = [_get_sphere_coords(s, t, r=1) for s, t in
itertools.product(range(0, 360, 45), range(0, 360, 45))]
coords = np.row_stack([coords, coords])
coords = np.vstack([coords, coords])
hemi = np.hstack([np.zeros(len(coords) // 2), np.ones(len(coords) // 2)])

# generate "normal" test spins
Expand Down
2 changes: 1 addition & 1 deletion netneurotools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def get_centroids(img, labels=None, image_space=False):
if labels is None:
labels = np.trim_zeros(np.unique(data))

centroids = np.row_stack(ndimage.center_of_mass(data, labels=data,
centroids = np.vstack(ndimage.center_of_mass(data, labels=data,
index=labels))

if image_space:
Expand Down

0 comments on commit 117af21

Please sign in to comment.