`Raw.resample` doesn't handle NaNs
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Start by running the reproduction script in the issue, which builds a RawArray with trailing NaNs and calls raw.resample(500). Find where Raw.resample is implemented in mne-python and check how it treats NaN samples. Done means NaN-containing channels keep NaNs only at the corresponding time points instead of turning the whole channel into NaN. The approach (interpolate, resample, restore NaNs) is the author's suggestion and still needs a maintainer decision.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description of the problem
Raw.resample turns the entire channel into NaN if even one sample is NaN. This can occur in real-world data, for example, in eye-tracking recordings (blinks, see #11879) or XDF recordings where streams end at different times.
Steps to reproduce
import mne
import numpy as np
sfreq = 1000
data = np.sin(2 * np.pi * 10 * np.arange(10000) / sfreq)[np.newaxis]
data[0, -10:] = np.nan
raw = mne.io.RawArray(data, mne.create_info(1, sfreq, "eeg"))
raw.resample(500)
print(np.isnan(raw.get_data()).mean()) # 1.0
Link to data
No response
Expected results
I think Raw.resample should handle NaN, for example by temporarily filling NaNs with linear interpolation, resampling, and then restoring NaNs at the corresponding locations. Unlike #11408, this approach relies on the data rather than annotations.
I'm happy to open a PR.
Actual results
The entire channel consists of NaN after resampling.
Additional information
Platform Linux-7.2.9-arch1-1-x86_64-with-glibc2.44 (Wayland)
Python 3.12.14 (main, Aug 25 2026, 14:00:49) [Clang 22.1.3 ]
Executable /home/clemens/Projects/mnelab/.venv/bin/python
CPU AMD Ryzen 7 9700X 8-Core Processor (16 cores)
Memory 60.5 GiB
Core
├☑ mne 1.13.2 (latest release)
├☑ numpy 2.5.3 (OpenBLAS 0.3.34.106.0 with 16 threads via pthreads)
├☑ scipy 1.18.1
└☑ matplotlib 3.11.2 (backend=qtagg)
Numerical (optional)
├☑ scikit-learn 1.9.0
├☑ threadpoolctl 3.6.0
├☑ h5io 0.2.5
├☑ h5py 3.16.0
└☐ unavailable numba, nibabel, nilearn, dipy, openmeeg, python-picard, jamica, cupy, pandas
Visualization (optional)
├☑ qtpy 2.4.3 (PySide6=6.11.2)
├☑ pyqtgraph 0.14.0
├☑ mne-qt-browser 0.7.5
└☐ unavailable pyvista, pyvistaqt, vtk, ipympl, ipywidgets, trame, trame_client, trame_server, trame_pyvista, trame_vtk, trame_vuetify
Ecosystem (optional)
├☑ autoreject 0.4.4
├☑ edfio 0.4.17
├☑ pybv 0.8.1
└☐ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, curryreader, mffpy, pymef, antio, defusedxml
- Ngôn ngữ chính
- Python
- Star
- 3.5k
- Fork
- 1.6k
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 74
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của mne-tools/mne-python
-
ENH: Add `description` filter parameter to `Raw.crop_by_annotations()`Có thể đã có người làm @aman-coder03 đã nhận 192 ngày trước. Đang mởENH
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mne-tools/mne-python#13743 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
BUG
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
mne-tools/mne-python#14420 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
BUG: fNIRS `interpolate_bads` copies wrong channel when positions are missingCó thể đã có người làm @kalomak đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 20/100
mne-tools/mne-python#14415 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add a check for `sklearn` availability to `decoding` moduleCó thể đã có người làm @SohamXYZDev đã nhận 3 ngày trước. Đang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 35/100
mne-tools/mne-python#14394 · 13 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ENH: Fast adaptive line-noise removal via sinusoid regression (~50× speedup over spectrum_fit)Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 8/100
mne-tools/mne-python#14392 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của mne-tools/mne-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PolicyEngine/policyengine-us#10262 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
kellyjonbrazil/jc#788 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`/search.json` ignores the documented `editions.sort` parameterCó thể đã có người làm @PranavD2905 đã nhận hôm nay. Đang mởAffects: Server Good First Issue Module: Solr Needs: Triage Theme: Public APIs Theme: Search
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
internetarchive/openlibrary#13989 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug P2: misleading query
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
jeffknupp/association#478 ·