BUG: fNIRS `interpolate_bads` copies wrong channel when positions are missing
维护者通常 1 天内回复
评估
调研方向
Start in _interpolate_bads_nirs, where the nearest good channel is chosen with np.argmin over distances; the reproduction script in the issue shows the wrong copy. Check the open pull request #14416 first, since it already targets this fix. Done means bad channels without positions become NaN, good channels without positions are never chosen as neighbours, and a ValueError is raised when a positioned bad channel has no good neighbour left.
由索引模型根据 Issue 内容生成。
描述
For bad channels without positions (NaN or all zero), interpolate_bads warns that their values "will be all NaN". _interpolate_bads_nirs instead picks the nearest channel with np.argmin over the distances, which returns the first NaN index for NaN positions, so the bad channel gets data from an arbitrary channel. All-zero positions give the same result.
import mne
import numpy as np
names = [f"S{i}_D{i} {w}" for i in (1, 2, 3) for w in (760, 850)]
info = mne.create_info(names, 10.0, "fnirs_cw_amplitude")
for ch in info["chs"]:
ch["loc"][:] = np.nan
ch["loc"][9] = 760 if ch["ch_name"].endswith("760") else 850
raw = mne.io.RawArray(np.arange(1, 7)[:, None] * np.ones((6, 5)), info)
raw.info["bads"] = ["S3_D3 760", "S3_D3 850"]
raw.interpolate_bads(origin=(0, 0, 0))
# RuntimeWarning: ... The values of these channels will be all NaN.
print(raw.get_data()[4:, 0]) # [1. 2.]: S1_D1 copied, not NaN
Proposed fix, in _interpolate_bads_nirs:
- Set bad channels without positions to NaN, as the warning says.
- Never pick good channels without positions.
- Raise
ValueErrorwhen a bad channel with a position has no good neighbor left.
- 主要语言
- Python
- 星标
- 3.5k
- 派生
- 1.6k
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 74
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mne-tools/mne-python 的其他 Issue
-
ENH: Add `description` filter parameter to `Raw.crop_by_annotations()`可能已有人在做 @aman-coder03 于 193 天前认领。 未关闭ENH
难度 2/5 1-3 小时 新手友好度 72/100
mne-tools/mne-python#13743 · 2 条评论 ·
维护者通常 1 天内回复
-
BUG
难度 3/5 1-2 天 新手友好度 45/100
mne-tools/mne-python#14421 ·
维护者通常 1 天内回复
-
BUG
难度 4/5 3-5 天 新手友好度 35/100
mne-tools/mne-python#14420 · 3 条评论 ·
维护者通常 1 天内回复
-
Add a check for `sklearn` availability to `decoding` module可能已有人在做 @SohamXYZDev 于 3 天前认领。 未关闭
难度 3/5 半天 新手友好度 35/100
mne-tools/mne-python#14394 · 13 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 8/100
mne-tools/mne-python#14392 · 3 条评论 ·
维护者通常 1 天内回复
查看 mne-tools/mne-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
cellrishi-code/claude-skills-atlas#165 ·
维护者通常 1 天内回复
-
bug confirmed issue
难度 2/5 1-3 小时 新手友好度 72/100
open-webui/open-webui#32635 · 1 条评论 ·
维护者通常 1 天内回复
-
Filters: ?field:ne=null matches NULL rows instead of non-NULL ones可能已有人在做 @rshdhere 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
Netflix/metaflow-service#504 ·
-
needs-triage
难度 2/5 1-3 小时 新手友好度 84/100
gke-labs/kube-agents#3394 ·
维护者通常 1 天内回复
-
A2A audit timestamps end in +00:00Z (invalid ISO 8601)可能已有人在做 @O1sumitkumar 今天认领。 未关闭bug good first issue help wanted python
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复