增加环绕侦察场景适配
This commit is contained in:
@@ -200,9 +200,7 @@ For examples, see the various functions.
|
||||
|
||||
"""
|
||||
|
||||
# TODO: `numpy.fft.helper`` was deprecated in NumPy 2.0. It should
|
||||
# be deleted once downstream libraries move to `numpy.fft`.
|
||||
from . import _helper, _pocketfft, helper
|
||||
from . import _helper, _pocketfft
|
||||
from ._helper import *
|
||||
from ._pocketfft import *
|
||||
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
from ._helper import (
|
||||
fftfreq,
|
||||
fftshift,
|
||||
ifftshift,
|
||||
rfftfreq,
|
||||
)
|
||||
from ._helper import fftfreq, fftshift, ifftshift, rfftfreq
|
||||
from ._pocketfft import (
|
||||
fft,
|
||||
fft2,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from typing import Any, Final, TypeVar, overload
|
||||
from typing import Literal as L
|
||||
from typing import Any, Final, Literal as L, TypeVar, overload
|
||||
|
||||
from numpy import complexfloating, floating, generic, integer
|
||||
from numpy._typing import (
|
||||
|
||||
@@ -124,7 +124,7 @@ def fft(a, n=None, axis=-1, norm=None, out=None):
|
||||
|
||||
This function computes the one-dimensional *n*-point discrete Fourier
|
||||
Transform (DFT) with the efficient Fast Fourier Transform (FFT)
|
||||
algorithm [CT].
|
||||
algorithm [CT]_.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Literal as L
|
||||
from typing import TypeAlias
|
||||
from typing import Literal as L, TypeAlias
|
||||
|
||||
from numpy import complex128, float64
|
||||
from numpy._typing import ArrayLike, NDArray, _ArrayLikeNumber_co
|
||||
@@ -26,113 +25,113 @@ _NormKind: TypeAlias = L["backward", "ortho", "forward"] | None
|
||||
|
||||
def fft(
|
||||
a: ArrayLike,
|
||||
n: int | None = ...,
|
||||
axis: int = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[complex128] | None = ...,
|
||||
n: int | None = None,
|
||||
axis: int = -1,
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[complex128] | None = None,
|
||||
) -> NDArray[complex128]: ...
|
||||
|
||||
def ifft(
|
||||
a: ArrayLike,
|
||||
n: int | None = ...,
|
||||
axis: int = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[complex128] | None = ...,
|
||||
n: int | None = None,
|
||||
axis: int = -1,
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[complex128] | None = None,
|
||||
) -> NDArray[complex128]: ...
|
||||
|
||||
def rfft(
|
||||
a: ArrayLike,
|
||||
n: int | None = ...,
|
||||
axis: int = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[complex128] | None = ...,
|
||||
n: int | None = None,
|
||||
axis: int = -1,
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[complex128] | None = None,
|
||||
) -> NDArray[complex128]: ...
|
||||
|
||||
def irfft(
|
||||
a: ArrayLike,
|
||||
n: int | None = ...,
|
||||
axis: int = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[float64] | None = ...,
|
||||
n: int | None = None,
|
||||
axis: int = -1,
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[float64] | None = None,
|
||||
) -> NDArray[float64]: ...
|
||||
|
||||
# Input array must be compatible with `np.conjugate`
|
||||
def hfft(
|
||||
a: _ArrayLikeNumber_co,
|
||||
n: int | None = ...,
|
||||
axis: int = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[float64] | None = ...,
|
||||
n: int | None = None,
|
||||
axis: int = -1,
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[float64] | None = None,
|
||||
) -> NDArray[float64]: ...
|
||||
|
||||
def ihfft(
|
||||
a: ArrayLike,
|
||||
n: int | None = ...,
|
||||
axis: int = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[complex128] | None = ...,
|
||||
n: int | None = None,
|
||||
axis: int = -1,
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[complex128] | None = None,
|
||||
) -> NDArray[complex128]: ...
|
||||
|
||||
def fftn(
|
||||
a: ArrayLike,
|
||||
s: Sequence[int] | None = ...,
|
||||
axes: Sequence[int] | None = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[complex128] | None = ...,
|
||||
s: Sequence[int] | None = None,
|
||||
axes: Sequence[int] | None = None,
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[complex128] | None = None,
|
||||
) -> NDArray[complex128]: ...
|
||||
|
||||
def ifftn(
|
||||
a: ArrayLike,
|
||||
s: Sequence[int] | None = ...,
|
||||
axes: Sequence[int] | None = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[complex128] | None = ...,
|
||||
s: Sequence[int] | None = None,
|
||||
axes: Sequence[int] | None = None,
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[complex128] | None = None,
|
||||
) -> NDArray[complex128]: ...
|
||||
|
||||
def rfftn(
|
||||
a: ArrayLike,
|
||||
s: Sequence[int] | None = ...,
|
||||
axes: Sequence[int] | None = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[complex128] | None = ...,
|
||||
s: Sequence[int] | None = None,
|
||||
axes: Sequence[int] | None = None,
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[complex128] | None = None,
|
||||
) -> NDArray[complex128]: ...
|
||||
|
||||
def irfftn(
|
||||
a: ArrayLike,
|
||||
s: Sequence[int] | None = ...,
|
||||
axes: Sequence[int] | None = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[float64] | None = ...,
|
||||
s: Sequence[int] | None = None,
|
||||
axes: Sequence[int] | None = None,
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[float64] | None = None,
|
||||
) -> NDArray[float64]: ...
|
||||
|
||||
def fft2(
|
||||
a: ArrayLike,
|
||||
s: Sequence[int] | None = ...,
|
||||
axes: Sequence[int] | None = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[complex128] | None = ...,
|
||||
s: Sequence[int] | None = None,
|
||||
axes: Sequence[int] | None = (-2, -1),
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[complex128] | None = None,
|
||||
) -> NDArray[complex128]: ...
|
||||
|
||||
def ifft2(
|
||||
a: ArrayLike,
|
||||
s: Sequence[int] | None = ...,
|
||||
axes: Sequence[int] | None = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[complex128] | None = ...,
|
||||
s: Sequence[int] | None = None,
|
||||
axes: Sequence[int] | None = (-2, -1),
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[complex128] | None = None,
|
||||
) -> NDArray[complex128]: ...
|
||||
|
||||
def rfft2(
|
||||
a: ArrayLike,
|
||||
s: Sequence[int] | None = ...,
|
||||
axes: Sequence[int] | None = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[complex128] | None = ...,
|
||||
s: Sequence[int] | None = None,
|
||||
axes: Sequence[int] | None = (-2, -1),
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[complex128] | None = None,
|
||||
) -> NDArray[complex128]: ...
|
||||
|
||||
def irfft2(
|
||||
a: ArrayLike,
|
||||
s: Sequence[int] | None = ...,
|
||||
axes: Sequence[int] | None = ...,
|
||||
norm: _NormKind = ...,
|
||||
out: NDArray[float64] | None = ...,
|
||||
s: Sequence[int] | None = None,
|
||||
axes: Sequence[int] | None = (-2, -1),
|
||||
norm: _NormKind = None,
|
||||
out: NDArray[float64] | None = None,
|
||||
) -> NDArray[float64]: ...
|
||||
|
||||
Binary file not shown.
@@ -1,17 +0,0 @@
|
||||
def __getattr__(attr_name):
|
||||
import warnings
|
||||
|
||||
from numpy.fft import _helper
|
||||
ret = getattr(_helper, attr_name, None)
|
||||
if ret is None:
|
||||
raise AttributeError(
|
||||
f"module 'numpy.fft.helper' has no attribute {attr_name}")
|
||||
warnings.warn(
|
||||
"The numpy.fft.helper has been made private and renamed to "
|
||||
"numpy.fft._helper. All four functions exported by it (i.e. fftshift, "
|
||||
"ifftshift, fftfreq, rfftfreq) are available from numpy.fft. "
|
||||
f"Please use numpy.fft.{attr_name} instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=3
|
||||
)
|
||||
return ret
|
||||
@@ -1,22 +0,0 @@
|
||||
from typing import Any
|
||||
from typing import Literal as L
|
||||
|
||||
from typing_extensions import deprecated
|
||||
|
||||
import numpy as np
|
||||
from numpy._typing import ArrayLike, NDArray, _ShapeLike
|
||||
|
||||
from ._helper import integer_types as integer_types
|
||||
|
||||
__all__ = ["fftfreq", "fftshift", "ifftshift", "rfftfreq"]
|
||||
|
||||
###
|
||||
|
||||
@deprecated("Please use `numpy.fft.fftshift` instead.")
|
||||
def fftshift(x: ArrayLike, axes: _ShapeLike | None = None) -> NDArray[Any]: ...
|
||||
@deprecated("Please use `numpy.fft.ifftshift` instead.")
|
||||
def ifftshift(x: ArrayLike, axes: _ShapeLike | None = None) -> NDArray[Any]: ...
|
||||
@deprecated("Please use `numpy.fft.fftfreq` instead.")
|
||||
def fftfreq(n: int | np.integer, d: ArrayLike = 1.0, device: L["cpu"] | None = None) -> NDArray[Any]: ...
|
||||
@deprecated("Please use `numpy.fft.rfftfreq` instead.")
|
||||
def rfftfreq(n: int | np.integer, d: ArrayLike = 1.0, device: L["cpu"] | None = None) -> NDArray[Any]: ...
|
||||
@@ -55,7 +55,7 @@ class TestFFT1D:
|
||||
def test_identity_long_short_reversed(self, dtype):
|
||||
# Also test explicitly given number of points in reversed order.
|
||||
maxlen = 16
|
||||
atol = 5 * np.spacing(np.array(1., dtype=dtype))
|
||||
atol = 6 * np.spacing(np.array(1., dtype=dtype))
|
||||
x = random(maxlen).astype(dtype) + 1j * random(maxlen).astype(dtype)
|
||||
xx = np.concatenate([x, np.zeros_like(x)])
|
||||
for i in range(1, maxlen * 2):
|
||||
|
||||
Reference in New Issue
Block a user