This is an automated email from the git hooks/post-receive script. yoh pushed a commit to annotated tag v0.1 in repository python-mne.
commit 5f24f9c33fca4e15865f7ed611bdff6a2e3b408d Author: Alexandre Gramfort <[email protected]> Date: Tue Jan 25 15:02:16 2011 -0500 better Covariance class --- examples/plot_read_noise_covariance_matrix.py | 1 + mne/cov.py | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/examples/plot_read_noise_covariance_matrix.py b/examples/plot_read_noise_covariance_matrix.py index e5e1ce6..3547017 100644 --- a/examples/plot_read_noise_covariance_matrix.py +++ b/examples/plot_read_noise_covariance_matrix.py @@ -24,4 +24,5 @@ print cov # Show covariance import pylab as pl pl.matshow(cov.data) +pl.title('Noise covariance matrix (%d channels)' % cov.data.shape[0]) pl.show() diff --git a/mne/cov.py b/mne/cov.py index d230503..f08c808 100644 --- a/mne/cov.py +++ b/mne/cov.py @@ -21,21 +21,24 @@ from .fiff import fiff_open class Covariance(object): """Noise covariance matrix""" - _kinds = dict(full=1, sparse=2, diagonal=3) # XXX : check + _kind_to_id = dict(full=1, sparse=2, diagonal=3) # XXX : check + _id_to_kind = {1: 'full', 2: 'sparse', 3: 'diagonal'} # XXX : check def __init__(self, kind): - if kind in Covariance._kinds: - self.kind = Covariance._kinds[kind] - else: - raise ValueError, ('Unknown type of covariance. ' - 'Choose between full, sparse or diagonal.') + self.kind = kind def load(self, fname): """load covariance matrix from FIF file""" + if self.kind in Covariance._kind_to_id: + cov_kind = Covariance._kind_to_id[self.kind] + else: + raise ValueError, ('Unknown type of covariance. ' + 'Choose between full, sparse or diagonal.') + # Reading fid, tree, _ = fiff_open(fname) - cov = read_cov(fid, tree, self.kind) + cov = read_cov(fid, tree, cov_kind) fid.close() self._cov = cov @@ -48,6 +51,7 @@ class Covariance(object): def __repr__(self): s = "kind : %s" % self.kind s += ", size : %s x %s" % self.data.shape + s += ", data : %s" % self.data return "Covariance (%s)" % s -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-mne.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
