diff options
author | Max Kellermeier <max.kellermeier@hotmail.de> | 2020-08-21 22:55:29 +0200 |
---|---|---|
committer | Max Kellermeier <max.kellermeier@hotmail.de> | 2020-08-21 22:55:29 +0200 |
commit | 00dcda244bc1eb58cb3b4f30c7b18a71a8569194 (patch) | |
tree | b04c853e60ae1b4a0b7d4cece2061ec0fe6bfca9 /numpy/lib/function_base.py | |
parent | 3da050660f2140ae387d67218f457442f89fe94e (diff) | |
download | numpy-00dcda244bc1eb58cb3b4f30c7b18a71a8569194.tar.gz |
Updated incorrect argument in tests. boundary correction for int and float.
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 491b25915..2a942a13a 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1554,11 +1554,13 @@ def unwrap(p, discont=None, axis=-1, *, period=2*pi): if _nx.issubdtype(dtype, _nx.integer): interval_low = -(period // 2) interval_high = -interval_low + boundary_ambiguous = (period % 2 == 0) else: interval_low = -period / 2 interval_high = -interval_low + boundary_ambiguous = True ddmod = mod(dd - interval_low, period) + interval_low - if period % 2 == 0: + if boundary_ambiguous: # for `mask = (abs(dd) == period/2)`, the above line made `ddmod[mask] == -period/2`. # correct these such that `ddmod[mask] == sign(dd[mask])*period/2`. _nx.copyto(ddmod, interval_high, where=(ddmod == interval_low) & (dd > 0)) |