[Mne_analysis] MNE-Python and R compatibility

Dan McCloy dan.mccloy at gmail.com
Tue Aug 6 16:46:00 EDT 2019
Search archives:

        External Email - Use Caution        

Hi Bianca,
To expand on Denis's answer a little:

Many MNE-Python objects (Raw, Epochs, Evoked, SourceEstimate) have a
to_data_frame() method that will create a Pandas DataFrame in memory, which
you can then save to many formats including CSV.  From what you've told us,
that might be an easier way than using FIF as an intermediate format.
Looping over subjects in Python, you could write a separate CSV for each
subject and the combine them in R, or you can combine the pandas DataFrames
within Python before writing one big CSV. Or (as Denis says) you can write
the loop within R and use MNE-R to do whatever preprocessing steps you
need, and then in theory you don't even need to write intermediate files
(though you might want to anyway).
-- dan

Daniel McCloy
http://dan.mccloy.info/
Research Engineer
Institute for Learning and Brain Sciences
University of Washington



On Tue, Aug 6, 2019 at 12:11 PM Denis A. Engemann <
denis-alexander.engemann at inria.fr> wrote:

>         External Email - Use Caution
>
> Hi Bianca,
>
> Hi Bianca,
>
> Did you have a look at  MNE-R? https://mne.tools/mne-r/index.html
> It is a small library that facilitates calling MNE-Python through R and
> making data frames from fif-compatible data structures.
>
> For what concerns your question, the fif file is not meant to handle data
> from multiple subjects.
> You would use other formats for that.
> In Python we usually  do things in memory, making big matrices from
> multiple subjects.
> For getting data for all subjects, you would need to write separate files
> and combine them in R or make a big data frame.
>
> I  hope that helps.
> Denis
>
>
> > On Aug 6, 2019, at 9:00 PM, Bianca Islas <biancaisla1 at gmail.com> wrote:
> >
> >         External Email - Use Caution
> >
> >
> > MNE Analysis Team,
> >
> > Let me first begin by stating what our lab is primarily interested in,
> and currently doing. We do psychophys studies directly related to
> startle-blink response and postauricular response.  We also work with skin
> conductance, corrugator, zygomatic (EMG), EOG, ECG, and EEG.  Currently, we
> run Neuroscan, and use the resulting CNT files to do statistical analysis
> on all study subjects with SPSS and R.  We have been in works this summer
> to complete a script through Jupyter notebooks that will process our raw
> CNT files into processed FIF files, and this is where the questions begin.
> >
> > How large can a FIF file be?  If a FIF file has a limitation on its
> size, how do we run statistical analysis on multiple files for the same
> participant?  Furthermore, how do we run analysis on multiple subjects and
> multiple files? Will a FIF file be compatible with statistical analysis?
> The real issue that our lab sees is how will be able to create component
> scores that can be output to other programs for statistical analysis,
> primarily R.  There's a hint about how to do this at the start of the
> scripts on this page after the from import statements:
> >
> https://martinos.org/mne/stable/auto_examples/connectivity/plot_mne_inverse_envelope_correlation.html#sphx-glr-auto-examples-connectivity-plot-mne-inverse-envelope-correlation-py
> >
> > However, maybe we require further explanation as we are not interested
> necessarily in one subject at a time rather ALL subjects at a time.
> >
> > Thank you in advance for any insight that you may be able to provide on
> these matters and of course your time.
> >
> > Best,
> > UNLV PEPLab
> > Bianca Islas
> > Research Assistant
> > _______________________________________________
> > Mne_analysis mailing list
> > Mne_analysis at nmr.mgh.harvard.edu
> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190806/192066bf/attachment-0001.html 


More information about the Mne_analysis mailing list