Julia interface to MNE-Python via PythonCall
Author beacon-biosignals
18 Stars
Updated Last
1 Year Ago
Started In
December 2020


Julia interface to MNE-Python via PythonCall

Build Status CodeCov


This package uses PythonCall to make MNE-Python available from within Julia. Unsurprisingly, MNE-Python and its dependencies need to be installed in order for this to work and PyMNE will attempt to install when the package is built: this should happen more or less automatically via CondaPkg. You can configure various options via CondaPkg. MNE-Python is installed via Conda, not via pip.


In the same philosophy as PythonCall, this allows for the transparent use of MNE-Python from within Julia. The major things the package does are wrap the installation of MNE in the package installation and load all the MNE functionality into the module namespace. After that, it's just a Python package accessible via using PyMNE in Julia. The usual conversion rules and behaviors from PythonCall apply. The tests test a few conversion gotchas, especially compared to prior versions of this package, which were based on PyCall.


You need to explicitly convert vectors of strings to a PyList. For instance

data = raw.get_data(picks=["Oz","Cz"])

does not work, whereas

data = raw.get_data(picks=pylist(["Oz","Cz"]))

works. The underlying logic is, that the automatic conversion of ["A","B"]is to a juliacall.VectorValue which behaves similar to a pyList - but is apparently not recognized properly by MNE (a vector of int, surprisingly, works though).

Exposing MNE-Python in Julia

For example, in Python you can access the MNE docs like this:

import mne


With PyMNE, you can do this from within Julia.

using PyMNE


The PythonCall infrastructure also means that Python docstrings are available in Julia:

help?> PyMNE.open_docs
  Python function open_docs.

  Launch a new web browser tab with the MNE documentation.

  kind : str | None
      Can be "api" (default), "tutorials", or "examples".
      The default can be changed by setting the configuration value
  version : str | None
      Can be "stable" (default) or "dev".
      The default can be changed by setting the configuration value

Used By Packages

No packages found.