[med-svn] [python-mne] 32/376: splitting fif and MNE

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:22:01 UTC 2015


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 2da38029badc5162db3163cf45fe9ad9b19c33b5
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Fri Jan 14 17:04:27 2011 -0500

    splitting fif and MNE
---
 AUTHORS.rst                              |  3 ++-
 MANIFEST.in                              |  4 ++--
 README.rst                               |  7 +++----
 examples/compute_mne_inverse.py          |  2 +-
 examples/read_bem_surfaces.py            |  2 +-
 examples/read_cov.py                     |  7 ++++---
 examples/read_epochs.py                  |  9 +++++----
 examples/read_events.py                  | 21 ++++++++-------------
 examples/read_evoked.py                  |  2 +-
 examples/read_forward.py                 |  4 ++--
 examples/read_inverse.py                 |  4 ++--
 examples/read_raw.py                     |  4 ++--
 examples/read_stc.py                     |  4 ++--
 examples/read_write_raw.py               | 20 ++++++++++----------
 {fiff => mne}/__init__.py                |  9 +--------
 {fiff => mne}/bem_surfaces.py            | 14 +++++++++-----
 {fiff => mne}/cov.py                     | 23 +++++++++++++----------
 {fiff => mne}/epochs.py                  |  6 ++++--
 {fiff => mne}/event.py                   | 11 ++++++-----
 {fiff => mne/fiff}/__init__.py           |  7 -------
 {fiff => mne/fiff}/bunch.py              |  0
 {fiff => mne/fiff}/channels.py           |  4 ++++
 {fiff => mne/fiff}/constants.py          |  5 +++++
 {fiff => mne/fiff}/ctf.py                |  4 ++++
 {fiff => mne/fiff}/diff.py               |  4 ++++
 {fiff => mne/fiff}/evoked.py             |  4 ++++
 {fiff => mne/fiff}/matrix.py             |  5 +++++
 {fiff => mne/fiff}/meas_info.py          |  4 ++++
 {fiff => mne/fiff}/open.py               |  5 +++++
 {fiff => mne/fiff}/pick.py               |  5 +++++
 {fiff => mne/fiff}/proj.py               |  5 +++++
 {fiff => mne/fiff}/raw.py                |  5 +++++
 {fiff => mne/fiff}/tag.py                |  4 ++++
 mne/fiff/tests/__init__.py               |  0
 {fiff => mne/fiff}/tests/test_evoked.py  |  9 ++++-----
 {fiff => mne/fiff}/tests/test_raw.py     | 20 +++++++++++---------
 {fiff => mne/fiff}/tree.py               |  4 ++++
 {fiff => mne/fiff}/write.py              |  4 ++++
 {fiff => mne}/forward.py                 | 17 +++++++++++------
 {fiff => mne}/inverse.py                 | 28 +++++++++++++++++-----------
 {fiff => mne}/source_space.py            | 12 ++++++++----
 {fiff => mne}/stc.py                     |  4 ++++
 mne/tests/__init__.py                    |  0
 {fiff => mne}/tests/test_bem_surfaces.py |  6 +++---
 {fiff => mne}/tests/test_cov.py          | 14 +++++++-------
 {fiff => mne}/tests/test_event.py        | 11 +++++------
 {fiff => mne}/tests/test_forward.py      |  7 +++----
 {fiff => mne}/tests/test_inverse.py      |  5 ++---
 {fiff => mne}/tests/test_stc.py          |  9 ++++-----
 setup.cfg                                |  2 +-
 setup.py                                 | 15 +++++++--------
 51 files changed, 227 insertions(+), 157 deletions(-)

diff --git a/AUTHORS.rst b/AUTHORS.rst
index b4742d5..1a7b32f 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -3,4 +3,5 @@
 Authors
 =======
 
-  * Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu> 2010
+  * Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu> 2011
+  * Matti Hamalainen <msh at nmr.mgh.harvard.edu> 2011
diff --git a/MANIFEST.in b/MANIFEST.in
index 4d6d738..228d8e2 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,5 @@
 include *.rst
-include fiff/__init__.py
+include mne/__init__.py
 recursive-include doc *
 recursive-include examples *
-recursive-include fiff *.py
+recursive-include mne *.py
diff --git a/README.rst b/README.rst
index d57af32..40506e1 100644
--- a/README.rst
+++ b/README.rst
@@ -3,8 +3,7 @@
 About
 =====
 
-pyfiff is a python module for reading and writing the fif files
-produced by Neuromag MEG systems.
+MNE is a python module for processing MEG and EEG data;
 
 It is mainly a reimplementation of the Matlab code written by Matti Hämäläinen.
 
@@ -46,11 +45,11 @@ GIT
 
 You can check the latest sources with the command::
 
-    git clone git://github.com/agramfort/pyfiff.git
+    git clone git://github.com/mne/mne.git
 
 or if you have write privileges::
 
-    git clone git at github.com/agramfort/pyfiff.git
+    git clone git at github.com/mne/mne.git
 
 Bugs
 ----
diff --git a/examples/compute_mne_inverse.py b/examples/compute_mne_inverse.py
index 9673d69..1690acd 100644
--- a/examples/compute_mne_inverse.py
+++ b/examples/compute_mne_inverse.py
@@ -2,7 +2,7 @@
 """
 print __doc__
 
-import fiff
+from mne import fiff
 
 fname_inv = 'MNE-sample-data/MEG/sample/sample_audvis-ave-7-meg-inv.fif'
 fname_data = 'MNE-sample-data/MEG/sample/sample_audvis-ave.fif'
diff --git a/examples/read_bem_surfaces.py b/examples/read_bem_surfaces.py
index d6567b0..ae39890 100644
--- a/examples/read_bem_surfaces.py
+++ b/examples/read_bem_surfaces.py
@@ -2,7 +2,7 @@
 """
 print __doc__
 
-import fiff
+from mne import fiff
 
 fname = 'MNE-sample-data/subjects/sample/bem/sample-5120-bem-sol.fif'
 
diff --git a/examples/read_cov.py b/examples/read_cov.py
index 0ffead2..142867a 100644
--- a/examples/read_cov.py
+++ b/examples/read_cov.py
@@ -2,18 +2,19 @@
 """
 print __doc__
 
-import fiff
+import mne
+from mne import fiff
 
 fname = 'MNE-sample-data/MEG/sample/sample_audvis-cov.fif'
 
 # Reading
 fid, tree, _ = fiff.fiff_open(fname)
 cov_type = 1
-cov = fiff.read_cov(fid, tree, cov_type)
+cov = mne.read_cov(fid, tree, cov_type)
 fid.close()
 
 # Writing
-fiff.write_cov_file('cov.fif', cov)
+mne.write_cov_file('cov.fif', cov)
 
 print "covariance matrix size: %s x %s" % cov['data'].shape
 
diff --git a/examples/read_epochs.py b/examples/read_epochs.py
index 311eaa9..4e47659 100644
--- a/examples/read_epochs.py
+++ b/examples/read_epochs.py
@@ -5,7 +5,8 @@ print __doc__
 # Authors : Alexandre Gramfort, gramfort at nmr.mgh.harvard.edu
 #           Matti Hamalainen, msh at nmr.mgh.harvard.edu
 
-import fiff
+import mne
+from mne import fiff
 
 ###############################################################################
 # Set parameters
@@ -18,7 +19,7 @@ pick_all = True
 
 #   Setup for reading the raw data
 raw = fiff.setup_read_raw(raw_fname)
-events = fiff.read_events(event_name)
+events = mne.read_events(event_name)
 
 if pick_all:
    # Pick all
@@ -29,10 +30,10 @@ else:
    want_meg = True
    want_eeg = False
    want_stim = False
-   picks = fiff.fiff_pick_types(raw['info'], want_meg, want_eeg, want_stim,
+   picks = fiff.pick_types(raw['info'], want_meg, want_eeg, want_stim,
                                 include, raw['info']['bads'])
 
-data, times, channel_names = fiff.read_epochs(raw, events, event_id,
+data, times, channel_names = mne.read_epochs(raw, events, event_id,
                                                     tmin, tmax, picks=picks)
 
 # for epoch in data:
diff --git a/examples/read_events.py b/examples/read_events.py
index 14157be..0064295 100644
--- a/examples/read_events.py
+++ b/examples/read_events.py
@@ -2,21 +2,16 @@
 """
 print __doc__
 
-import fiff
+import mne
 
 fname = 'MNE-sample-data/MEG/sample/sample_audvis_raw-eve.fif'
 
-event_list = fiff.read_events(fname)
-fiff.write_events('events.fif', event_list)
-event_list2 = fiff.read_events(fname)
+# Reading events
+events = mne.read_events(fname)
 
-from scipy import linalg
-print linalg.norm(event_list - event_list2)
+# Writing events
+mne.write_events('events.fif', events)
 
-# ###############################################################################
-# # Show MEG data
-# import pylab as pl
-# pl.plot(times, data.T)
-# pl.xlabel('time (ms)')
-# pl.ylabel('MEG data (T)')
-# pl.show()
+for ind, before, after in events[:5]:
+    print "At sample %d stim channel went from %d to %d" % (
+                                                    ind, before, after)
diff --git a/examples/read_evoked.py b/examples/read_evoked.py
index 1aae8f2..0b5ad10 100644
--- a/examples/read_evoked.py
+++ b/examples/read_evoked.py
@@ -2,7 +2,7 @@
 """
 print __doc__
 
-import fiff
+from mne import fiff
 
 fname = 'MNE-sample-data/MEG/sample/sample_audvis-ave.fif'
 
diff --git a/examples/read_forward.py b/examples/read_forward.py
index 5312a93..725b3b3 100644
--- a/examples/read_forward.py
+++ b/examples/read_forward.py
@@ -2,12 +2,12 @@
 """
 print __doc__
 
-import fiff
+import mne
 
 # fname = 'MNE-sample-data/MEG/sample/sample_audvis-ave-7-fwd.fif'
 fname = 'sm01a5-ave-oct-6-fwd.fif'
 
-data = fiff.read_forward_solution(fname)
+data = mne.read_forward_solution(fname)
 leadfield = data['sol']['data']
 
 print "Leadfield size : %d x %d" % leadfield.shape
diff --git a/examples/read_inverse.py b/examples/read_inverse.py
index 940a786..7d6b359 100644
--- a/examples/read_inverse.py
+++ b/examples/read_inverse.py
@@ -2,11 +2,11 @@
 """
 print __doc__
 
-import fiff
+import mne
 
 fname = 'MNE-sample-data/MEG/sample/sample_audvis-ave-7-meg-inv.fif'
 
-inv = fiff.read_inverse_operator(fname)
+inv = mne.read_inverse_operator(fname)
 
 print "Method: %s" % inv['methods']
 print "fMRI prior: %s" % inv['fmri_prior']
diff --git a/examples/read_raw.py b/examples/read_raw.py
index 82314dc..ca650ad 100644
--- a/examples/read_raw.py
+++ b/examples/read_raw.py
@@ -2,8 +2,7 @@
 """
 print __doc__
 
-import pylab as pl
-import fiff
+from mne import fiff
 
 fname = 'MNE-sample-data/MEG/sample/sample_audvis_raw.fif'
 
@@ -19,6 +18,7 @@ raw.close()
 
 ###############################################################################
 # Show MEG data
+import pylab as pl
 pl.close('all')
 pl.plot(times, data.T)
 pl.xlabel('time (s)')
diff --git a/examples/read_stc.py b/examples/read_stc.py
index e3fd2ed..d3032fd 100644
--- a/examples/read_stc.py
+++ b/examples/read_stc.py
@@ -5,11 +5,11 @@ reconstructions
 """
 print __doc__
 
-import fiff
+import mne
 
 fname = 'MNE-sample-data/MEG/sample/sample_audvis-ave-7-meg-lh.stc'
 
-stc = fiff.read_stc(fname)
+stc = mne.read_stc(fname)
 
 n_vertices, n_samples = stc['data'].shape
 print "tmin : %s (s)" % stc['tmin']
diff --git a/examples/read_write_raw.py b/examples/read_write_raw.py
index 7e5df88..3a38cb2 100644
--- a/examples/read_write_raw.py
+++ b/examples/read_write_raw.py
@@ -5,8 +5,7 @@ Read and write raw data in 60-sec blocks
 print __doc__
 
 from math import ceil
-import fiff
-
+from mne import fiff
 
 infile = 'MNE-sample-data/MEG/sample/sample_audvis_raw.fif'
 outfile = 'sample_audvis_small_raw.fif'
@@ -31,30 +30,31 @@ outfid, cals = fiff.start_writing_raw(outfile, raw['info'], picks)
 #
 #   Set up the reading parameters
 #
-from_ = raw['first_samp']
-to = raw['last_samp']
+start = raw['first_samp']
+stop = raw['last_samp'] + 1
 quantum_sec = 10
 quantum = int(ceil(quantum_sec * raw['info']['sfreq']))
 #
 #   To read the whole file at once set
 #
-# quantum     = to - from_ + 1;
+# quantum     = stop - start
 #
 #
 #   Read and write all the data
 #
 first_buffer = True
-for first in range(from_, to, quantum):
-    last = first + quantum
-    if last > to:
-        last = to
+for first in range(start, stop, quantum):
+    last = start + quantum
+    if last >= stop:
+        last = stop
     try:
-        data, times = fiff.read_raw_segment(raw, first, last, picks)
+        data, times = raw[picks, first:last]
     except Exception as inst:
         raw['fid'].close()
         outfid.close()
         print inst
 
+    print 'Writing ... ',
     fiff.write_raw_buffer(outfid, data, cals)
     print '[done]'
 
diff --git a/fiff/__init__.py b/mne/__init__.py
similarity index 51%
copy from fiff/__init__.py
copy to mne/__init__.py
index 25ddfe2..331369d 100644
--- a/fiff/__init__.py
+++ b/mne/__init__.py
@@ -1,17 +1,10 @@
 __version__ = '0.1.git'
 
-from .constants import FIFF
-from .open import fiff_open
-from .evoked import read_evoked, write_evoked
 from .cov import read_cov, write_cov, write_cov_file
-from .raw import setup_read_raw, read_raw_segment, read_raw_segment_times, \
-                 start_writing_raw, write_raw_buffer, finish_writing_raw
 from .event import read_events, write_events
 from .forward import read_forward_solution
 from .stc import read_stc, write_stc
 from .bem_surfaces import read_bem_surfaces
 from .inverse import read_inverse_operator, compute_inverse
-from .pick import pick_types
-from .meas_info import get_current_comp
 from .epochs import read_epochs
-
+import fiff
diff --git a/fiff/bem_surfaces.py b/mne/bem_surfaces.py
similarity index 96%
rename from fiff/bem_surfaces.py
rename to mne/bem_surfaces.py
index a1fdbe8..b878914 100644
--- a/fiff/bem_surfaces.py
+++ b/mne/bem_surfaces.py
@@ -1,11 +1,15 @@
-import numpy as np
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
 
-from .constants import FIFF
-from .open import fiff_open
-from .tree import dir_tree_find
-from .tag import find_tag
+import numpy as np
 from scipy import linalg
 
+from .fiff.constants import FIFF
+from .fiff.open import fiff_open
+from .fiff.tree import dir_tree_find
+from .fiff.tag import find_tag
+
 #
 #   These fiff definitions are not needed elsewhere
 #
diff --git a/fiff/cov.py b/mne/cov.py
similarity index 92%
rename from fiff/cov.py
rename to mne/cov.py
index 5cb19f6..4b2aa04 100644
--- a/fiff/cov.py
+++ b/mne/cov.py
@@ -1,11 +1,19 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 import os
 import numpy as np
 
-from .constants import FIFF
-from .tag import find_tag
-from .tree import dir_tree_find
-from .proj import read_proj
-from .channels import _read_bad_channels
+from .fiff.constants import FIFF
+from .fiff.tag import find_tag
+from .fiff.tree import dir_tree_find
+from .fiff.proj import read_proj
+from .fiff.channels import _read_bad_channels
+
+from .fiff.write import start_block, end_block, write_int, write_name_list, \
+                       write_double, write_float_matrix, start_file, end_file
+from .fiff.proj import write_proj
 
 
 def read_cov(fid, node, cov_kind):
@@ -120,11 +128,6 @@ def read_cov(fid, node, cov_kind):
 ###############################################################################
 # Writing
 
-from .write import start_block, end_block, write_int, write_name_list, \
-                   write_double, write_float_matrix, start_file, end_file
-from .proj import write_proj
-
-
 def write_cov(fid, cov):
     """Write a noise covariance matrix
 
