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 more info, 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.3.tar.gz (230.3 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.3-py3-none-any.whl (110.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for neurodent-0.2.3.tar.gz
Algorithm Hash digest
SHA256 b4970d8137ec66757e3610fc4ab8a6dcd4d910f76d68d2300c3588e4a74ca876
MD5 e8cfb757c22a5919bb1e4c0ed78c68c8
BLAKE2b-256 54a176163f7f4c15a8ccf39c9423f3c2811ab0499278e17d2e8d15259ade8c7c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for neurodent-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 74b69d7784b5d0ea64ad2cf198ca49fb594539f710b706fea1ce54eb5cf74f0d
MD5 110e1a46b0d72d6fbbed84711e0da47f
BLAKE2b-256 9df45c027a48b862203ab92d4bdea5f9d5796d4ceb0100a57d344d579d55f548

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