Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

OHBA Software Library: Electrophysiology Toolbox

PyPI version Documentation License Paper

osl-ephys is a Python toolbox for analysing electrophysiological data (MEG, EEG and OPM) from the raw recording to parcellated source-space time courses. It builds on MNE-Python and adds the pieces an M/EEG pipeline needs around it:

  • Preprocessing driven by a YAML config: filtering, bad segment and bad channel detection, ICA artefact rejection, epoching, with the same config run on one session or batched over a dataset in parallel.
  • MaxFilter wrapper for Elekta/MEGIN data (SSS and tSSS), with multistage and chunked runs.
  • Coregistration and source reconstruction with RHINO: surface extraction from a structural MRI with FSL, coregistration to the head shape, forward modelling, LCMV beamforming and volumetric minimum norm.
  • Parcellation of source-space data into parcel time courses, with spatial leakage correction and sign flipping across sessions.
  • Quality control: an HTML report across sessions with the plots and numbers of every step.
  • Sensor-level statistics: GLM-Spectrum and GLM-Epochs with permutation testing.

For a full description of the toolbox, see the documentation.

Example

One config names the steps of each stage, and run_batch runs it on a set of sessions in parallel, writing a log per session and a QC report:

from osl_ephys.pipeline import run_batch

config = """
preproc:
  - filter: {l_freq: 1, h_freq: 45}
  - resample: {sfreq: 250}
  - bad_segments: {picks: mag}
  - bad_channels: {picks: mag}
  - ica_label: {picks: mag}
coreg:
  - extract_surfaces: {include_nose: false}
  - extract_fiducials_and_headshape: {}
  - coregister: {use_nose: false}
source_recon:
  - forward_model: {model: Single Layer}
  - beamform: {chantypes: mag, rank: {mag: 60}}
parcellation:
  - parcellate: {parcellation_file: atlas-Glasser_nparc-52_space-MNI_res-8x8x8.nii.gz}
group:
  - sign_flip: {}
"""

sessions = [
    {"id": "sub-01", "subject": "sub-01", "raw_file": "raw/sub-01.fif", "smri_file": "smri/sub-01.nii.gz"},
    {"id": "sub-02", "subject": "sub-02", "raw_file": "raw/sub-02.fif", "smri_file": "smri/sub-02.nii.gz"},
]

run_batch(config, sessions, "derivatives", n_workers=2)

The same run from the terminal, with the sessions in a CSV file: osl-ephys run config.yml sessions.csv derivatives --n-workers 2. The parcel time courses end up in derivatives/<id>/, the report in derivatives/qc/report.html.

Installation

See the installation page of the documentation.

Documentation

The read the docs page is updated automatically whenever there is a new commit on the main branch.

The documentation is included as docstrings in the source code, and the doc/ directory contains .rst files for installation, tutorials and the FAQ. To build the documentation locally:

cd osl-ephys
pip install -r doc/requirements.txt
sphinx-build -b html doc build

The local build can be found in build/index.html.

Releases

To release a new version:

  1. Check the latest commit on main has compiled successfully on readthedocs.

  2. Create a new release using the 'Create a new release' link on the right of the GitHub repo webpage:

    • Set the tag to the new version number with a v prefix (e.g. v3.0.0).
    • Write the release notes.
    • Select 'Latest' for the release label and click 'Publish release'.
  3. Publishing the release triggers the release.yml GitHub Actions workflow, which builds the package and uploads it to PyPI. Check it succeeded under the Actions tab of the GitHub repo.

Citation

If you find this toolbox useful, please cite the paper:

van Es, M. W. J., Gohil, C., Quinn, A. J., & Woolrich, M. W. (2025). osl-ephys: a Python toolbox for the analysis of electrophysiology data. Frontiers in Neuroscience, 19, 1522675.

osl-ephys builds on MNE-Python, and the source reconstruction on FSL. Please cite those packages as well when you use them.

Metadata

Release files for osl-ephys 3.0.0rc1

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

Source distribution (sdist)

Source distribution for osl-ephys 3.0.0rc1
File Size Uploaded Provenance Actions
osl_ephys-3.0.0rc1.tar.gz 834.9 kB With provenance Details for osl_ephys-3.0.0rc1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for osl-ephys 3.0.0rc1
File Interpreter ABI Platform Actions
osl_ephys-3.0.0rc1-py3-none-any.whl Python 3 none any Details for osl_ephys-3.0.0rc1-py3-none-any.whl

Total release size: 1.3 MB

Release files / osl_ephys-3.0.0rc1.tar.gz

Download URL osl_ephys-3.0.0rc1.tar.gz
Size 834.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1bd0d1884a506479cfc0464e799aedc3ac749708114f40acb00cfce09fac6ea3
BLAKE2b-256 checksum
How to use checksums
54d5fe219887071655e808308d8b1005a46d33ff1600e274cc3089dd03f0f39f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / osl_ephys-3.0.0rc1-py3-none-any.whl

Download URL osl_ephys-3.0.0rc1-py3-none-any.whl
Size 426.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4df475c992df67c950c31929929fefaf1494f5f77e4ac15bdbfcb5a998639ca
BLAKE2b-256 checksum
How to use checksums
783bc1afb6befd054e68f00dd4ce42c744cf1c780c687df866f1c21265b3627e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for osl-ephys 3.0.0rc1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for osl_ephys-3.0.0rc1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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