diff --git a/fiff/epochs.py b/mne/epochs.py
similarity index 97%
rename from fiff/epochs.py
rename to mne/epochs.py
index 38bd8f0..c9aeb04 100644
--- a/fiff/epochs.py
+++ b/mne/epochs.py
@@ -1,5 +1,7 @@
-# Authors : Alexandre Gramfort, gramfort at nmr.mgh.harvard.edu
-#           Matti Hamalainen, msh at nmr.mgh.harvard.edu
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 
 import numpy as np
 import fiff
diff --git a/fiff/event.py b/mne/event.py
similarity index 87%
rename from fiff/event.py
rename to mne/event.py
index a4d6672..4f7fa6a 100644
--- a/fiff/event.py
+++ b/mne/event.py
@@ -2,13 +2,14 @@
 """
 
 # Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
 # License: BSD Style.
 
-from .constants import FIFF
-from .tree import dir_tree_find
-from .tag import read_tag
-from .open import fiff_open
-from .write import write_int, start_block, start_file, end_block, end_file
+from .fiff.constants import FIFF
+from .fiff.tree import dir_tree_find
+from .fiff.tag import read_tag
+from .fiff.open import fiff_open
+from .fiff.write import write_int, start_block, start_file, end_block, end_file
 
 
 def read_events(filename):
diff --git a/fiff/__init__.py b/mne/fiff/__init__.py
similarity index 52%
rename from fiff/__init__.py
rename to mne/fiff/__init__.py
index 25ddfe2..f85d4d6 100644
--- a/fiff/__init__.py
+++ b/mne/fiff/__init__.py
@@ -3,15 +3,8 @@ __version__ = '0.1.git'
 from .constants import FIFF
 from .open import fiff_open
 from .evoked import read_evoked, write_evoked
-from .cov import read_cov, write_cov, write_cov_file
 from .raw import setup_read_raw, read_raw_segment, read_raw_segment_times, \
                  start_writing_raw, write_raw_buffer, finish_writing_raw
-from .event import read_events, write_events
-from .forward import read_forward_solution
-from .stc import read_stc, write_stc
-from .bem_surfaces import read_bem_surfaces
-from .inverse import read_inverse_operator, compute_inverse
 from .pick import pick_types
 from .meas_info import get_current_comp
-from .epochs import read_epochs
 
diff --git a/fiff/bunch.py b/mne/fiff/bunch.py
similarity index 100%
rename from fiff/bunch.py
rename to mne/fiff/bunch.py
diff --git a/fiff/channels.py b/mne/fiff/channels.py
similarity index 88%
rename from fiff/channels.py
rename to mne/fiff/channels.py
index 31aaa03..8c057be 100644
--- a/fiff/channels.py
+++ b/mne/fiff/channels.py
@@ -1,3 +1,7 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 from .tree import dir_tree_find
 from .tag import find_tag
 from .constants import FIFF
diff --git a/fiff/constants.py b/mne/fiff/constants.py
similarity index 99%
rename from fiff/constants.py
rename to mne/fiff/constants.py
index 21c916f..42fafe5 100644
--- a/fiff/constants.py
+++ b/mne/fiff/constants.py
@@ -1,3 +1,8 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#         Matti Hamalainen <msh at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 from bunch import Bunch
 
 FIFF = Bunch()
diff --git a/fiff/ctf.py b/mne/fiff/ctf.py
similarity index 98%
rename from fiff/ctf.py
rename to mne/fiff/ctf.py
index fe1c59a..e64e9d5 100644
--- a/fiff/ctf.py
+++ b/mne/fiff/ctf.py
@@ -1,3 +1,7 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 import numpy as np
 
 from .constants import FIFF
diff --git a/fiff/diff.py b/mne/fiff/diff.py
similarity index 92%
rename from fiff/diff.py
rename to mne/fiff/diff.py
index 4b18c40..88e4f61 100644
--- a/fiff/diff.py
+++ b/mne/fiff/diff.py
@@ -1,3 +1,7 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 import numpy as np
 
 def is_equal(first, second):
diff --git a/fiff/evoked.py b/mne/fiff/evoked.py
similarity index 99%
rename from fiff/evoked.py
rename to mne/fiff/evoked.py
index eaf7ab4..09c1152 100644
--- a/fiff/evoked.py
+++ b/mne/fiff/evoked.py
@@ -1,3 +1,7 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 import numpy as np
 
 from .constants import FIFF
diff --git a/fiff/matrix.py b/mne/fiff/matrix.py
similarity index 93%
rename from fiff/matrix.py
rename to mne/fiff/matrix.py
index 3eb82d0..8f61d4d 100644
--- a/fiff/matrix.py
+++ b/mne/fiff/matrix.py
@@ -1,3 +1,8 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#         Matti Hamalainen <msh at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 from .constants import FIFF
 from .tag import find_tag, has_tag
 
diff --git a/fiff/meas_info.py b/mne/fiff/meas_info.py
similarity index 98%
rename from fiff/meas_info.py
rename to mne/fiff/meas_info.py
index 144a7ca..c1edc6e 100644
--- a/fiff/meas_info.py
+++ b/mne/fiff/meas_info.py
@@ -1,3 +1,7 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 import numpy as np
 
 from .tree import dir_tree_find
diff --git a/fiff/open.py b/mne/fiff/open.py
similarity index 92%
rename from fiff/open.py
rename to mne/fiff/open.py
index 7cb57d7..9c0fed7 100644
--- a/fiff/open.py
+++ b/mne/fiff/open.py
@@ -1,3 +1,8 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#         Matti Hamalainen <msh at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 from .tag import read_tag_info, read_tag
 from .tree import make_dir_tree
 from .constants import FIFF
diff --git a/fiff/pick.py b/mne/fiff/pick.py
similarity index 96%
rename from fiff/pick.py
rename to mne/fiff/pick.py
index 31dd241..5d5abbe 100644
--- a/fiff/pick.py
+++ b/mne/fiff/pick.py
@@ -1,3 +1,8 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#         Matti Hamalainen <msh at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 from copy import copy
 
 import numpy as np
diff --git a/fiff/proj.py b/mne/fiff/proj.py
similarity index 98%
rename from fiff/proj.py
rename to mne/fiff/proj.py
index 010307f..788b895 100644
--- a/fiff/proj.py
+++ b/mne/fiff/proj.py
@@ -1,3 +1,8 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#         Matti Hamalainen <msh at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 from math import sqrt
 import numpy as np
 from scipy import linalg
diff --git a/fiff/raw.py b/mne/fiff/raw.py
similarity index 99%
rename from fiff/raw.py
rename to mne/fiff/raw.py
index d9eb0c9..cc3d030 100644
--- a/fiff/raw.py
+++ b/mne/fiff/raw.py
@@ -1,3 +1,8 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#         Matti Hamalainen <msh at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 from math import floor, ceil
 import numpy as np
 
diff --git a/fiff/tag.py b/mne/fiff/tag.py
similarity index 99%
rename from fiff/tag.py
rename to mne/fiff/tag.py
index 6cd766f..021636b 100644
--- a/fiff/tag.py
+++ b/mne/fiff/tag.py
@@ -1,3 +1,7 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 import struct
 import numpy as np
 
diff --git a/mne/fiff/tests/__init__.py b/mne/fiff/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/fiff/tests/test_evoked.py b/mne/fiff/tests/test_evoked.py
similarity index 87%
rename from fiff/tests/test_evoked.py
rename to mne/fiff/tests/test_evoked.py
index 52e7178..ba25e80 100644
--- a/fiff/tests/test_evoked.py
+++ b/mne/fiff/tests/test_evoked.py
@@ -1,10 +1,9 @@
 import os
 import os.path as op
 
-import numpy as np
 from numpy.testing import assert_array_almost_equal, assert_equal
 
-import fiff
+from .. import read_evoked, write_evoked
 
 MNE_SAMPLE_DATASET_PATH = os.getenv('MNE_SAMPLE_DATASET_PATH')
 fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
@@ -13,10 +12,10 @@ fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
 def test_io_cov():
     """Test IO for noise covariance matrices
     """
-    data = fiff.read_evoked(fname)
+    data = read_evoked(fname)
 
-    fiff.write_evoked('evoked.fif', data)
-    data2 = fiff.read_evoked('evoked.fif')
+    write_evoked('evoked.fif', data)
+    data2 = read_evoked('evoked.fif')
 
     print assert_array_almost_equal(data['evoked']['epochs'],
                                     data2['evoked']['epochs'])
diff --git a/fiff/tests/test_raw.py b/mne/fiff/tests/test_raw.py
similarity index 73%
rename from fiff/tests/test_raw.py
rename to mne/fiff/tests/test_raw.py
index 84f6aa2..42fea76 100644
--- a/fiff/tests/test_raw.py
+++ b/mne/fiff/tests/test_raw.py
@@ -4,7 +4,9 @@ import os.path as op
 from numpy.testing import assert_array_almost_equal, assert_equal
 
 from math import ceil
-import fiff
+from .. import setup_read_raw, read_raw_segment_times, pick_types, \
+               start_writing_raw, write_raw_buffer, finish_writing_raw
+
 
 MNE_SAMPLE_DATASET_PATH = os.getenv('MNE_SAMPLE_DATASET_PATH')
 fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
@@ -13,14 +15,14 @@ fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
 def test_io_raw():
     """Test IO for raw data
     """
-    raw = fiff.setup_read_raw(fname)
+    raw = setup_read_raw(fname)
 
     nchan = raw['info']['nchan']
     ch_names = raw['info']['ch_names']
     meg_channels_idx = [k for k in range(nchan) if ch_names[k][:3]=='MEG']
     meg_channels_idx = meg_channels_idx[:5]
 
-    data, times = fiff.read_raw_segment_times(raw, start=100, stop=115,
+    data, times = read_raw_segment_times(raw, start=100, stop=115,
                                               sel=meg_channels_idx)
 
     # Writing
@@ -31,13 +33,13 @@ def test_io_raw():
     want_stim = False
     include = ['STI 014']
 
-    picks = fiff.pick_types(raw['info'], meg=want_meg, eeg=want_eeg,
+    picks = pick_types(raw['info'], meg=want_meg, eeg=want_eeg,
                             stim=want_stim, include=include,
                             exclude=raw['info']['bads'])
 
     print "Number of picked channels : %d" % len(picks)
 
-    outfid, cals = fiff.start_writing_raw('raw.fif', raw['info'], picks)
+    outfid, cals = start_writing_raw('raw.fif', raw['info'], picks)
     #
     #   Set up the reading parameters
     #
@@ -50,18 +52,18 @@ def test_io_raw():
     #
     for first in range(start, stop, quantum):
         last = first + quantum
-        if last > stop:
+        if last >= stop:
             last = stop
         try:
-            data, times = fiff.read_raw_segment(raw, first, last, picks)
+            data, times = raw[picks, first:last]
         except Exception as inst:
             raw['fid'].close()
             outfid.close()
             print inst
 
-        fiff.write_raw_buffer(outfid, data, cals)
+        write_raw_buffer(outfid, data, cals)
         print '[done]'
 
-    fiff.finish_writing_raw(outfid)
+    finish_writing_raw(outfid)
     raw['fid'].close()
 
diff --git a/fiff/tree.py b/mne/fiff/tree.py
similarity index 98%
rename from fiff/tree.py
rename to mne/fiff/tree.py
index 86b23c1..9c2b92a 100644
--- a/fiff/tree.py
+++ b/mne/fiff/tree.py
@@ -1,3 +1,7 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 from .bunch import Bunch
 from .tag import read_tag
 
diff --git a/fiff/write.py b/mne/fiff/write.py
similarity index 99%
rename from fiff/write.py
rename to mne/fiff/write.py
index a0091b8..20144bf 100644
--- a/fiff/write.py
+++ b/mne/fiff/write.py
@@ -1,3 +1,7 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 import time
 import array
 import numpy as np
diff --git a/fiff/forward.py b/mne/forward.py
similarity index 97%
rename from fiff/forward.py
rename to mne/forward.py
index 6a7b2cc..c8922e5 100644
--- a/fiff/forward.py
+++ b/mne/forward.py
@@ -1,14 +1,19 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 import copy
 import numpy as np
 from scipy import linalg
 
-from .constants import FIFF
-from .open import fiff_open
-from .tree import dir_tree_find
-from .channels import _read_bad_channels
-from .tag import find_tag
+from .fiff.constants import FIFF
+from .fiff.open import fiff_open
+from .fiff.tree import dir_tree_find
+from .fiff.channels import _read_bad_channels
+from .fiff.tag import find_tag
+from .fiff.matrix import _read_named_matrix, _transpose_named_matrix
+
 from .source_space import read_source_spaces, find_source_space_hemi
-from .matrix import _read_named_matrix, _transpose_named_matrix
 
 
 def _block_diag(A, n):
diff --git a/fiff/inverse.py b/mne/inverse.py
similarity index 96%
rename from fiff/inverse.py
rename to mne/inverse.py
index b18c67d..77317d2 100644
--- a/fiff/inverse.py
+++ b/mne/inverse.py
@@ -1,18 +1,24 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 from math import sqrt
 import numpy as np
 
-from .constants import FIFF
-from .open import fiff_open
-from .tag import find_tag
-from .matrix import _read_named_matrix, _transpose_named_matrix
-from .cov import read_cov
-from .proj import read_proj, make_projector
-from .tree import dir_tree_find
+from .fiff.constants import FIFF
+from .fiff.open import fiff_open
+from .fiff.tag import find_tag
+from .fiff.matrix import _read_named_matrix, _transpose_named_matrix
+from .fiff.cov import read_cov
+from .fiff.proj import read_proj, make_projector
+from .fiff.tree import dir_tree_find
+from .fiff.evoked import read_evoked
+from .fiff.pick import pick_channels_evoked
+
 from .source_space import read_source_spaces, find_source_space_hemi
-from .forward import _invert_transform, _transform_source_space_to
-from .evoked import read_evoked
-from .pick import pick_channels_evoked
-from .forward import _block_diag
+from .forward import _invert_transform, _transform_source_space_to, \
+                     _block_diag
+
 
 def read_inverse_operator(fname):
     """Read the inverse operator decomposition from a FIF file
