[med-svn] [python-mne] 144/353: ENH: warning for large currents

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:24:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

yoh pushed a commit to tag 0.4
in repository python-mne.

commit 4158f6900aa2e82e4d05c005010d25b165a4cead
Author: Martin Luessi <mluessi at nmr.mgh.harvard.edu>
Date:   Fri Apr 13 10:19:32 2012 -0400

    ENH: warning for large currents
---
 mne/forward.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mne/forward.py b/mne/forward.py
index 88b8f62..025c3f6 100644
--- a/mne/forward.py
+++ b/mne/forward.py
@@ -501,6 +501,13 @@ def _apply_forward(fwd, stc, start=None, stop=None):
                       'values. Use pick_normal=True when computing the '
                       'inverse to compute currents not current magnitudes.')
 
+    max_cur = np.max(np.abs(stc.data))
+    if max_cur > 1e-7:  # 100 nAm threshold for warning
+        warnings.warn('The maximum current magnitude is %0.1f nAm, which is '
+                      'very large. Are you trying to apply the forward model '
+                      'to dSPM values? The result will only be correct if '
+                      'currents are used.' % 1e9 * max_cur)
+
     src_sel = _stc_src_sel(fwd['src'], stc)
 
     gain = fwd['sol']['data'][:, src_sel]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-mne.git



More information about the debian-med-commit mailing list