[Mne_analysis] Saving data from mne.Epochs

Vincent Rupp rupp.vincent at gmail.com
Tue Feb 12 17:01:15 EST 2013
Search archives:

Hello all,

Thanks very much for the help! I was using 0.4 and had mistakenly assumed
MNE and mne-python were a part of the same installation package. Now the
script runs fine. Much obliged.


Best wishes,

Vincent Rupp


On Tue, Feb 12, 2013 at 1:22 PM, Alexandre Gramfort <
gramfort at nmr.mgh.harvard.edu> wrote:

> hi Vincent,
>
> I suspect you're not actually running the last released version. To check
>
> >>> import mne
> >>> print mne.__version__
>
> you should see 0.5 or more.
>
> HTH
> Alex
>
> On Tue, Feb 12, 2013 at 10:17 PM, Vincent Rupp <rupp.vincent at gmail.com>
> wrote:
> > Hello all,
> >
> > I am trying to epoch resting MEG data into 4 second events, remove EOG
> > artifacts, and save as a new file including only the good epochs. I've
> > upgraded to the latest nightly yesterday and attempted running this
> script,
> > but it fails to save with this error message:
> >
> > AttributeError: 'Epochs' object has no attribute 'save'
> >
> > Doesn't mne.epochs return an object which should be able to save as a fif
> > file?
> >
> > Here is my full script in case it helps to look at:
> >
> > data_path = '/home/vrupp/data/restMEG/'
> > subj = raw_input('Subject ID:')
> > raw_fname = data_path + subj + '/' + subj + '_rest_raw_sss.fif'
> > event_id, tmin, tmax = 1, 0.0, 4.0
> >
> > # Setup for reading the raw data
> > raw = fiff.Raw(raw_fname)
> >
> > # Epoch data into 4s intervals
> > events = mne.make_fixed_length_events(raw, 1, start=0, stop=None,
> >         duration=4.)
> >
> > # Set up pick list: (MEG-bad channels)
> > exclude = raw.info['bads']
> > picks = fiff.pick_types(raw.info, meg=True, eeg=False, stim=True,
> eog=True,
> >         exclude=exclude)
> >
> > # Read epochs and remove bad epochs
> > epochs_outfile = mne.Epochs(raw, events, event_id, tmin, tmax, proj=True,
> >         picks=picks, baseline=(None, 0), preload=True,
> >         reject=dict(grad=4000e-13, mag=4e-12, eog=150e-6))
> >
> > # Save output file
> > epochs_outfile.save(data_path + subj + '/' + subj +
> '_rest_raw_epoch.fif')
> >
> > Thanks very much for any help.
> >
> >
> > Best wishes,
> >
> > Vincent Rupp
> >
> >
> > On Mon, Dec 17, 2012 at 4:10 PM, Denis-Alexander Engemann
> > <d.engemann at fz-juelich.de> wrote:
> >>
> >> Hi Vincent,
> >>
> >> the code you posted constructs an epochs object from which you get the
> >> data by calling .get_data().
> >> The returned value however is not an epochs object anymore but a regular
> >> numpy array.
> >> For saving your epochs say:
> >>
> >> myepochs.save('subj_rest_raw_epoch.fif')
> >>
> >> However make sure your mne-python version already supports this quite
> >> recent method.
> >> In IPython try myepochs. <TAB> and see whether 'save'  is being
> provided.
> >> In case you don't use the current development master, there will be an
> >> official new relase before christmas.
> >>
> >> I hope this helps.
> >>
> >> Denis
> >>
> >>
> >>
> >>
> >>
> >> On Tue, Dec 18, 2012 at 12:22 AM, Vincent <cloud.ctl at gmail.com> wrote:
> >>>
> >>> Greetings,
> >>>
> >>> When running a script which contains the following line:
> >>>
> >>> <<<
> >>> # Read epochs
> >>> myepochs = mne.Epochs(raw, events, event_id, tmin, tmax, proj=True,
> >>>         picks=picks, baseline=(None, 0), preload=True,
> >>>         reject=dict(grad=4000e-13, mag=4e-12, eog=150e-6))
> >>> outfile = myepochs.get_data()
> >>>
> >>> outfile.save('subj_rest_raw_epoch.fif')
> >>> >>>
> >>>
> >>> I receive this error message:
> >>>
> >>> <<<
> >>> Traceback (most recent call last):
> >>>   File "resting_V3.py", line 55, in <module>
> >>>     outfile.save('subj_rest_raw_epoch.fif')
> >>> AttributeError: 'numpy.ndarray' object has no attribute 'save'
> >>> >>>
> >>>
> >>> Alternatively, I could forgo running epochs.get_data and just save
> >>> directly (epochs.save(...)),
> >>>
> >>> but I run into the same error except it specifies "Epochs" instead of
> >>> "numpy.ndarray" as the object with no 'save' attribute.
> >>>
> >>> Is this error occurring because of a problem with my script, or might I
> >>> have something wrong with my installation of mne-python?
> >>>
> >>> Thank you in advance.
> >>>
> >>> ::vincent
> >>>
> >>>
> >>> _______________________________________________
> >>> Mne_analysis mailing list
> >>> Mne_analysis at nmr.mgh.harvard.edu
> >>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> >>>
> >>>
> >>> The information in this e-mail is intended only for the person to whom
> it
> >>> is
> >>> addressed. If you believe this e-mail was sent to you in error and the
> >>> e-mail
> >>> contains patient information, please contact the Partners Compliance
> >>> HelpLine at
> >>> http://www.partners.org/complianceline . If the e-mail was sent to
> you in
> >>> error
> >>> but does not contain patient information, please contact the sender and
> >>> properly
> >>> dispose of the e-mail.
> >>>
> >>
> >>
> >>
> >>
> >>
> ------------------------------------------------------------------------------------------------
> >>
> >>
> ------------------------------------------------------------------------------------------------
> >> Forschungszentrum Juelich GmbH
> >> 52425 Juelich
> >> Sitz der Gesellschaft: Juelich
> >> Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
> >> Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
> >> Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
> >> Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
> >> Prof. Dr. Sebastian M. Schmidt
> >>
> >>
> ------------------------------------------------------------------------------------------------
> >>
> >>
> ------------------------------------------------------------------------------------------------
> >
> >
> >
> > _______________________________________________
> > Mne_analysis mailing list
> > Mne_analysis at nmr.mgh.harvard.edu
> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> >
> >
> > The information in this e-mail is intended only for the person to whom
> it is
> > addressed. If you believe this e-mail was sent to you in error and the
> > e-mail
> > contains patient information, please contact the Partners Compliance
> > HelpLine at
> > http://www.partners.org/complianceline . If the e-mail was sent to you
> in
> > error
> > but does not contain patient information, please contact the sender and
> > properly
> > dispose of the e-mail.
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20130212/f2763bf6/attachment.html 


More information about the Mne_analysis mailing list