Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

BUG: fNIRS `interpolate_bads` copies wrong channel when positions are missing

オープン
#14,415 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@kalomak がすでに取り組んでいます。

2026年10月14日 から。

  • #14416 @kalomak による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
20/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
data

調査の方向性

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:

  1. Set bad channels without positions to NaN, as the warning says.
  2. Never pick good channels without positions.
  3. Raise ValueError when a bad channel with a position has no good neighbor left.
主要言語
Python
スター
3.5k
フォーク
1.6k
平均マージ
1日 3時間
マージ済み PR(30日)
74

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mne-tools/mne-python のほかの issue

mne-tools/mne-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。