Measuring phase synchronization

Two signals can be fully synchronized, not synchronized, or somewhere in between. We usually measure phase synchronization in radians. The related quantity of instantaneous phase can be measured with the NumPy angle() function. For real-valued data, we need to obtain the analytic representation of the signal, which is given by the Hilbert transform. The Hilbert transform is also available in SciPy and NumPy.

Cross-correlation measures the correlation between two signals using a sliding inner product. We can use cross-correlation to measure the time delay between two signals. NumPy offers the correlate() function, which calculates the cross-correlation between two arrays.

How to do it...

  1. The imports are as follows: ...

Get Python Data Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.