PhysioCore PhysioCore logo

Core Data Structures for Physiological Signal Analysis

PhysioCore provides the foundational S4 class system for the PhysioExperiment ecosystem. It defines the PhysioExperiment and PhysioEvents classes, extending Bioconductor's SummarizedExperiment to support multi-modal physiological signal data including EEG, EMG, ECG, IMU, and motion capture. With 45 exported functions, PhysioCore delivers lightweight but comprehensive infrastructure for channel management, event handling, array operations, and core signal accessors.

PhysioCore is now a compatibility package. The data model it used to implement -- the PhysioExperiment class and the containers for multiple streams, repeated sessions and cohorts -- lives in the PhysioExperiment package. This package re-exports that interface unchanged, so library(PhysioCore), PhysioCore::fn() and S4 objects saved while the classes were defined here all keep working. New code should depend on PhysioExperiment directly.

Installation

You can install PhysioCore from r-universe:

# the containers build on Bioconductor, so its repositories are needed too
install.packages("BiocManager", repos = "https://cloud.r-project.org")
install.packages("PhysioCore",
  repos = c("https://x-biosignal.r-universe.dev", BiocManager::repositories()))

Or install the development version from GitHub:

# install.packages("remotes", repos = "https://cloud.r-project.org")
remotes::install_github("x-biosignal/PhysioCore")

Quick Start

library(PhysioCore)

# Create a PhysioExperiment from a signal matrix (time x channels)
signal_matrix <- matrix(rnorm(1000 * 4), nrow = 1000, ncol = 4)

pe <- PhysioExperiment(
  assays = list(raw = signal_matrix),
  samplingRate = 250
)

# Access core properties
samplingRate(pe)   # 250
nChannels(pe)      # 4
duration(pe)       # 4.0 (seconds)
timeIndex(pe)      # time vector in seconds

# Channels are auto-named Ch1..Chn; assign montage labels and types, then select
channelNames(pe) <- c("Fz", "Cz", "Pz", "Oz")
pe <- setChannelTypes(pe, types = "eeg")
pe_subset <- pickChannels(pe, c("Fz", "Cz"))
channelInfo(pe)

# Add events (e.g., stimulus markers) and read them back
pe <- addEvents(pe, onset = c(0.5, 1.5, 2.5), duration = 0.1, type = "stimulus")
getEvents(pe)
nEvents(pe)        # 3

# Summarize the object
summary(pe)

Features

PhysioExperiment and PhysioEvents S4 Classes

The PhysioExperiment class extends SummarizedExperiment with a samplingRate slot, supporting both 2D (time x channels) and 3D (time x channels x samples) assay layouts. The PhysioEvents class provides a structured container for experimental event markers with onset times, durations, and labels.

Channel Management

A full suite of functions for working with signal channels:

Event Management

Flexible event handling for experimental paradigms:

Core Accessors

Essential property accessors for physiological signal objects:

Array Operations

Standard R operations adapted for physiological signal semantics:

NA Handling Utilities

Robust missing data management for real-world recordings:

S4 Methods

Standard R generic methods with signal-aware implementations:

Dependencies

PhysioExperiment Ecosystem

PhysioCore is the foundation of the PhysioExperiment ecosystem, a suite of R packages for multi-modal physiological signal analysis:

Package Description
PhysioCore Core data structures and accessors
PhysioIO File I/O (EDF, HDF5, BIDS, CSV, MAT)
PhysioPreprocess Preprocessing (filters, ICA, resampling)
PhysioAnalysis Analysis and visualization

Visit the r-universe page to browse all available packages.

License

MIT License. See LICENSE for details.

Author

Yusuke Matsui

Governance & support

Part of the Physio ecosystem. Community and policy documents live in the umbrella repository: