█

AI/TLDR

Buy me a coffee
Buy me a coffee

NeuroKit2

Process neurophysiological signals and extract biomarkers in Python

Biosignals & Time-Series MLOpen source
Language
Python
$pip install neurokit2
IN SHORT

What is NeuroKit2?

NeuroKit2 is a Python toolbox for processing neurophysiological signals. It handles many common recording types, including ECG (cardiac activity), PPG (blood volume pulse), EDA (skin conductance), EMG (muscle activity), RSP (respiration), EOG (eye movements), and EEG (brain activity). It sits in the Biosignals & Time-Series ML category of the Science & Biomedical AI tools and is open-source, written in Python.

Overview

NeuroKit2 is a Python toolbox for processing neurophysiological signals. It handles many common recording types, including ECG (cardiac activity), PPG (blood volume pulse), EDA (skin conductance), EMG (muscle activity), RSP (respiration), EOG (eye movements), and EEG (brain activity).

The library turns raw signals into cleaned data and extracted features with a small amount of code. It covers filtering and detrending, peak detection, ECG waveform delineation, heart rate variability indices in the time, frequency, and nonlinear domains, complexity and entropy measures, and both event-related and interval-related analysis.

Because it produces structured numeric features from raw recordings, NeuroKit2 is a practical front end for digital-biomarker and machine-learning pipelines: you use it to compute the physiological measures, then feed those features into your own models or statistics.

What it does

  • Processes ECG, PPG, EDA, EMG, RSP, EOG, and EEG signals from one package
  • Computes heart rate variability indices across time-domain, frequency-domain, and nonlinear measures
  • Delineates the ECG waveform, identifying P, Q, S, and T waves and the QRS complex
  • Provides filtering, detrending, and peak-detection routines for cleaning raw signals
  • Includes complexity analysis such as entropy calculations and fractal dimensions
  • Supports both event-related analysis (stimulus-locked epochs) and interval-related analysis of longer recordings

Getting started

Install NeuroKit2 with pip, then process a batch of signals and extract features in a couple of lines.

Install NeuroKit2

Install the package from PyPI with pip.

bashbash
pip install neurokit2

Process biosignals

Import NeuroKit2 and run several signals through the processing pipeline at once, passing the sampling rate of your recording.

pythonpython
import neurokit2 as nk

processed_data, info = nk.bio_process(
    ecg=data["ECG"],
    rsp=data["RSP"],
    eda=data["EDA"],
    sampling_rate=100,
)

Extract features

Analyze the processed data to compute the extracted features and biomarkers, ready to feed into your own models or statistics.

pythonpython
results = nk.bio_analyze(processed_data, sampling_rate=100)

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Compute heart rate variability and other cardiac biomarkers from ECG or PPG recordings
  • Extract physiological features to feed into digital-biomarker or machine-learning pipelines
  • Clean and delineate raw biosignals before downstream time-series modelling
  • Run event-related or interval-related analysis for physiological research studies

How NeuroKit2 compares

NeuroKit2 alongside other open-source biosignals & time-series ml tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
sktime★ 10.1kUnified Python framework for machine learning with time series — classification, forecasting, and transformation.
Darts★ 9.6kPython library for user-friendly time-series forecasting and anomaly detection, from classical models to deep learning.
tsai★ 6.2kDeep-learning library for time series and sequences, built on PyTorch and fastai.
MNE-Python★ 3.6kOpen-source Python package for exploring, analyzing, and modeling MEG, EEG, and other neurophysiological time-series data.
NeuroKit2★ 2.4kProcess neurophysiological signals and extract biomarkers in Python