Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
LLehner committed Oct 10, 2024
1 parent 3e47df8 commit 6cbc09e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/squidpy/gr/_niche.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,9 @@ def _aggregate(adata: AnnData, normalized_adjacency_matrix: sps.spmatrix, aggreg
if aggregation == "mean":
aggregated_matrix = normalized_adjacency_matrix @ adata.X
elif aggregation == "variance":
mean_matrix = normalized_adjacency_matrix @ adata.X
mean_squared_matrix = normalized_adjacency_matrix @ (adata.X * adata.X)
mean_matrix = (normalized_adjacency_matrix @ adata.X).toarray()
X_to_arr = adata.X.toarray()
mean_squared_matrix = normalized_adjacency_matrix @ (X_to_arr * X_to_arr)
aggregated_matrix = mean_squared_matrix - mean_matrix * mean_matrix
else:
raise ValueError(f"Invalid aggregation method '{aggregation}'. Please choose either 'mean' or 'variance'.")
Expand Down

0 comments on commit 6cbc09e

Please sign in to comment.