|
36 | 36 |
|
37 | 37 | import mkl
|
38 | 38 | import numpy as np
|
| 39 | +import scipy |
39 | 40 |
|
40 | 41 | import mkl_fft
|
41 | 42 |
|
|
61 | 62 | "ihfft2",
|
62 | 63 | "hfftn",
|
63 | 64 | "ihfftn",
|
| 65 | + "fftshift", |
| 66 | + "ifftshift", |
| 67 | + "fftfreq", |
| 68 | + "rfftfreq", |
64 | 69 | "get_workers",
|
65 | 70 | "set_workers",
|
66 | 71 | ]
|
@@ -650,6 +655,49 @@ def ihfftn(
|
650 | 655 | return result
|
651 | 656 |
|
652 | 657 |
|
| 658 | +# define thin wrappers for scipy functions to avoid circular dependencies |
| 659 | +def fftfreq(n, d=1.0, *, xp=None, device=None): |
| 660 | + """ |
| 661 | + Return the Discrete Fourier Transform sample frequencies. |
| 662 | +
|
| 663 | + For full documentation refer to `scipy.fft.fftfreq`. |
| 664 | +
|
| 665 | + """ |
| 666 | + return scipy.fft.fftfreq(n, d=d, xp=xp, device=device) |
| 667 | + |
| 668 | + |
| 669 | +def rfftfreq(n, d=1.0, *, xp=None, device=None): |
| 670 | + """ |
| 671 | + Return the Discrete Fourier Transform sample frequencies (for usage with |
| 672 | + `rfft`, `irfft`). |
| 673 | +
|
| 674 | + For full documentation refer to `scipy.fft.rfftfreq`. |
| 675 | +
|
| 676 | + """ |
| 677 | + return scipy.fft.rfftfreq(n, d=d, xp=xp, device=device) |
| 678 | + |
| 679 | + |
| 680 | +def fftshift(x, axes=None): |
| 681 | + """ |
| 682 | + Shift the zero-frequency component to the center of the spectrum. |
| 683 | +
|
| 684 | + For full documentation refer to `scipy.fft.fftshift`. |
| 685 | +
|
| 686 | + """ |
| 687 | + return scipy.fft.fftshift(x, axes=axes) |
| 688 | + |
| 689 | + |
| 690 | +def ifftshift(x, axes=None): |
| 691 | + """ |
| 692 | + The inverse of `fftshift`. Although identical for even-length `x`, the |
| 693 | + functions differ by one sample for odd-length `x`. |
| 694 | +
|
| 695 | + For full documentation refer to `scipy.fft.ifftshift`. |
| 696 | +
|
| 697 | + """ |
| 698 | + return scipy.fft.ifftshift(x, axes=axes) |
| 699 | + |
| 700 | + |
653 | 701 | def get_workers():
|
654 | 702 | """
|
655 | 703 | Gets the number of workers used by mkl_fft by default.
|
|
0 commit comments