[med-svn] [python-mne] 90/353: FIX : fix stupid mistake in averaging cov
Yaroslav Halchenko
debian at onerussian.com
Fri Nov 27 17:24:36 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 cc76c0886d343b0528dd6631fc8712a4dded5953
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date: Tue Feb 28 15:08:26 2012 +0100
FIX : fix stupid mistake in averaging cov
---
mne/cov.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/mne/cov.py b/mne/cov.py
index 086f50e..f7acbae 100644
--- a/mne/cov.py
+++ b/mne/cov.py
@@ -97,7 +97,9 @@ class Covariance(object):
"""Add Covariance taking into account number of degrees of freedom"""
_check_covs_algebra(self, cov)
this_cov = copy.deepcopy(cov)
- this_cov.data[:] += self.data
+ this_cov.data[:] = ((this_cov.data * this_cov.nfree) + \
+ (self.data * self.nfree)) / \
+ (self.nfree + this_cov.nfree)
this_cov._cov['nfree'] += self._cov['nfree']
this_cov.nfree = this_cov._cov['nfree']
return this_cov
@@ -105,7 +107,9 @@ class Covariance(object):
def __iadd__(self, cov):
"""Add Covariance taking into account number of degrees of freedom"""
_check_covs_algebra(self, cov)
- self.data[:] += cov.data
+ self.data[:] = ((self.data * self.nfree) + \
+ (cov.data * cov.nfree)) / \
+ (self.nfree + cov.nfree)
self._cov['nfree'] += cov._cov['nfree']
self.nfree = cov._cov['nfree']
return self
--
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