-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
WIP: Add temporal derivative distribution repair algorithm #7556
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7556 +/- ##
==========================================
- Coverage 90.13% 90.12% -0.02%
==========================================
Files 450 452 +2
Lines 82728 82800 +72
Branches 13076 13083 +7
==========================================
+ Hits 74565 74621 +56
- Misses 5342 5351 +9
- Partials 2821 2828 +7 |
|
Thanks for the early feedback @agramfort. |
mne/preprocessing/nirs/temporal_derivative_distribution_repair.py
Outdated
Show resolved
Hide resolved
6fb24ee to
04337a1
Compare
|
@larsoner could you please review again. I think I made all your suggested changes and the CI segmentation error looks unrelated. |
larsoner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few more minor comments
Example looks good. Would it be worth adding to tutorials/plot_70_fnirs_processing.py in addition to the example? If we're thinking of that as the gold standard for people to follow it seems like it, even if you just add a cross-link to the other example and the :func:.
| if not len(pick_types(raw.info, fnirs='fnirs_od')): | ||
| raise RuntimeError('TDDR should be run on optical density data.') | ||
|
|
||
| raw._data = _TDDR(raw._data.T, raw.info['sfreq']).T |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will operate on all of the data even if there are non-fNIRS channels. So probably needs picks incorporated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Good catch.
| if len(signal.shape) != 1: | ||
| for ch in range(signal.shape[1]): | ||
| signal[:, ch] = _TDDR(signal[:, ch], sample_rate) | ||
| return signal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is how it operates, it would be simpler not to make this modification, and do the looping over picks directly in temporal_derivative_distribution_repair. It will hopefully keep this function just a copy-paste drop-in (?) and also takes care of the picks problem at the same time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still required the name change to keep flake happy unfortunately.
|
... also needs a rebase |
mne/preprocessing/nirs/_temporal_derivative_distribution_repair.py
Outdated
Show resolved
Hide resolved
|
@frankfishburn this code is ready to be merged in to MNE. You mentioned you probably wouldn't have time to take a look, so this is just an FYI. |
agramfort
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Thanks @agramfort |
|
Thanks @rob-luke |
* upstream/master: (1522 commits) FIX: Show bug MRG, FIX: Datetime call in gdf 2.x age calculation (mne-tools#7581) DOC: Simplify Darwin installation (mne-tools#7584) MRG, ENH: Allow picking without preload (mne-tools#7507) DOC: Document anonymization better (mne-tools#7587) Rework _Brain show (mne-tools#7580) DOC: Fixes in tutorial (mne-tools#7579) ENH: muscle artifact detection (mne-tools#7407) MRG: Remove toolbars in PyVista plotter (mne-tools#7572) WIP: Deregister plotter from the figure list in close() (mne-tools#7573) MRG: Fix mouse wheel event in _TimeViewer (mne-tools#7563) FIX: Fix toggle all (mne-tools#7567) MRG, FIX: parallel n_jobs check (mne-tools#7566) Rename artifact detection to movement detection (mne-tools#7569) ENH: Update spelling check [ci skip] (mne-tools#7565) MRG, ENH: Dont require preload for raw resample (mne-tools#7508) MRG: Add interpolation for NIRS signals (mne-tools#7428) WIP: Add temporal derivative distribution repair algorithm (mne-tools#7556) DOC: fix link in docstr [skip ci] (mne-tools#7562) ENH: Custom figure title when plotting Dipole locations (mne-tools#7558) ...
* upstream/master: (1522 commits) FIX: Show bug MRG, FIX: Datetime call in gdf 2.x age calculation (mne-tools#7581) DOC: Simplify Darwin installation (mne-tools#7584) MRG, ENH: Allow picking without preload (mne-tools#7507) DOC: Document anonymization better (mne-tools#7587) Rework _Brain show (mne-tools#7580) DOC: Fixes in tutorial (mne-tools#7579) ENH: muscle artifact detection (mne-tools#7407) MRG: Remove toolbars in PyVista plotter (mne-tools#7572) WIP: Deregister plotter from the figure list in close() (mne-tools#7573) MRG: Fix mouse wheel event in _TimeViewer (mne-tools#7563) FIX: Fix toggle all (mne-tools#7567) MRG, FIX: parallel n_jobs check (mne-tools#7566) Rename artifact detection to movement detection (mne-tools#7569) ENH: Update spelling check [ci skip] (mne-tools#7565) MRG, ENH: Dont require preload for raw resample (mne-tools#7508) MRG: Add interpolation for NIRS signals (mne-tools#7428) WIP: Add temporal derivative distribution repair algorithm (mne-tools#7556) DOC: fix link in docstr [skip ci] (mne-tools#7562) ENH: Custom figure title when plotting Dipole locations (mne-tools#7558) ...
Reference issue
As discussed in #7057
What does this implement/fix?
Adds temporal derivative distribution repair (TDDR) technique.
Adds new example showing how to apply nirs artefact correction (with plan to expand as new methods are implemented).
Additional information
I have taken the code directly from the author with permission.
I have kept the code as close to the original from the author as possible, and then used a wrapper function. I did this as the code was very nice. Also if the upstream version changes it is then easier to move the changes here.