summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorscimax <max.kellermeier@hotmail.de>2020-08-23 21:55:48 +0200
committerGitHub <noreply@github.com>2020-08-23 21:55:48 +0200
commit7c56c83d39677deb00fc42e31a96a7118fe255a0 (patch)
treec8ecc5abc8d8e03815718a30bab1e26023ac4b59 /numpy/lib/function_base.py
parentfde3fdb05eda00a4c84d6e52184c43928b320035 (diff)
downloadnumpy-7c56c83d39677deb00fc42e31a96a7118fe255a0.tar.gz
Apply suggestions from code review
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 7c819eaf3..41dec5e80 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -1489,15 +1489,15 @@ def _unwrap_dispatcher(p, discont=None, axis=None, *, period=None):
@array_function_dispatch(_unwrap_dispatcher)
def unwrap(p, discont=None, axis=-1, *, period=2*pi):
"""
- Unwrap by changing deltas between values to complement.
-
- For the default case where `period= 2*pi`, `discont=pi`,
- It unwraps radian phase `p` by changing absolute jumps greater
- than `discont` to their 2*pi complement along the given axis. Jumps equal
- to `discont` are not changed.
-
- In general it unwrapps a signal `p` by changing absolute jumps
- greater than `discont` to their `period` complementary values.
+ Unwrap by taking the complement of large deltas with respect to the period.
+
+ 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 `period`-complementary values.
+
+ For the default case where `period` is :math:`2\pi` and is `discont` is :math:`\pi`,
+ this unwraps a radian phase `p` such that adjacent differences are never
+ greater than :math:`\pi` by adding :math:`2k\pi` for some integer :math:`k`.
Parameters
----------
@@ -1505,6 +1505,7 @@ def unwrap(p, discont=None, axis=-1, *, period=2*pi):
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``.
axis : int, optional
Axis along which unwrap will operate, default is the last axis.
period: float, optional