Skip to content

Commit

Permalink
[REF] changed numpy row_stack to vstack
Browse files Browse the repository at this point in the history
  • Loading branch information
eric2302 committed May 22, 2024
1 parent 17a40be commit 4a96f85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion neuromaps/nulls/spins.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def get_parcel_centroids(surfaces, parcellation=None, method='surface',
centroids.append(vertices)
hemiid.extend([n] * len(vertices))

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


def _gen_rotation(seed=None):
Expand Down
6 changes: 3 additions & 3 deletions neuromaps/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,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 Expand Up @@ -374,13 +374,13 @@ def get_surface_distance(surface, parcellation=None, medial=None,

# calculate distance from each vertex to all other vertices
graph = make_surf_graph(vert, faces, mask=mask)
dist = np.row_stack(Parallel(n_jobs=n_proc, max_nbytes=None)(
dist = np.vstack(Parallel(n_jobs=n_proc, max_nbytes=None)(
delayed(_get_graph_distance)(n, graph, labels) for n in range(n_vert)
))

# average distance for all vertices within a parcel + set diagonal to 0
if labels is not None:
dist = np.row_stack([
dist = np.vstack([
dist[labels == lab].mean(axis=0) for lab in np.unique(labels)
])
dist[np.diag_indices_from(dist)] = 0
Expand Down

0 comments on commit 4a96f85

Please sign in to comment.