[FieldTrip] FiledTrip - Python compatibility?
Tom Holroyd
tomh at kurage.nimh.nih.gov
Fri Apr 21 16:54:56 CEST 2017
You might want to look at this:
--
https://pypi.python.org/pypi/oct2py
Oct2Py allows you to seamlessly call M-files and Octave functions from Python. It manages the Octave session for you, sharing data behind the scenes using MAT files.
--
I've used FieldTrip under Octave in the past (3.0). It doesn't take too much work to get most of the important stuff ported. There's a saying, "Octave is as compatible with Matlab as Matlab is with itself."
Once ported, cluster concerns vanish, just run 128 copies of Octave ... They have a nice IDE now too.
Because it's open source, integration with Python is much better, see oct2py, which also has a cool name.
On Fri, 21 Apr 2017 16:21:38 +0200
Gio Piantoni <gio at gpiantoni.com> wrote:
> I looked into creating a python wrapper around matlab for Fieldtrip.
>
> Mathworks officially supports a Matlab engine for python (pretty
> neat), but the bottleneck for me is that it does not convert matlab
> cells to python objects:
> https://www.mathworks.com/help/matlab/matlab_external/handle-data-returned-from-matlab-to-python.html
> so it's impossible to pass fieldtrip structures to python.
>
> Hopefully they'll get around to support the cell conversion in the near future.
>
> Also I don't remember how sophisticated the memory management in the
> engine is. Projects like python-matlab-bridge usually don't share the
> memory between processes (like rpy2 does), so you end up with
> duplicated objects (which gets unwieldy when working with large EEG
> datasets)
>
> -g
>
>
> > Date: Wed, 19 Apr 2017 16:02:04 +0200
> > From: Robert Oostenveld <r.oostenveld at donders.ru.nl>
> > To: Greydon Gilmore <greydon.gilmore at gmail.com>
> > Cc: FieldTrip discussion list <fieldtrip at science.ru.nl>
> > Subject: Re: [FieldTrip] FiledTrip - Python compatibility?
> > Message-ID: <327AADB7-8D61-4646-9C16-C5AF2B479946 at donders.ru.nl>
> > Content-Type: text/plain; charset="utf-8"
> >
> > Hi Greydon,
> >
> > Let me also CC this to the FieldTrip list, as I know there are more people thinking about this.
> >
> > Although I am using Python for other projects (e.g. EEGsynth <http://www.eegsynth.org/> , we don?t have concrete plans for improving the compatibility between FieldTrip and Python, or to port parts of FieldTrip over to Python. Personally (*) I also feel that Python is not the optimal language and/or data analysis environment for the goals of the FieldTrip project. It would for sure attract more computer scientists and people that like programming, but for (non-technical) cognitive neuroscientists and people that are just able to do scripting I suspect it to become more like an application rather than a toolbox where you can look under the hood and mix it in with ones own code.
> >
> > (*) Other people might feel different of course
> >
> > MNE-Python is of course a project that I am following. The occasional improvements on the FieldTrip side are primarily focussed on making the transition between MNE-Python and FieldTrip more smooth (both ways).
> >
> > A complicating feature in Python is that data handling is different than in MATLAB, where we only use native built-in data structures. Saving data from Python requires a well-established file format (which does not exist) or a stable object definition (which is hard in science). Also for (open access) data sharing I hope that we can do more work on representing analysis results in a format that allows them to be reused in another pipeline. That is for exampel something that we attempted in the MEG section of the human connectome project, where the use cifti files (i.e. nifti-2 with a header extension), text files and - where needed - matlab files in a format that works well with Python.
> >
> > If you have ideas for improving the interoperability, you are welcome to contribute <http://fieldtriptoolbox.org/contribute>.
> >
> > best
> > Robert
> >
> > PS Thanks for the nice remarks about FieldTrip!
> >
> >
> >> On 16 Apr 2017, at 18:17, Greydon Gilmore <greydon.gilmore at gmail.com> wrote:
> >>
> >> Hi Robert,
> >>
> >> I recently stumbled across FieldTrip and I have been in love ever since. I love that I can incorporate the functions into my own scripts.
> >>
> >> I am curious o know if there is any work being done to make FieldTrip compatible with Python?
> >>
> >> Thank you for all the work your team put into FieldTrip, it's streamlined my workflow greatly.
> >>
> >> Greydon
> >>
> >> --
> >> Greydon Gilmore, B.Sc., M.Sc. (Neuroscience)
> >> Ph.D. candidate in Biomedical Engineering
> >> Movement Disorder Centre, University Hospital
> >> University of Western Ontario
> >> 339 Windermere Road, BLL-250
> >> 519-685-8500 ext. 76708
> >> London, Ontario
> >> Canada, N6A 5A5
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
--
Dr. Tom
--
I would dance and be merry,
Life would be a ding-a-derry,
If I only had a brain.
-- The Scarecrow
More information about the fieldtrip
mailing list