mne-tools / mne-nirs

Process Near-Infrared Spectroscopy Data in MNE
https://mne.tools/mne-nirs/
BSD 3-Clause "New" or "Revised" License
85 stars 35 forks source link

Discrepancy between MNE-NIRS and QT-NIRS for SCI peak power #503

Open alkvi opened 1 year ago

alkvi commented 1 year ago

Issue

Hello,

I wanted to use MNE-NIRS to calculate peak spectral power as in the PHOEBE paper, or the QT-NIRS / NIRSplot paper by Hernandez and Pollonini.

However I noticed I was getting some different values in QT-NIRS (https://github.com/lpollonini/qt-nirs) and mne_nirs.preprocessing.peak_power (https://mne.tools/mne-nirs/stable/generated/mne_nirs.preprocessing.peak_power.html).

Basically, the QT-NIRS values were lower than the MNE-NIRS values (for the same cut-offs and window).

I assume one or the other is more correct!

Steps to reproduce

Comparing the used periodogram functions https://github.com/lpollonini/qt-nirs/blob/master/qtnirs.m#L1029 and https://github.com/mne-tools/mne-nirs/blob/main/mne_nirs/preprocessing/_peak_power.py#L104 it looks like the default in scipy.signal is to use PSD scaling, while the MATLAB implementation of qt-nirs is specifying "power" scaling.

I ran a comparison on an open dataset (the FRESH audio dataset) and took some averages for each subject. See attached folder for processing steps. mne_nirs_sci_power.zip

Result diff

Averages for QT-NIRS implementation

0.226887891598819
0.153682639050584
0.220944569551051
0.311272956767088
0.273401685459613
0.232952474099784
0.190741282065384
0.142666648555279
0.13782339406341
0.327983547633153
0.329524300901279
0.28205343407653
0.190604660582288
0.155480218804427
0.317809807027852
0.269750679052029
0.31070217675301

Averages for MNE-NIRS implementation

1.5931549820246793
0.9589639974878584
1.4504081012101064
2.0537778532070807
1.9185792437291618
1.5456842639060036
1.383875827631576
0.7911793927586688
1.2391833144473723
2.4082828268910137
2.123637004744824
2.092006310707082
1.189042103492612
1.0577454694448551
2.0752410677551687
1.694990995500319
2.008712062188033

The QT-NIRS values look closer to ranges discussed in the PHOEBE paper. Not sure if I'm getting some processing step wrong, or this is expected, but the scaling looks different at least.

Additional information

>>> mne.sys_info()
Platform:         Windows-10-10.0.19045-SP0
Python:           3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)]
Executable:       C:\Program Files (x86)\Python\python.exe
CPU:              Intel64 Family 6 Model 140 Stepping 1, GenuineIntel: 8 cores
Memory:           15.7 GB

mne:              1.3.0
numpy:            1.21.2 {OpenBLAS 0.3.17 with 8 threads}
scipy:            1.9.1
matplotlib:       3.4.3 {backend=Qt5Agg}

sklearn:          1.0.2
numba:            Not found
nibabel:          4.0.1
nilearn:          0.9.1
dipy:             Not found
openmeeg:         Not found
cupy:             Not found
pandas:           2.0.0
pyvista:          Not found
pyvistaqt:        Not found
ipyvtklink:       Not found
vtk:              Not found
qtpy:             2.2.0 {PyQt5=5.15.2}
ipympl:           Not found
pyqtgraph:        Not found
pooch:            v1.6.0

mne_bids:         0.11.1
mne_nirs:         0.6.dev0
mne_features:     Not found
mne_qt_browser:   Not found
mne_connectivity: Not found
mne_icalabel:     Not found
alkvi commented 1 year ago

MATLAB periodogram: https://se.mathworks.com/help/signal/ref/periodogram.html#btt0jw2-spectrumtype scipy periodogram: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.periodogram.html