gastropy.instantaneous_phase

gastropy.instantaneous_phase#

gastropy.instantaneous_phase(data)[source]#

Compute instantaneous phase via the Hilbert transform.

Returns the analytic signal (complex) and its phase angle.

Parameters:

data (array_like) – Input signal (1D array, typically bandpass-filtered).

Returns:

  • phase (np.ndarray) – Instantaneous phase in radians (-pi to pi).

  • analytic (np.ndarray) – Complex analytic signal from the Hilbert transform.

Examples

>>> import numpy as np
>>> from gastropy.signal import instantaneous_phase
>>> t = np.arange(0, 60, 0.1)
>>> sig = np.sin(2 * np.pi * 0.05 * t)
>>> phase, analytic = instantaneous_phase(sig)