How fftshift was implemented in v1.14
(x, axes=None)
| 88 | from numpy._core import arange, asarray, concatenate, take |
| 89 | |
| 90 | def original_fftshift(x, axes=None): |
| 91 | """ How fftshift was implemented in v1.14""" |
| 92 | tmp = asarray(x) |
| 93 | ndim = tmp.ndim |
| 94 | if axes is None: |
| 95 | axes = list(range(ndim)) |
| 96 | elif isinstance(axes, int): |
| 97 | axes = (axes,) |
| 98 | y = tmp |
| 99 | for k in axes: |
| 100 | n = tmp.shape[k] |
| 101 | p2 = (n + 1) // 2 |
| 102 | mylist = concatenate((arange(p2, n), arange(p2))) |
| 103 | y = take(y, mylist, k) |
| 104 | return y |
| 105 | |
| 106 | def original_ifftshift(x, axes=None): |
| 107 | """ How ifftshift was implemented in v1.14 """ |
nothing calls this directly
no test coverage detected