Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve testing for resampling in the autocorrelation feature #26

Merged
merged 2 commits into from
Apr 29, 2022

Conversation

mscheltienne
Copy link
Member

It looks like I got it right in #21.
WDYT?

@codecov
Copy link

codecov bot commented Apr 29, 2022

Codecov Report

❗ No coverage uploaded for pull request base (main@24e190f). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #26   +/-   ##
=======================================
  Coverage        ?   97.30%           
=======================================
  Files           ?        7           
  Lines           ?      408           
  Branches        ?        0           
=======================================
  Hits            ?      397           
  Misses          ?       11           
  Partials        ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24e190f...9a81494. Read the comment docs.

@adam2392
Copy link
Member

Wouldn't this only handle sampling rates of 100 Hz? What if it was 200?

Maybe we should try handling all common sampling rates of EEG hardware? So I'm guessing like 50, 100, 128, 200, 256?

Idk, can get complicated though :/

@mscheltienne
Copy link
Member Author

Well, that's what EEGLAB does. The autocorrelation functions ends with:

% resample to 1 second at 100 samples/sec
resamp = resample(ac', 100, EEG.srate)';

Which corresponds to resample_poly with up hard coded to 100, and down set to sfreq.

All it's doing in #21 and in this PR is supporting floating point sfreq by setting the down argument either to int(sfreq) or to int(sfreq) + 1, in order to get the correct output shape (n_comp, 101).
In EEGLAB, since the sfreq is always an integer, this step is not needed because if down=EEG.srate (int), then the output shape is always (n_comp, 101).

@adam2392
Copy link
Member

Well, that's what EEGLAB does. The autocorrelation functions ends with:

% resample to 1 second at 100 samples/sec
resamp = resample(ac', 100, EEG.srate)';

Which corresponds to resample_poly with up hard coded to 100, and down set to sfreq.

All it's doing in #21 and in this PR is supporting floating point sfreq by setting the down argument either to int(sfreq) or to int(sfreq) + 1, in order to get the correct output shape (n_comp, 101). In EEGLAB, since the sfreq is always an integer, this step is not needed because if down=EEG.srate (int), then the output shape is always (n_comp, 101).

Fair I guess that's what ICLabel does so at least for this version! Unfortunate, I wonder how sensitive ICLabel is to the sampling rate... Room for improvement :)

@adam2392 adam2392 merged commit 25229d9 into mne-tools:main Apr 29, 2022
@mscheltienne mscheltienne deleted the resampling branch April 29, 2022 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants