Skip to content

Commit

Permalink
FIX: Fix location of base.py
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Apr 15, 2014
1 parent cd79710 commit 67def3a
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 55 deletions.
2 changes: 1 addition & 1 deletion mne/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from .fiff.proj import setup_proj, ProjMixin
from .fiff.channels import ContainsMixin, PickDropChannelsMixin
from .fiff.evoked import aspect_rev
from .raw import _BaseRaw, _time_as_index, _index_as_time
from .fiff.base import _BaseRaw, _time_as_index, _index_as_time
from .baseline import rescale
from .utils import (check_random_state, _check_pandas_index_arguments,
_check_pandas_installed)
Expand Down
12 changes: 7 additions & 5 deletions mne/fiff/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@
from .open import fiff_open, show_fiff
from .evoked import Evoked, read_evoked, write_evoked
from .meas_info import read_fiducials, write_fiducials, read_info, write_info
from .raw import RawFIFF
from .pick import (pick_types, pick_channels, pick_types_evoked,
pick_channels_regexp, pick_channels_forward,
pick_types_forward, pick_channels_cov,
pick_channels_evoked, pick_info, _has_kit_refs)

from .proj import proj_equal, make_eeg_average_ref_proj
from .cov import read_cov, write_cov
from . import bti
from . import kit
from . import base
from . import brainvision
from . import bti
from . import edf
from . import egi
from . import kit
from . import fiff

# for backward compatibility
from .raw import RawFIFF as Raw
from ..raw import concatenate_raws, get_chpi_positions, set_eeg_reference
from .fiff import RawFIFF as Raw
from .base import concatenate_raws, get_chpi_positions, set_eeg_reference
38 changes: 19 additions & 19 deletions mne/raw.py → mne/fiff/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@
from scipy.signal import hilbert
from scipy import linalg

from .fiff.constants import FIFF
from .fiff.meas_info import write_meas_info
from .fiff.pick import pick_types, channel_type
from .fiff.proj import (setup_proj, activate_proj, proj_equal, ProjMixin,
_has_eeg_average_ref_proj, make_eeg_average_ref_proj)
from .fiff.channels import ContainsMixin, PickDropChannelsMixin
from .fiff.compensator import set_current_comp
from .fiff.write import (start_file, end_file, start_block, end_block,
write_dau_pack16, write_float, write_double,
write_complex64, write_complex128, write_int,
write_id)

from .filter import (low_pass_filter, high_pass_filter, band_pass_filter,
notch_filter, band_stop_filter, resample)
from .parallel import parallel_func
from .utils import (_check_fname, estimate_rank, _check_pandas_installed,
logger, verbose)
from .viz import plot_raw, plot_raw_psds, _mutable_defaults
from .externals.six import string_types
from .constants import FIFF
from .meas_info import write_meas_info
from .pick import pick_types, channel_type
from .proj import (setup_proj, activate_proj, proj_equal, ProjMixin,
_has_eeg_average_ref_proj, make_eeg_average_ref_proj)
from .channels import ContainsMixin, PickDropChannelsMixin
from .compensator import set_current_comp
from .write import (start_file, end_file, start_block, end_block,
write_dau_pack16, write_float, write_double,
write_complex64, write_complex128, write_int,
write_id)

from ..filter import (low_pass_filter, high_pass_filter, band_pass_filter,
notch_filter, band_stop_filter, resample)
from ..parallel import parallel_func
from ..utils import (_check_fname, estimate_rank, _check_pandas_installed,
logger, verbose)
from ..viz import plot_raw, plot_raw_psds, _mutable_defaults
from ..externals.six import string_types


class _BaseRaw(ProjMixin, ContainsMixin, PickDropChannelsMixin):
Expand Down
2 changes: 1 addition & 1 deletion mne/fiff/brainvision/brainvision.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from ...utils import verbose, logger
from ..constants import FIFF
from ..meas_info import Info
from ...raw import _BaseRaw
from ..base import _BaseRaw


class RawBrainVision(_BaseRaw):
Expand Down
2 changes: 1 addition & 1 deletion mne/fiff/bti/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import numpy as np

