BUG: fNIRS `interpolate_bads` copies wrong channel when positions are missing
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 20/100
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:
- 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.
- Lenguaje dominante
- Python
- Estrellas
- 3.5k
- Forks
- 1.6k
- Merge medio
- 1 d 3 h
- PR fusionados (30 d)
- 73
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de mne-tools/mne-python
-
ENH: Add `description` filter parameter to `Raw.crop_by_annotations()`Posiblemente ocupada @aman-coder03 la tomó hace 193 días. AbiertoENH
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
mne-tools/mne-python#13743 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
ENH
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
mne-tools/mne-python#14427 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 56/100
mne-tools/mne-python#14426 ·
Los mantenedores suelen responder en 1 día
-
BUG
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
mne-tools/mne-python#14421 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
BUG
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
mne-tools/mne-python#14420 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de mne-tools/mne-python
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ok-oldking/ok-wuthering-waves#1785 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
healthchecks/healthchecks#1349 ·
-
deployment release-lag
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
nolte/kamerplanter#2374 ·
Los mantenedores suelen responder en 1 día
-
bug v1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
modelcontextprotocol/python-sdk#3725 ·
Los mantenedores suelen responder en 1 día
-
batchterms() drops queries without a similar() clause, misaligning results with inputsPosiblemente ocupada @MohammadHijjawi97 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día