Let's say I have an array of phases similar to this:
import numpy as np
import matplotlib.pyplot as plt
phase = np.linspace(0., 100., 1000) % np.pi
plt.plot(phase)
plt.show()
(with many discontinuities like this)
How to get an array of more "continuous" phases from it?
Of course, I already tried with np.unwrap
:
plt.plot(np.unwrap(phase))
or
plt.plot(np.unwrap(phase),discont=0.1)
but it stays exactly similar:
What I expected was an unwrapping like this:
If you want to keep your original phase with pi-periodicity, you should first double it, unwrap it, then divide it by two:
plt.plot(np.unwrap(2 * phase) / 2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With