# Optimizing real-time phase detection in diverse rhythmic biological signals for phase-specific neurostimulation

**Authors:** Mengzhan Liufu, Zachary M Leveroni, Sameera Shridhar, Nan Zhou, Jai Y Yu

PMC · DOI: 10.1088/1741-2552/ae10e1 · 2025-10-24

## TL;DR

This study improves real-time phase detection in brain signals to better time neurostimulation, finding that matching the data window to the oscillation cycle boosts accuracy.

## Contribution

The study identifies optimal data window lengths for FFT-based phase detection algorithms tailored to specific oscillation frequencies in biological signals.

## Key findings

- Signal amplitude and frequency variations strongly influence phase detection algorithm performance.
- Optimal data window length corresponds to the oscillation period (e.g., 150 ms for hippocampal theta oscillations).
- In vivo validation in rats confirmed that one-cycle window length yields best phase estimation performance.

## Abstract

Objective. Closed-loop, phase-specific neurostimulation is a powerful method to modulate ongoing brain activity for clinical and research applications. Phase-specific stimulation relies on estimating the phase of an ongoing oscillation in real time and issuing a control command at a target phase. Phase detection algorithms based on the fast Fourier transform (FFT) are widely used due to their computational efficiency and robustness. However, it is unclear how algorithm performance depends on the spectral properties of the input signal and how algorithm parameters can be optimized. Approach. We evaluated the in silico performance of three phase detection algorithms [Endpoint-corrected Hilbert transform (ecHT), Hilbert transform (HT), and phase mapping (PM)] on three real-world biological signals with distinct spectral properties (theta oscillations from rodent hippocampal local field potential, alpha oscillations from human electroencephalogram (EEG), and hand movement kinematics from essential tremor patients) to identify the optimal model and parameters. We then validated the performance of an algorithm for estimating theta phase in real-time using rats implanted with electrodes in the hippocampus. Results. First, we found that signal amplitude and frequency variations strongly influence algorithm performance. Frequency-specific signal-to-noise ratio was positively correlated with performance (mean R2 = 0.42 across metrics), while amplitude and frequency variability were negatively correlated (mean R2 = 0.50 across metrics). Second, we showed that the length of the data window used for phase estimation is the key parameter for optimal performance of FFT-based algorithms, where the optimal data window length corresponds to the period of the oscillation (∼150 ms for hippocampal theta oscillations, ∼100 ms for human EEG alpha, and ∼125 ms for essential tremor kinematics). We validated this finding in vivo by estimating the phase of theta oscillations from the hippocampus of freely behaving rats, where a data window length corresponding to one theta cycle yielded the best performance across all metrics compared with shorter or longer window lengths. Significance. Our findings clarify the relationship between signal properties and algorithm performance and provide a convenient method for optimizing FFT-based phase detection algorithms. We show that a data window length corresponding to one cycle of an oscillation can lead to improved performance.

## Linked entities

- **Diseases:** essential tremor (MONDO:0003233)
- **Species:** Mus musculus (taxon 10090)

## Full-text entities

- **Diseases:** essential tremor (MESH:D020329)
- **Species:** Rattus norvegicus (brown rat, species) [taxon 10116], Homo sapiens (human, species) [taxon 9606]

## Figures

33 figures with captions in the complete paper: https://tomesphere.com/paper/PMC12551589/full.md

---
Source: https://tomesphere.com/paper/PMC12551589