elephant.phase_analysis.phase_difference

elephant.phase_analysis.phase_difference(alpha, beta)[source]

Calculates the difference between a pair of phases.

The output is in range from -\pi to \pi.

Parameters:
alphanp.ndarray

Phases in radians.

betanp.ndarray

Phases in radians.

Returns:
phase_diffnp.ndarray

Difference between phases alpha and beta. Range: [-\pi, \pi]

Notes

The usage of np.arctan2 ensures that the range of the phase difference is [-\pi, \pi] and is located in the correct quadrant.