
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
This repository hosts the code for an alternative backend for plotting 2D-Data with MNE-Python.
The backend is based on pyqtgraph which uses Qt's Graphics View Framework for the plotting. Development started as a 2021's Google Summer of Code Project.
Install full MNE-Python version 1.0 or greater with the instructions provided here or install minimal MNE-Python with
pip install "mne>=1.0" matplotlib mne-qt-browser
or
conda install -c conda-forge mne-base matplotlib mne-qt-browser
Refer to the MNE-Python documentation for updating MNE-Python. To update this package, do:
pip install -U mne-qt-browser
To update this package to the development version, do:
pip install -U --no-deps https://github.com/mne-tools/mne-qt-browser/archive/refs/heads/main.zip
The backend supports plotting for the following MNE-Python methods:
mne.io.Raw.plot()
mne.Epochs.plot()
mne.preprocessing.ICA.plot_sources(raw)
mne.preprocessing.ICA.plot_sources(epochs)
In the following example, we'll read M/EEG raw data from the MNE sample
dataset
and plot it using the qt
-backend.
(For mne-version >= 1.0 the qt
-backend will be the default)
from pathlib import Path
import mne
sample_dir = mne.datasets.sample.data_path()
raw_path = Path(sample_dir) / 'MEG' / 'sample' / 'sample_audvis_raw.fif'
raw = mne.io.read_raw(raw_path)
mne.viz.set_browser_backend('qt') # Enable mne-qt-browser backend if mne < 1.0
raw.plot(block=True)
If the plot is not showing, search for solutions in the troubleshooting section below.
This will use the mne-qt-browser
for the current Python session. If you
want to make this change permanent, so you don't have to use the
set_browser_backend()
each time after restarting Python, run the following
line to modify your MNE configuration file:
import mne
mne.set_config('MNE_BROWSER_BACKEND', 'qt')
If you are running a script containing raw.plot()
like
python example_script.py
the plot will not stay open when the script is done.
To solve this either change raw.plot()
to raw.plot(block=True)
or run the script with the interactive flag
python -i example_script.py
If the integration of the Qt event loop is not activated for IPython, a plot with raw.plot()
will freeze.
Do avoid that either change raw.plot()
to raw.plot(block=True)
or activate the integration of the event loop with
%gui qt5
Please report bugs and feature requests in the issues of this repository.
You can run a benchmark locally with:
pytest -m benchmark mne_qt_browser
To run the PyQtGraph tests you have to run:
pytest mne_qt_browser/tests/test_pg_specific.py
Additionally, clone mne-python, and then run:
pytest -m pgtest ../mne-python/mne/viz/tests
If you do not have OpenGL installed, this will currently raise errors, and
you'll need to add this line to mne/conftest.py
after the error::
line:
ignore:.*PyOpenGL was not found.*:RuntimeWarning
FAQs
A new backend based on pyqtgraph for the 2D-Data-Browser in MNE-Python
We found that mne-qt-browser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.