Skip to main content

MNEXTEND

This package provides additional functionality for working with MNE-Python, the most popular Python package for processing electrophysiological data (EEG, MEG, ...).

Features

Reading additional file formats

MNEXTEND provides readers for the following file formats that are not natively supported by MNE-Python:

  • XDF (Extensible Data Format)
  • MAT (MATLAB)
  • NPY (NumPy)

In addition, MNEXTEND adds the following readers from third-party packages:

Together with the native MNE-Python readers, read_raw() and read_epochs() provide a unified interface for reading electrophysiological data from a wide range of file formats, so all you have to do is:

from mnextend import read_raw, read_epochs

raw = read_raw("my_data-raw.xdf", stream_ids=[1, 2, 3])
epochs = read_epochs("my_data-epochs.fif.gz")

Inspecting files before reading

Some formats require inspecting file contents before calling read_raw(), e.g. to let a user pick which stream(s) or participant(s) to load:

from mnextend.io.bvrf import read_bvrf_header
from mnextend.io.xdf import resolve_streams

streams = resolve_streams("my_data.xdf")
header = read_bvrf_header("my_data.bvrh")

Writing raw data

Writing raw data is supported via write_raw(), which does not implement any new file formats, but provides a unified interface for writing raw data to the file formats that are natively supported by MNE-Python:

from mnextend import write_raw

write_raw("my_data-raw.fif.gz", raw)

ICLabel classification

MNEXTEND includes ICLabel, a pre-trained classifier that labels ICA components as one of seven types: brain, muscle, eye, heart, line noise, channel noise, or other. In contrast to MNE-ICALabel, the classifier is implemented in pure NumPy and does not depend on ONNX Runtime.

run_iclabel() takes a fitted ICA object and the corresponding Raw or Epochs instance (which must have a montage set), and returns an array of class probabilities:

from mnextend import plot_ica_components, run_iclabel

probs = run_iclabel(raw, ica)
figs = plot_ica_components(raw, ica, probs)

Adaptive line-noise removal

Inspired by Raw.notch_filter(method="spectrum_fit") in MNE-Python, this implementation removes known line frequencies from a preloaded Raw object much faster (roughly 50× in our tests). It fits sinusoids in overlapping windows, accommodating gradual amplitude and phase changes without suppressing nearby frequencies.

from mnextend import remove_line_noise

raw.load_data()
remove_line_noise(
    raw,
    line_freq=50,
    picks="eeg",
    include_harmonics=True,
    window_length=10,
    overlap=0.5,
)

Metadata

Release files for mnextend 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mnextend 0.3.0
File Size Uploaded
mnextend-0.3.0.tar.gz 10.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for mnextend 0.3.0
File Interpreter ABI Platform
mnextend-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.6 MB

Release files / mnextend-0.3.0.tar.gz

Download URL mnextend-0.3.0.tar.gz
Size 10.8 MB
Tags Source
SHA-256 checksum
How to use checksums
0432a38b575c8787526f18d2d1eff437917963e08d5267b3fa522683f490f749
BLAKE2b-256 checksum
How to use checksums
ec4eaefa0797fadae25a50e170d199026b704270d31b1074a7f8d928c2ab4eaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mnextend-0.3.0-py3-none-any.whl

Download URL mnextend-0.3.0-py3-none-any.whl
Size 10.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
071e7d5ea10b81e3f08d1f1feb91fb0cf2edf1b6696a0fa738bd29006faefb73
BLAKE2b-256 checksum
How to use checksums
e4d3f5bee60e64e979d785cdd63af617d11da6e3e080fce724bf237c15bb276d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.4.0

2 release files

This release

0.3.0 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page