Incorrect scaling of complex multitaper coefficients with `normalization="full"`
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
- #14497 của @iis-MarkKuang — đã merge
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 74/100
Hướng nghiên cứu
Bắt đầu từ mne.time_frequency.psd_array_multitaper() và theo dõi cách chuẩn hóa được áp dụng cho output="complex"; so sánh hệ số tỷ lệ đó với đầu ra công suất và _psd_from_mt(). Dùng ví dụ tái hiện trong issue để kiểm tra rằng cả hai đường xử lý đều tạo ra các PSD khớp nhau với normalization="full" và "length"; hoàn thành khi cả hai tỷ số đều bằng 1.
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
normalization="full" in psd_array_multitaper() scales the data by 1/sfreq. This is fine for output="power", but for output="complex", the scaling should be 1/sqrt(sfreq).
Because of this, power subsequently computed from the coefficients (including in Spectrum.plot()) is of a much smaller scale than if output="power" was used.
Steps to reproduce
import numpy as np
from mne.time_frequency import psd_array_multitaper
from mne.time_frequency.multitaper import _psd_from_mt
sfreq = 100.0
x = np.random.default_rng(0).standard_normal((1, 1000))
for normalization in ("length", "full"):
psd, _ = psd_array_multitaper(
x, sfreq, normalization=normalization, output="power", verbose=False
)
coefs, _, weights = psd_array_multitaper(
x, sfreq, normalization=normalization, output="complex", verbose=False
)
psd_from_coefs = _psd_from_mt(coefs, weights)
print(f"{normalization}: ratio = {np.unique((psd_from_coefs / psd).round(6))}")
Link to data
No response
Expected results
The PSD constructed directly and subsequently computed from the complex coefficients are identical.
Actual results
With normalization="full", the PSD subsequently computed from the complex coefficients are scaled by 1/sfreq relative to the PSD constructed directly.
length: ratio = [1.]
full: ratio = [0.01]
Additional information
AI disclosure: was initially picked up by Claude Opus 5.5, and further investigated by myself.
- Ngôn ngữ chính
- Python
- Star
- 3.6k
- Fork
- 1.6k
- Merge trung bình
- 1 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 71
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
-
`mne.stats.f_oneway` returns wrong (even negative) F for small integer dtypesCó thể đã có người làm @darshpatel1052 đã nhận 4 ngày trước. Đang mởBUG
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
mne-tools/mne-python#14477 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ENH: Add `description` filter parameter to `Raw.crop_by_annotations()`Có thể đã có người làm @aman-coder03 đã nhận 214 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
-
Nihon Kohden V2.0 supportĐang mởBUG
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
mne-tools/mne-python#14502 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
cannot plot into matplotlib subfigureCó thể đã có người làm @ishaaaan17 đã nhận 4 ngày trước. Đang mởBUG
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
mne-tools/mne-python#14481 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
BUG: One layer BEM construction fails for current ANTS6-0Months3T templateCó thể đã có người làm @sruthisureshkumar-arch đã nhận 6 ngày trước. Đang mởBUG
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
mne-tools/mne-python#14468 · 8 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 74/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
RunestoneInteractive/rs#1661 ·
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 64/100
streamlink/streamlink#7192 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 75/100
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 82/100
aws-samples/sample-per-model-bedrock#795 ·
Maintainer thường phản hồi trong vòng 1 ngày