from ...utils import logger, verbose, sum_squared
from ...raw import _BaseRaw
from ..base import _BaseRaw
from .. import FIFF
from .constants import BTI
from .read import (read_int32, read_int16, read_str, read_float, read_double,
Expand Down
10 changes: 6 additions & 4 deletions mne/fiff/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def _contains_ch_type(info, ch_type):
valid=' or '.join(valid_channel_types)))
return ch_type in [channel_type(info, ii) for ii in range(info['nchan'])]


@verbose
def equalize_channels(candidates, verbose=None):
"""Equalize channel picks for a collection of MNE-Python objects
Expand Down Expand Up @@ -139,6 +140,7 @@ def equalize_channels(candidates, verbose=None):
else:
logger.info('all channels are corresponding, nothing to do.')


class ContainsMixin(object):
"""Mixin class for Raw, Evoked, Epochs
"""
Expand Down Expand Up @@ -195,7 +197,6 @@ def pick_channels(self, ch_names, copy=False):

return inst


#XXX : to be updated soon with BaseRaw
def drop_channels(self, ch_names, copy=False):
"""Drop some channels
Expand Down Expand Up @@ -237,6 +238,7 @@ def drop_channels(self, ch_names, copy=False):

return inst


def rename_channels(info, mapping):
"""Rename channels and optionally change the sensor type.
Expand Down Expand Up @@ -266,15 +268,15 @@ def rename_channels(info, mapping):
for ch_name, new_name in mapping.items():
if ch_name not in ch_names:
raise ValueError("This channel name (%s) doesn't exist in info."
% ch_name)
% ch_name)

c_ind = ch_names.index(ch_name)
if not isinstance(new_name, (string_types, tuple)):
raise ValueError('Your mapping is not configured properly. '
'Please see the help: mne.rename_channels?')

elif isinstance(new_name, tuple): # name and type change
new_name, new_type = new_name # unpack
new_name, new_type = new_name # unpack
if new_type not in human2fiff:
raise ValueError('This function cannot change to this '
'channel type: %s.' % new_type)
Expand All @@ -290,7 +292,7 @@ def rename_channels(info, mapping):

# Reset ch_names and Check that all the channel names are unique.
for key, collection in [('ch_name', new_names), ('kind', new_kinds)]:
for c_ind, new_name in collection:
for c_ind, new_name in collection:
chs[c_ind][key] = new_name
for c_ind, new_name in new_bads:
bads[c_ind] = new_name
Expand Down
2 changes: 1 addition & 1 deletion mne/fiff/edf/edf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from ...transforms import als_ras_trans_mm, apply_trans
from ...utils import verbose, logger
from ...raw import _BaseRaw
from ..base import _BaseRaw
from ..meas_info import Info
from ..constants import FIFF
from ...coreg import get_ras_to_neuromag_trans
Expand Down
8 changes: 4 additions & 4 deletions mne/fiff/egi/egi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import numpy as np

from .. import Raw
from ..base import _BaseRaw
from ..meas_info import Info
from ..constants import FIFF
from ...utils import verbose, logger
Expand Down Expand Up @@ -155,7 +155,7 @@ def read_raw_egi(input_fname, event_ids=None):
return _RawEGI(input_fname, event_ids)


class _RawEGI(Raw):
class _RawEGI(_BaseRaw):
"""Raw object from EGI simple binary file
"""
@verbose
Expand All @@ -169,9 +169,9 @@ def __init__(self, input_fname, event_ids=None, verbose=None):
logger.info(' Reading data ...')
# reads events as well
data = _read_data(fid, egi_info).astype(np.float64)
if egi_info['value_range'] and egi_info['bits']:
if egi_info['value_range'] and egi_info['bits']:
mv = egi_info['value_range'] / 2 ** egi_info['bits']
else:
else:
mv = 1e-6
data[:egi_info['n_channels']] = data[:egi_info['n_channels']] * mv

Expand Down
4 changes: 2 additions & 2 deletions mne/fiff/egi/tests/test_egi.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_io_egi():
raw = read_raw_egi(egi_fname)

_ = repr(raw)
_ = repr(raw.info)
_ = repr(raw.info) # analysis:ignore, noqa

assert_equal('eeg' in raw, True)
out_fname = op.join(tempdir, 'test_egi_raw.fif')
Expand All @@ -45,7 +45,7 @@ def test_io_egi():
assert_equal(len(picks), 256)
assert_equal('STI 014' in raw.ch_names, True)

events = find_events(raw)
events = find_events(raw, stim_channel='STI 014')
assert_equal(len(events), 2) # ground truth
assert_equal(np.unique(events[:, 1])[0], 0)
assert_true(np.unique(events[:, 0])[0] != 0)
Expand Down
1 change: 1 addition & 0 deletions mne/fiff/fiff/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .raw import RawFIFF
22 changes: 11 additions & 11 deletions mne/fiff/raw.py → mne/fiff/fiff/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@

import numpy as np

from .constants import FIFF
from .open import fiff_open
from .meas_info import read_meas_info
from .tree import dir_tree_find
from .tag import read_tag
from .proj import proj_equal
from .compensator import get_current_comp, set_current_comp, make_compensator

from ..raw import _BaseRaw
from ..utils import logger, verbose
from ..externals.six import string_types
from ..constants import FIFF
from ..open import fiff_open
from ..meas_info import read_meas_info
from ..tree import dir_tree_find
from ..tag import read_tag
from ..proj import proj_equal
from ..compensator import get_current_comp, set_current_comp, make_compensator
from ..base import _BaseRaw

from ...utils import logger, verbose
from ...externals.six import string_types


class RawFIFF(_BaseRaw):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
assert_allclose)
from nose.tools import assert_true, assert_raises, assert_equal

from mne.fiff import Raw, pick_types, pick_channels, FIFF
from mne.raw import concatenate_raws, get_chpi_positions, set_eeg_reference
from mne.fiff import (Raw, pick_types, pick_channels, FIFF,
concatenate_raws, get_chpi_positions, set_eeg_reference)
from mne import concatenate_events, find_events, equalize_channels
from mne.utils import (_TempDir, requires_nitime, requires_pandas,
requires_mne, run_subprocess)
from mne.externals.six.moves import zip

warnings.simplefilter('always') # enable b/c these tests throw warnings

base_dir = op.join(op.dirname(__file__), 'data')
base_dir = op.join(op.dirname(__file__), '..', '..', 'tests', 'data')
fif_fname = op.join(base_dir, 'test_raw.fif')
fif_gz_fname = op.join(base_dir, 'test_raw.fif.gz')
ctf_fname = op.join(base_dir, 'test_ctf_raw.fif')
Expand Down
2 changes: 1 addition & 1 deletion mne/fiff/kit/kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
get_ras_to_neuromag_trans)
from ...utils import verbose, logger
from ...transforms import apply_trans, als_ras_trans, als_ras_trans_mm
from ...raw import _BaseRaw
from ..base import _BaseRaw
from ..constants import FIFF
from ..meas_info import Info
from ..tag import _loc_to_trans
Expand Down
Binary file modified mne/fiff/tests/data/test_raw.fif
Binary file not shown.
2 changes: 1 addition & 1 deletion mne/forward/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from ..fiff.write import (write_int, start_block, end_block,
write_coord_trans, write_ch_info, write_name_list,
write_string, start_file, end_file, write_id)
from ..raw import _BaseRaw
from ..fiff.base import _BaseRaw
from ..fiff.evoked import Evoked, write_evoked
from ..epochs import Epochs
from ..source_space import (read_source_spaces_from_tree,
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
from os import path as op

import setuptools # we are using a setuptools namespace
import setuptools # noqa; analysis:ignore; we are using a setuptools namespace
from numpy.distutils.core import setup

# get the version (don't import mne here, so dependencies are not needed)
Expand Down Expand Up @@ -67,6 +67,7 @@
'mne.datasets.spm_face',
'mne.externals',
'mne.fiff', 'mne.fiff.tests',
'mne.fiff.fiff', 'mne.fiff.fiff.tests',
'mne.fiff.bti', 'mne.fiff.bti.tests',
'mne.fiff.kit', 'mne.fiff.kit.tests',
'mne.fiff.edf', 'mne.fiff.edf.tests',
Expand Down

0 comments on commit 67def3a

Please sign in to comment.