numpy.unwrap(p, discont=3.141592653589793, axis=-1) function helps user to unwrap a given array by changing deltas to values of 2*pi complement. It unwraps radian phase p by changing absolute jumps greater than discont to their 2*pi complement along the given axis. Result is an unwraped array.
p : [array like] input array
discont : [float, optional] Maximum discontinuity between values, default is pi
axis : [int, optional] Axis along which unwrap will operate, default is last axis
Returns: [ndarray] output array
Note: If the discontinuity in p is smaller than pi, but larger than discont, no unwrapping is done because taking the 2*pi complement would only make the discontinuity larger.
Result 1: array([1., 2., 3., 4., 5.]) Result 2: array([ 0., 0.78, -0.79318531, -0.00318531])
In l2, discont > 2*pi (between 0.78 and 5.49), so array values are changed.
Code #2: Custom Values Working
Result 1: [ 5., 7., 10., 7.71681469, 6.43362939, 6.15044408, 6.86725877]
Result 2: [0., 1.34237487, 4.3453455, 1.85146945, 3.06336035]
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course