Skip to content

Rudnik-Ilia/MNE-Poly5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mne-poly5

Python 3.10+ License: MIT

TMSi Poly5 file reader for MNE-Python.

A bridge between TMSi Poly5 biosignal files and the MNE-Python ecosystem for EEG/MEG analysis.

Features

  • Read TMSi Poly5 binary files (version 2.03)
  • Convert to MNE Raw objects for seamless integration
  • Support for multiple formats: Poly5, EDF, BrainVision, CSV
  • Type hints and modern Python practices
  • Progress callbacks for large file loading

Installation

# Using uv (recommended)
uv add mne-poly5

# Using pip
pip install mne-poly5

# Development install
uv sync --dev

Quick Start

Read a Poly5 file

from mne_poly5 import read_raw_poly5

# Load Poly5 file as MNE Raw object
raw = read_raw_poly5("recording.Poly5")

# Use standard MNE operations
raw.filter(1, 40)
raw.plot()

Use the unified FileLoader

from mne_poly5 import FileLoader

# Load any supported format
loader = FileLoader("data.vhdr")
raw = loader.raw

# For BrainVision files, get events
events, event_id = loader.get_events()

Low-level Poly5Reader

from mne_poly5 import Poly5Reader

# Direct access to Poly5 data
reader = Poly5Reader("recording.Poly5")

print(f"Channels: {reader.num_channels}")
print(f"Sample rate: {reader.sample_rate} Hz")
print(f"Duration: {reader.num_samples / reader.sample_rate:.1f} s")

# Access raw numpy array
data = reader.samples  # Shape: (channels, samples)

Progress callback for large files

from mne_poly5 import Poly5Reader

def show_progress(progress: float) -> None:
    print(f"\rLoading: {progress * 100:.1f}%", end="")

reader = Poly5Reader("large_file.Poly5", progress_callback=show_progress)

Supported Formats

Format Extension Reader
TMSi Poly5 .Poly5 Native
European Data Format .edf MNE
BrainVision .vhdr MNE
CSV .csv Pandas + MNE

API Reference

read_raw_poly5(filename, preload=True, verbose=None)

Read a Poly5 file and return an MNE Raw object.

Poly5Reader(filename, preload=True, progress_callback=None)

Low-level Poly5 binary file reader.

FileLoader(filename=None, verbose=None)

Unified loader for multiple biosignal formats.

Development

# Clone the repository
git clone https://github.com/yourusername/mne-poly5.git
cd mne-poly5

# Install with dev dependencies
uv sync --dev

# Run tests
uv run pytest

# Type checking
uv run mypy src/

# Linting
uv run ruff check src/

License

MIT License - see LICENSE for details.

Acknowledgments

  • MNE-Python for the excellent neurophysiology analysis framework
  • TMSi for the Poly5 format specification

About

A Poly5 file reader for MNE-Python — Read biosignal data from TMSi devices into the MNE ecosystem

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages