Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

petteriTeikari/R-PLR

Repository files navigation

R-PLR

R functions for processing pupillary light reflex (PLR) recordings -- artifact removal, feature extraction, and batch analysis.

%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#E8F4FD', 'primaryBorderColor': '#7BA7C9', 'primaryTextColor': '#2C3E50', 'secondaryColor': '#FDF2E9', 'secondaryBorderColor': '#D4A574', 'secondaryTextColor': '#2C3E50', 'tertiaryColor': '#EAFAF1', 'tertiaryBorderColor': '#82C9A1', 'tertiaryTextColor': '#2C3E50', 'lineColor': '#5D6D7E', 'textColor': '#2C3E50', 'background': '#FFFFFF', 'mainBkg': '#E8F4FD', 'nodeBorder': '#7BA7C9', 'clusterBkg': '#F8F9FA', 'clusterBorder': '#BDC3C7', 'fontSize': '14px'}}}%%
graph LR
    A[Raw PLR Recording]:::input --> B[Artifact Removal]
    B --> C[Baseline Correction]
    C --> D[Feature Extraction]
    D --> E[Batch Results]:::output

    classDef input fill:#FDF2E9,stroke:#D4A574
    classDef output fill:#EAFAF1,stroke:#82C9A1
Loading

Overview

R-PLR provides a modular pipeline for cleaning, processing, and analyzing pupillary light reflex recordings. The toolkit handles the full workflow from raw pupillometric data through artifact removal, signal reconstruction, and statistical analysis, with support for batch processing of multi-subject datasets.

Pupillometry is widely used in neuroscience and ophthalmology to assess autonomic nervous system function and non-visual photoreception. This library automates the tedious preprocessing steps so researchers can focus on their experimental questions.

Key Features

  • Artifact removal -- detection and removal of blink artifacts, signal dropouts, and recording noise
  • Signal reconstruction -- imputation of missing values and resampling to uniform time bases
  • Baseline correction -- normalization relative to pre-stimulus baseline periods
  • Feature extraction -- automated extraction of PLR parameters (latency, amplitude, constriction velocity, PIPR)
  • Statistical analysis -- group-level density plots, box plots, and averaged PLR traces
  • EMD decomposition -- Empirical Mode Decomposition for data augmentation and denoising
  • Shiny apps -- interactive web applications for visual inspection and parameter tuning
  • Batch processing -- process entire datasets with a single function call

Quick Start

git clone --recurse-submodules https://github.com/petteriTeikari/R-PLR

Open clean_and_reconstruct_all_PLR.R in RStudio to run the full preprocessing pipeline, or explore individual modules:

# Process a single PLR recording
source("PLR_artifacts/remove_artifacts.R")
source("PLR_reconstruction/reconstruct_signal.R")
source("PLR_analysis/extract_features.R")

Project Structure

R-PLR/
├── PLR_artifacts/        # Artifact detection and removal
├── PLR_reconstruction/   # Signal imputation and resampling
├── PLR_analysis/         # Feature extraction from clean signals
├── PLR_stats/            # Statistical analysis and group comparisons
├── PLR_IO/               # Data import/export utilities
├── PLR_video/            # Video pupillometry support
├── plot/                 # Visualization functions
├── config/               # Processing parameter configuration
├── scripts/              # Batch processing scripts
├── demos/                # Example workflows
├── Apps_Shiny/           # Interactive Shiny applications
├── test_data/            # Sample datasets for testing
└── documentation/        # Additional documentation

Citation

If you use this software in your research, please cite:

@software{teikari2018rplr,
  author = {Teikari, Petteri},
  title  = {{R-PLR}: {R} Functions for Processing Pupillary Light Reflex Recordings},
  year   = {2018},
  url    = {https://github.com/petteriTeikari/R-PLR}
}

License

MIT License. See LICENSE for details.

About

R functions for processing pupillary light reflex (PLR) recordings — artifact removal, feature extraction, and batch analysis

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages