# Path: jr/meg/base.py
# def mat2mne(data, chan_names='meg', chan_types=None, sfreq=250, events=None,
#             tmin=0):
#     from mne.epochs import EpochsArray
#     from mne.io.meas_info import create_info
#     data = np.array(data)
#     n_trial, n_chan, n_time = data.shape
#     # chan names
#     if isinstance(chan_names, str):
#         chan_names = [chan_names + '_%02i' % chan for chan in range(n_chan)]
#     if len(chan_names) != n_chan:
#         raise ValueError('chan_names must be a string or a list of'
#                          'n_chan strings')
#     # chan types
#     if isinstance(chan_types, str):
#         chan_types = [chan_types] * n_chan
#     elif chan_types is None:
#         if isinstance(chan_names, str):
#             if chan_names != 'meg':
#                 chan_types = [chan_names] * n_chan
#             else:
#                 chan_types = ['mag'] * n_chan
#         elif isinstance(chan_names, list):
#             chan_types = ['mag' for chan in chan_names]
#         else:
#             raise ValueError('Specify chan_types')
# 
#     # events
#     if events is None:
#         events = np.c_[np.cumsum(np.ones(n_trial)) * 5 * sfreq,
#                        np.zeros(n_trial, int), np.zeros(n_trial)]
#     else:
#         events = np.array(events, int)
#         if events.ndim == 1:
#             events = np.c_[np.cumsum(np.ones(n_trial)) * 5 * sfreq,
#                            np.zeros(n_trial), events]
#         elif (events.ndim != 2) or (events.shape[1] != 3):
#             raise ValueError('events shape must be ntrial, or ntrials * 3')
# 
#     info = create_info(chan_names, sfreq, chan_types)
#     return EpochsArray(data, info, events=np.array(events, int), verbose=False,
#                        tmin=tmin)


import numpy as np
from numpy.testing import assert_array_equal
from nose.tools import assert_equal, assert_true, assert_raises
from ..base import mat2mne


def test_mat2mne():
    ntrial, nchan, ntime = 100, 32, 10
    data = np.random.randn(ntrial, nchan, ntime)
    # test base

# Path: jr/meg/base.py
# def mat2mne(data, chan_names='meg', chan_types=None, sfreq=250, events=None,
#             tmin=0):
#     from mne.epochs import EpochsArray
#     from mne.io.meas_info import create_info
#     data = np.array(data)
#     n_trial, n_chan, n_time = data.shape
#     # chan names
#     if isinstance(chan_names, str):
#         chan_names = [chan_names + '_%02i' % chan for chan in range(n_chan)]
#     if len(chan_names) != n_chan:
#         raise ValueError('chan_names must be a string or a list of'
#                          'n_chan strings')
#     # chan types
#     if isinstance(chan_types, str):
#         chan_types = [chan_types] * n_chan
#     elif chan_types is None:
#         if isinstance(chan_names, str):
#             if chan_names != 'meg':
#                 chan_types = [chan_names] * n_chan
#             else:
#                 chan_types = ['mag'] * n_chan
#         elif isinstance(chan_names, list):
#             chan_types = ['mag' for chan in chan_names]
#         else:
#             raise ValueError('Specify chan_types')
# 
#     # events
#     if events is None:
#         events = np.c_[np.cumsum(np.ones(n_trial)) * 5 * sfreq,
#                        np.zeros(n_trial, int), np.zeros(n_trial)]
#     else:
#         events = np.array(events, int)
#         if events.ndim == 1:
#             events = np.c_[np.cumsum(np.ones(n_trial)) * 5 * sfreq,
#                            np.zeros(n_trial), events]
#         elif (events.ndim != 2) or (events.shape[1] != 3):
#             raise ValueError('events shape must be ntrial, or ntrials * 3')
# 
#     info = create_info(chan_names, sfreq, chan_types)
#     return EpochsArray(data, info, events=np.array(events, int), verbose=False,
#                        tmin=tmin)


# Path: jr/meg/tests/test_meg.py
import numpy as np
from numpy.testing import assert_array_equal
from nose.tools import assert_equal, assert_true, assert_raises
from ..base import mat2mne



def test_mat2mne():
    ntrial, nchan, ntime = 100, 32, 10
    data = np.random.randn(ntrial, nchan, ntime)
    # test base

    epochs = mat2mne(data)