# numpy.unwrap () in Python

` numpy.unwrap (p, discont = 3.141592653589793, axis = -1) ` helps the user to expand the given array by going to 2 * pi's padding values. It reverses the phase of the p radian, changing the absolute jumps more than the gap by their 2 * pi-complement along the given axis. Result — expanded array.

Parameters:

p : input array
discont : Maximum discontinuity between values, default is pi
axis : Axis along which unwrap will operate, default is last axis

Returns: [ndarray] output array

Note. If the gap in p is less than pi but greater than dist, then deploy fails because taking the 2 * pi's complement will only widen the gap.

Code # 1: Working Defaults

 ` import ` ` numpy as np `   ` l1 ` ` = ` ` [` ` 1 ` `, ` ` 2 ` `, ` ` 3 ` `, ` ` 4 ` `, ` ` 5 ` `] ` ` print ` ` (` ` "Result 1:" ` `, np.unwrap (l1)) `   ` l2 ` ` = ` ` [` ` 0 ` `, ` ` 0.78 ` `, ` ` 5.49 ` `, ` ` 6.28 ` `] ` ` print ` ` (` ` "Result 2:" ` `, np. unwrap (l2)) `

Exit:

` Result 1: array ([1. , 2., 3., 4., 5.]) Result 2: array ([0., 0.78, -0.79318531, -0.00318531]) `

In l2, disable & gt; 2 * pi (between 0.78 and 5.49) so the array values ​​will change.

Code # 2: Custom values ​​work

 ` import ` ` numpy as np `   ` l1 ` ` = ` ` [` ` 5 ` `, ` ` 7 ` `, ` ` 10 ` `, ` ` 14 ` `, ` ` 19 ` `, ` ` 25 ` `, ` ` 32 ` `] ` ` print ` ` (` ` "Result 1:" ` `, n p.unwrap (l1, discont ` ` = ` ` 4 ` `)) `   ` l2 ` ` = ` ` [` ` 0 ` `, ` ` 1.34237486723 ` `, ` ` 4.3453455 ` `, ` ` 8.134654756 ` `, ` ` 9.3465456542 ` `] ` ` print ` ` (` ` "Result 2:" ` `, np.unwrap (l2, discont ` ` = ` ` 3.1 ` `)) `

Output:

Result 1: [5., 7., 10., 7.71681469, 6.43362939, 6.15044408, 6.86725877] Result 2: [0., 1.34237487, 4.3453455, 1.85146945, 3.06336035]