From 49096797db74b00b491a1172fdc7977c6f6f5169 Mon Sep 17 00:00:00 2001 From: Anton Karpov Date: Mon, 3 Aug 2026 15:27:07 +0300 Subject: [PATCH] Assign instead of compare when marking explicit zeros in dist adjacency In `spatio_temporal_dist_adjacency` the sparse branch wrote `block.data[block.data == 0] == -1`, a comparison whose result is discarded, so the explicit zeros the comment above it promises to keep were never marked. The dense branch one line up does the assignment. Introduced together with the guard itself in 3545c3f (#8050). --- mne/source_estimate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mne/source_estimate.py b/mne/source_estimate.py index ca7c90cdfc3..1dbd774c76f 100644 --- a/mne/source_estimate.py +++ b/mne/source_estimate.py @@ -3232,7 +3232,7 @@ def spatio_temporal_dist_adjacency(src, n_times, dist, verbose=None): if isinstance(block, np.ndarray): block[block == 0] = -np.inf else: - block.data[block.data == 0] == -1 + block.data[block.data == 0] = -1 blocks[bi] = sparse.csr_array(block) # avoid SciPy dep warning about mat->arr edges = sparse.block_diag(blocks) edges.data[:] = np.less_equal(edges.data, dist)