numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
unwrap(p, discont=None, axis=-1, *, period=6.283185307179586)

This unwraps a signal p by changing elements which have an absolute difference from their predecessor of more than max(discont, period/2) to their :None:None:`period`-complementary values.

For the default case where :None:None:`period` is $2\pi$ and :None:None:`discont` is $\pi$ , this unwraps a radian phase p such that adjacent differences are never greater than $\pi$ by adding $2k\pi$ for some integer $k$ .

Notes

If the discontinuity in p is smaller than period/2 , but larger than :None:None:`discont`, no unwrapping is done because taking the complement would only make the discontinuity larger.

Parameters

p : array_like

Input array.

discont : float, optional

Maximum discontinuity between values, default is period/2 . Values below period/2 are treated as if they were period/2 . To have an effect different from the default, :None:None:`discont` should be larger than period/2 .

axis : int, optional

Axis along which unwrap will operate, default is the last axis.

period: float, optional :

Size of the range over which the input wraps. By default, it is 2 pi .

versionadded

Returns

out : ndarray

Output array.

Unwrap by taking the complement of large deltas with respect to the period.

See Also

deg2rad
rad2deg

Examples

>>> phase = np.linspace(0, np.pi, num=5)
... phase[3:] += np.pi
... phase array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) # may vary
>>> np.unwrap(phase)
array([ 0.        ,  0.78539816,  1.57079633, -0.78539816,  0.        ]) # may vary
>>> np.unwrap([0, 1, 2, -1, 0], period=4)
array([0, 1, 2, 3, 4])
>>> np.unwrap([ 1, 2, 3, 4, 5, 6, 1, 2, 3], period=6)
array([1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> np.unwrap([2, 3, 4, 5, 2, 3, 4, 5], period=4)
array([2, 3, 4, 5, 6, 7, 8, 9])
>>> phase_deg = np.mod(np.linspace(0 ,720, 19), 360) - 180
... np.unwrap(phase_deg, period=360) array([-180., -140., -100., -60., -20., 20., 60., 100., 140., 180., 220., 260., 300., 340., 380., 420., 460., 500., 540.])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.signal._filter_design.freqz_zpk scipy.signal._filter_design.iirnotch scipy.signal._filter_design.bessel scipy.signal._filter_design.freqz scipy.signal._filter_design.iircomb scipy.signal._filter_design.iirdesign scipy.signal._filter_design.iirpeak

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/lib/function_base.py#1634
type: <class 'function'>
Commit: