gastropy.find_cycle_edges#
- gastropy.find_cycle_edges(phase)[source]#
Detect cycle boundaries from a wrapped phase time series.
Finds indices where the phase wraps from +pi back to -pi, indicating the start of a new gastric cycle.
- Parameters:
phase (array_like) – Instantaneous phase in radians (-pi to pi).
- Returns:
edges – Sample indices of cycle boundaries (phase wrap points). Each edge marks the first sample of a new cycle.
- Return type:
np.ndarray
Examples
>>> import numpy as np >>> from gastropy.signal import find_cycle_edges >>> phase = np.linspace(-np.pi, np.pi, 100) >>> phase = np.tile(phase, 5) # 5 cycles >>> edges = find_cycle_edges(phase)