python - Numpy unwrap jump errors - Stack Overflow

admin2025-04-26  3

Jumps with np.unwrap

After calculating phases, I use unwrap from the numpy library. However, I notice that there are some jumps which are pi.

Do you know any way of preventing these jumps?

Thanks

NB: Sorry for my English and my explanations

enter image description here enter image description here

Here is a reproducible example, focused on the jump in the above graph.

import numpy as np
import matplotlib.pyplot as plt

phase = [-0.858608, -0.70645, -0.610613, -0.563053, -0.444036, -1.00768, -0.62951, -0.980268, -0.949052, -0.829854, -1.05423, -1.0007, 3.08731, 3.45372, 3.56685, 3.52306, 3.40149, 0.0969887, 3.73861, 0.196368, -1.22769, 1.43566, 3.05177, -1.69069, 2.50963, -1.10425, 2.72649, 2.91588, -1.49937, -1.05881, -0.940523, -1.00395, -1.29735, -1.16402, 3.23398, 3.20532, -0.905691, 3.54057, -0.660787, 3.53777, 3.66008, 3.48698, 3.71988, 3.34172, 3.93605, 3.34843, 3.38139, 3.13611, -0.901236, -1.34314 ]

plt.figure() 
plt.plot(phase)  

plt.figure() 
plt.plot(np.unwrap(phase))  

Here the results:

Before unwrap, After unwrap

Ones can notices a jump around the 20th to 22nd values.

转载请注明原文地址:http://www.anycun.com/QandA/1745637480a91046.html