diff --git a/fiff/source_space.py b/mne/source_space.py
similarity index 97%
rename from fiff/source_space.py
rename to mne/source_space.py
index fc8daaa..1b10c8d 100644
--- a/fiff/source_space.py
+++ b/mne/source_space.py
@@ -1,10 +1,14 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 from math import sqrt
 import numpy as np
 
-from .constants import FIFF
-from .tree import dir_tree_find
-from .tag import find_tag
-from .open import fiff_open
+from .fiff.constants import FIFF
+from .fiff.tree import dir_tree_find
+from .fiff.tag import find_tag
+from .fiff.open import fiff_open
 
 
 def patch_info(nearest):
diff --git a/fiff/stc.py b/mne/stc.py
similarity index 96%
rename from fiff/stc.py
rename to mne/stc.py
index cb662ae..cb9c4e5 100644
--- a/fiff/stc.py
+++ b/mne/stc.py
@@ -1,3 +1,7 @@
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD Style.
+
 import numpy as np
 
 
diff --git a/mne/tests/__init__.py b/mne/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/fiff/tests/test_bem_surfaces.py b/mne/tests/test_bem_surfaces.py
similarity index 77%
rename from fiff/tests/test_bem_surfaces.py
rename to mne/tests/test_bem_surfaces.py
index a8588a4..2579b8e 100644
--- a/fiff/tests/test_bem_surfaces.py
+++ b/mne/tests/test_bem_surfaces.py
@@ -4,7 +4,7 @@ import os.path as op
 import numpy as np
 from numpy.testing import assert_array_almost_equal
 
