mindspore.numpy.unwrap

View Source On Gitee
mindspore.numpy.unwrap(p, discont=3.141592653589793, axis=- 1)[source]

Unwraps by changing deltas between values to 2*pi complement. Unwraps radian phase p by changing absolute jumps greater than discont to their 2*pi complement along the given axis.

Note

For absolute jumps that are within a very close range to pi, unwrapping may be done differently than numpy due to differences in round-off.

Parameters
  • p (Union[int, float, bool, list, tuple, Tensor) – Input array.

  • discont (float, optional) – Maximum discontinuity between values, default: pi .

  • axis (int, optional) – Axis along which unwrap will operate, default: -1 .

Returns

Tensor.

Raises

ValueError – If the axis is out of range.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore.numpy as np
>>> phase = np.add(np.linspace(0, np.pi, num=5), [0, 0, 0, np.pi, np.pi])
>>> print(phase)
[0.        0.7853982 1.5707964 5.4977875 6.2831855]
>>> print(np.unwrap(phase))
[ 0.0000000e+00  7.8539819e-01  1.5707964e+00 -7.8539848e-01 -4.7683716e-07]