Skip to main content

Rodent EEG analysis tools

Project description

NeuRodent 🐁

DOI Binder Open In Colab

Presented at USRSE'25!

A Python package for standardizing rodent EEG analysis and figure generation. Various EEG formats are loadable and features are extracted in parallel. Also includes a Snakemake workflow for automated analysis.

Installation

NeuRodent can be installed via pip:

pip install neurodent

For pipeline support, development setup, and other installation options, check out the full installation guide.

Usage

Visit the full documentation for more how-tos and examples: https://josephdong1000.github.io/neurodent

Overview

NeuRodent provides two main analysis workflows:

  1. Windowed Analysis Results (WAR) - Extracts features from continuous EEG data divided into time windows
  2. Spike Analysis Results (SAR) - Analyzes spike-sorted neural data and integrates it with EEG features

The library supports multiple data formats (binary files, SpikeInterface recordings, MNE objects) and includes parallel processing capabilities using Dask for large datasets.

Features Extracted

Linear Features (single values per channel)

  • RMS amplitude - Root mean square of the signal
  • Log RMS amplitude - Logarithm of RMS amplitude
  • Amplitude variance - Variance of signal amplitude
  • Log amplitude variance - Logarithm of amplitude variance
  • PSD total power - Total power spectral density across frequency band
  • Log PSD total power - Logarithm of total PSD power
  • PSD slope - Slope of power spectral density on log-log scale
  • Spike count - Number of detected spikes
  • Log spike count - Logarithm of spike count

Band Features (values per frequency band)

  • PSD band power - Power spectral density for each frequency band
  • Log PSD band power - Logarithm of PSD band power
  • PSD fractional power - PSD band power as fraction of total power
  • Log PSD fractional power - Logarithm of PSD fractional power

Connectivity Features

  • Coherence - Spectral coherence between channels
  • Pearson correlation - Pearson correlation coefficient between channels

Frequency Domain

  • Power Spectral Density - Full power spectral density with frequency coordinates

Frequency Bands

  • Delta: 0.1-4 Hz, Theta: 4-8 Hz, Alpha: 8-13 Hz, Beta: 13-25 Hz, Gamma: 25-40 Hz

Basic Workflow

  1. Load Data: Use LongRecordingOrganizer to load EEG recordings from various formats
  2. Windowed Analysis: Create AnimalOrganizer to compute features across time windows
  3. Spike Analysis: Integrate spike-sorted data from MountainSortAnalyzer
  4. Visualization: Generate plots using ExperimentPlotter and AnimalPlotter

Example Usage

# Load and organize recordings
lro = LongRecordingOrganizer(data_path, mode="bin")
ao = AnimalOrganizer(lro)

# Compute windowed analysis
war = ao.compute_windowed_analysis(features=["rms", "psdband", "cohere"])

# Generate plots
ep = ExperimentPlotter([war])
ep.plot_feature("rms", groupby="genotype")

Advanced Features

  • Flexible Data Loading: NeuRodent uses MNE and SpikeInterface loaders in Python and custom loaders for proprietary formats using MATLAB, including:
    • Neuroscope/Neuralynx (.dat, .eeg)
    • Open Ephys (.continuous)
    • NWB (.nwb) neurophysiology format
    • Binary (.bin) files
  • Bad Channel Detection: Automatic identification of bad channels using Local Outlier Factor
  • Multi-processing: Parallel/distributed processing with Dask for large datasets
  • Data Filtering: Built-in filtering for artifacts and outliers
  • Flexible Grouping: Group analysis by genotype, time of day, recording session, etc.

Snakemake Workflow

A companion Snakemake workflow is provided for building automated NeuRodent analysis pipelines.

The workflow processes multiple animals in parallel through WAR generation, quality filtering, fragment/channel filtering, and statistical analysis with SLURM cluster integration.

To run Snakemake on a specific computing environment, first create a Snakemake profile, then run Snakemake:

# Run the complete workflow
snakemake

Acknowledgements

This project benefited from insights and best practices described in Peter K. G. Williams’s One Good Tutorial.

Citation

If you find NeuRodent useful, please cite our work!

@misc{https://doi.org/10.5281/zenodo.17051374,
  doi = {10.5281/ZENODO.17051374},
  url = {https://zenodo.org/doi/10.5281/zenodo.17051374},
  author = {Dong,  Joseph and Yongtaek Oh,   and Marsh,  Eric},
  title = {josephdong1000/PyEEG: 0.1.1},
  publisher = {Zenodo},
  year = {2025},
  copyright = {MIT License}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neurodent-0.2.4.tar.gz (231.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neurodent-0.2.4-py3-none-any.whl (110.4 kB view details)

Uploaded Python 3

File details

Details for the file neurodent-0.2.4.tar.gz.

File metadata

  • Download URL: neurodent-0.2.4.tar.gz
  • Upload date:
  • Size: 231.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.7

File hashes

Hashes for neurodent-0.2.4.tar.gz
Algorithm Hash digest
SHA256 6111ef763ccf6371a95d32c9567f824915f50e8ddbfafc295a09a7e128ea208f
MD5 062a283f1f47544bf9fe29561230a431
BLAKE2b-256 cff9d72687f0d6bc76e6a7a70c6e91be37b0f64a179eee3aca09de8dc9215b0e

See more details on using hashes here.

File details

Details for the file neurodent-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: neurodent-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 110.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.7

File hashes

Hashes for neurodent-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 79b977ebc88cdb53db7a0cfc535ebd21a6f32d0f2ce9519b3762795baa1cc947
MD5 bcf7654ca1df0fbe42f8464447eca1bd
BLAKE2b-256 b2b7119fd919c39c72ee5557e89c1199d9b246cdd1cecc5d5526b366494865cc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page