[Mne_analysis] Writing Fieldtrip epoch data into MNE format

Sheraz Khan, PhD sheraz at nmr.mgh.harvard.edu
Mon Feb 5 21:48:47 EST 2018
Search archives:

Hi Sanjeev,

You can convert fieldtrip data and cfg structure in to mne-python object
using Epoch class.

Please see sample code below, for more details see
https://martinos.org/mne/stable/generated/mne.Epochs.html

event_id = 1  # This is used to identify the events.
# First column is for the sample number.
events = np.array([[200, 0, event_id],
                   [1200, 0, event_id],
                   [2000, 0, event_id]])  # List of three arbitrary events

# Here a data set of 700 ms epochs from 2 channels is
# created from sin and cos data.
# Any data in shape (n_epochs, n_channels, n_times) can be used.
epochs_data = np.array([[sin[:700], cos[:700]],
                        [sin[1000:1700], cos[1000:1700]],
                        [sin[1800:2500], cos[1800:2500]]])

ch_names = ['sin', 'cos']
ch_types = ['mag', 'mag']
info = mne.create_info(ch_names=ch_names, sfreq=sfreq, ch_types=ch_types)

epochs = mne.EpochsArray(epochs_data, info=info, events=events,
                         event_id={'arbitrary': 1})

picks = mne.pick_types(info, meg=True, eeg=False, misc=False)

epochs.plot(picks=picks, scalings='auto', show=True, block=True)

HTH

Sheraz

> Hi team MNE,
>
> I am new user of MNE python. I have a .fif file which is preprocessed in
> Fieldtrip (artifact rejection, ICA etc) and then i saved the data into a
> mat file having two main structures, data and cfg.
>
> Now i want to process the data in MNE, when i try to write the mat file to
> fiff using functions fieldtrip2fiff it shows me that it cannot process the
> structures. I also tried with the functions of MNE matlab to write but it
> also shows me the same.
>
>
> I shall be thankful if you guys can tell me how to read the epoched data
> from mat files in MNE.
>
>
>
>
> Best regards
> Sanjeev
>
>
>
>
> Sanjeev Nara
> Predoctoral Researcher BCBL
> www.bcbl.eu
> https://sites.google.com/view/sanjeev-nara/
> Tel: +34 943 309 300 (ext 314)
> Legal disclaimer/Aviso legal/Lege-oharra: www.bcbl.eu/legal-disclaimer
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
>


-------------------------
Sheraz Khan, M.Eng, Ph.D.
Instructor in Neurology

Athinoula A. Martinos Center for Biomedical Imaging
Massachusetts General Hospital
Harvard Medical School

McGovern Institute for Brain Research
Massachusetts Institute of Technology

Tel:   +1 617-643-5634
Fax:   +1 617-948-5966
Email: sheraz at nmr.mgh.harvard.edu
       sheraz at mit.edu
Web:   http://sheraz.mit.edu


More information about the Mne_analysis mailing list