-import fiff
+import mne
 
 MNE_SAMPLE_DATASET_PATH = os.getenv('MNE_SAMPLE_DATASET_PATH')
 fname = op.join(MNE_SAMPLE_DATASET_PATH, 'subjects', 'sample', 'bem',
@@ -13,6 +13,6 @@ fname = op.join(MNE_SAMPLE_DATASET_PATH, 'subjects', 'sample', 'bem',
 def test_io_bem_surfaces():
     """Testing reading of bem surfaces
     """
-    surf = fiff.read_bem_surfaces(fname, add_geom=False)
-    surf = fiff.read_bem_surfaces(fname, add_geom=True)
+    surf = mne.read_bem_surfaces(fname, add_geom=False)
+    surf = mne.read_bem_surfaces(fname, add_geom=True)
     print "Number of surfaces : %d" % len(surf)
diff --git a/fiff/tests/test_cov.py b/mne/tests/test_cov.py
similarity index 56%
rename from fiff/tests/test_cov.py
rename to mne/tests/test_cov.py
index 79ceba5..0bad2fb 100644
--- a/fiff/tests/test_cov.py
+++ b/mne/tests/test_cov.py
@@ -1,10 +1,10 @@
 import os
 import os.path as op
 
-import numpy as np
 from numpy.testing import assert_array_almost_equal
 
-import fiff
+import mne
+from ..fiff import fiff_open
 
 MNE_SAMPLE_DATASET_PATH = os.getenv('MNE_SAMPLE_DATASET_PATH')
 fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
@@ -13,15 +13,15 @@ fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
 def test_io_cov():
     """Test IO for noise covariance matrices
     """
-    fid, tree, _ = fiff.fiff_open(fname)
+    fid, tree, _ = fiff_open(fname)
     cov_type = 1
-    cov = fiff.read_cov(fid, tree, cov_type)
+    cov = mne.read_cov(fid, tree, cov_type)
     fid.close()
 
-    fiff.write_cov_file('cov.fif', cov)
+    mne.write_cov_file('cov.fif', cov)
 
-    fid, tree, _ = fiff.fiff_open('cov.fif')
-    cov2 = fiff.read_cov(fid, tree, cov_type)
+    fid, tree, _ = fiff_open('cov.fif')
+    cov2 = mne.read_cov(fid, tree, cov_type)
     fid.close()
 
     print assert_array_almost_equal(cov['data'], cov2['data'])
\ No newline at end of file
diff --git a/fiff/tests/test_event.py b/mne/tests/test_event.py
similarity index 61%
rename from fiff/tests/test_event.py
rename to mne/tests/test_event.py
index 5b224fc..eaefc87 100644
--- a/fiff/tests/test_event.py
+++ b/mne/tests/test_event.py
@@ -1,10 +1,9 @@
 import os
 import os.path as op
 
-import numpy as np
 from numpy.testing import assert_array_almost_equal
 
-import fiff
+import mne
 
 MNE_SAMPLE_DATASET_PATH = os.getenv('MNE_SAMPLE_DATASET_PATH')
 fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
@@ -14,7 +13,7 @@ fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
 def test_io_cov():
     """Test IO for noise covariance matrices
     """
-    event_list = fiff.read_events(fname)
-    fiff.write_events('events.fif', event_list)
-    event_list2 = fiff.read_events(fname)
-    assert_array_almost_equal(event_list, event_list2)
+    events = mne.read_events(fname)
+    mne.write_events('events.fif', events)
+    events2 = mne.read_events(fname)
+    assert_array_almost_equal(events, events2)
diff --git a/fiff/tests/test_forward.py b/mne/tests/test_forward.py
similarity index 74%
rename from fiff/tests/test_forward.py
rename to mne/tests/test_forward.py
index 4693c0f..dd67505 100644
--- a/fiff/tests/test_forward.py
+++ b/mne/tests/test_forward.py
@@ -1,10 +1,9 @@
 import os
 import os.path as op
 
-import numpy as np
 from numpy.testing import assert_array_almost_equal, assert_equal
 
-import fiff
+import mne
 
 MNE_SAMPLE_DATASET_PATH = os.getenv('MNE_SAMPLE_DATASET_PATH')
 fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
@@ -13,6 +12,6 @@ fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
 def test_io_forward():
     """Test IO for forward solutions
     """
-    fwd = fiff.read_forward_solution(fname)
-    fwd = fiff.read_forward_solution(fname, force_fixed=True)
+    fwd = mne.read_forward_solution(fname)
+    fwd = mne.read_forward_solution(fname, force_fixed=True)
     leadfield = fwd['sol']['data']
diff --git a/fiff/tests/test_inverse.py b/mne/tests/test_inverse.py
similarity index 83%
rename from fiff/tests/test_inverse.py
rename to mne/tests/test_inverse.py
index 748d43e..be20ccd 100644
--- a/fiff/tests/test_inverse.py
+++ b/mne/tests/test_inverse.py
@@ -1,10 +1,9 @@
 import os
 import os.path as op
 
-import numpy as np
 from numpy.testing import assert_array_almost_equal, assert_equal
 
-import fiff
+import mne
 
 MNE_SAMPLE_DATASET_PATH = os.getenv('MNE_SAMPLE_DATASET_PATH')
 fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
@@ -13,4 +12,4 @@ fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
 def test_io_forward():
     """Test IO for inverse operator
     """
-    fwd = fiff.read_inverse_operator(fname)
+    fwd = mne.read_inverse_operator(fname)
diff --git a/fiff/tests/test_stc.py b/mne/tests/test_stc.py
similarity index 81%
rename from fiff/tests/test_stc.py
rename to mne/tests/test_stc.py
index 9ece422..02c5a23 100644
--- a/fiff/tests/test_stc.py
+++ b/mne/tests/test_stc.py
@@ -1,10 +1,9 @@
 import os
 import os.path as op
 
-import numpy as np
 from numpy.testing import assert_array_almost_equal, assert_equal
 
-import fiff
+import mne
 
 MNE_SAMPLE_DATASET_PATH = os.getenv('MNE_SAMPLE_DATASET_PATH')
 fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
@@ -13,10 +12,10 @@ fname = op.join(MNE_SAMPLE_DATASET_PATH, 'MEG', 'sample',
 def test_io_stc():
     """Test IO for STC files
     """
-    stc = fiff.read_stc(fname)
+    stc = mne.read_stc(fname)
 
-    fiff.write_stc("tmp.stc", stc)
-    stc2 = fiff.read_stc("tmp.stc")
+    mne.write_stc("tmp.stc", stc)
+    stc2 = mne.read_stc("tmp.stc")
 
     assert_array_almost_equal(stc['data'], stc2['data'])
     assert_array_almost_equal(stc['tmin'], stc2['tmin'])
diff --git a/setup.cfg b/setup.cfg
index 6cec9dd..bcd477b 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -6,5 +6,5 @@ test = nosetests
 [nosetests]
 detailed-errors = 1
 with-doctest = 1
-cover-package = fiff
+cover-package = mne
 
diff --git a/setup.py b/setup.py
index b9b78b1..624b309 100644
--- a/setup.py
+++ b/setup.py
@@ -1,20 +1,20 @@
 #! /usr/bin/env python
 #
-# Copyright (C) 2010 Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+# Copyright (C) 2011 Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
 
-descr   = """A set of python functions to read and write Neuromag FIF files."""
+descr   = """MNE python project for MEG and EEG data analysis."""
 
 import os
 
 
-DISTNAME            = 'pyfiff'
-DESCRIPTION         = 'Functions to read and write Neuromag FIF files.'
+DISTNAME            = 'mne'
+DESCRIPTION         = 'MNE python project for MEG and EEG data analysis'
 LONG_DESCRIPTION    = descr
 MAINTAINER          = 'Alexandre Gramfort'
 MAINTAINER_EMAIL    = 'gramfort at nmr.mgh.harvard.edu'
-URL                 = 'http://github.com/agramfort/pyfiff'
-LICENSE             = 'To be determined' # XXX
-DOWNLOAD_URL        = 'http://github.com/agramfort/pyfiff'
+URL                 = 'http://github.com/mne/mne'
+LICENSE             = 'BSD'
+DOWNLOAD_URL        = 'http://github.com/mne/mne'
 VERSION             = '0.1.git'
 
 import setuptools # we are using a setuptools namespace
@@ -39,7 +39,6 @@ if __name__ == "__main__":
             ['Intended Audience :: Science/Research',
              'Intended Audience :: Developers',
              'License :: OSI Approved',
-             'Programming Language :: C',
              'Programming Language :: Python',
              'Topic :: Software Development',
              'Topic :: Scientific/Engineering',

-- 
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