Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#14,415 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@kalomak ya está trabajando en esto.

Desde el 14/10/2026.

  • #14416 de @kalomak — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
20/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
data

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
Python
Estrellas
3.5k
Forks
1.6k
Merge medio
1 d 3 h
PR fusionados (30 d)
73

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de mne-tools/mne-python

Todos los issues de mne-tools/mne-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.