Skip to content

Commit ba7d10a

Browse files
committed
FIX: More
1 parent a5b5093 commit ba7d10a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

mne/source_estimate.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3219,18 +3219,21 @@ def spatio_temporal_dist_adjacency(src, n_times, dist, verbose=None):
32193219
vertices are time 1, the nodes from 2 to 2N are the vertices
32203220
during time 2, etc.
32213221
"""
3222+
from scipy import sparse
3223+
32223224
if src[0]["dist"] is None:
32233225
raise RuntimeError(
32243226
"src must have distances included, consider using "
32253227
"setup_source_space with add_dist=True"
32263228
)
32273229
blocks = [s["dist"][s["vertno"], :][:, s["vertno"]] for s in src]
32283230
# Ensure we keep explicit zeros; deal with changes in SciPy
3229-
for block in blocks:
3231+
for bi, block in enumerate(blocks):
32303232
if isinstance(block, np.ndarray):
32313233
block[block == 0] = -np.inf
32323234
else:
32333235
block.data[block.data == 0] == -1
3236+
blocks[bi] = sparse.csr_array(block) # avoid SciPy dep warning about mat->arr
32343237
edges = sparse.block_diag(blocks)
32353238
edges.data[:] = np.less_equal(edges.data, dist)
32363239
# clean it up and put it in coo format

0 commit comments

Comments
 (0)