emd.cycles.phase_align#

emd.cycles.phase_align(ip, x, cycles=None, npoints=48, interp_kind='linear', min_len=1, mode='cycle')[source]#

Align a vector of observations to a template phase time-course.

This implements the phase alignment method introduced in [1]. Individual cycles must be longer than 2 samples to be phase-aligned - if a cycle cannot be phase aligned it’s output will be set to np.nan.

Parameters:
ipndarray

Input array of Instantaneous Phase values to base alignment on

xndarray

Input array of observed values to phase align

cyclesndarray (optional)

Optional set of cycles within IP to use (Default value = None)

npointsint

Number of points in the phase cycle to align to (Default = 48)

interp_kind{‘linear’,’nearest’,’zero’,’slinear’, ‘quadratic’,’cubic’,’previous’, ‘next’}

Type of interpolation to perform. Argument is passed onto scipy.interpolate.interp1d. (Default = ‘linear’)

min_lenint

Minimum length in samples for a cycle to be phase aligned. Shorter cycles will be returned as nans.

mode{‘cycle’, ‘augmented’}

Whether to phase align a standard ‘cycle’ or an ‘augmented’ cycle including a 5th quadrant.

Returns:
ndarray

array containing the phase aligned observations

References

[1]

Andrew J. Quinn, Vitor Lopes-dos-Santos, Norden Huang, Wei-Kuang Liang, Chi-Hung Juan, Jia-Rong Yeh, Anna C. Nobre, David Dupret, & Mark W. Woolrich (2021). Within-cycle instantaneous frequency profiles report oscillatory waveform dynamics. bioRxiv, 2021.04.12.439547. https://doi.org/10.1101/2021.04.12.439547