(a, s=None, axes=None, invreal=0)
| 702 | |
| 703 | |
| 704 | def _cook_nd_args(a, s=None, axes=None, invreal=0): |
| 705 | if s is None: |
| 706 | shapeless = True |
| 707 | if axes is None: |
| 708 | s = list(a.shape) |
| 709 | else: |
| 710 | s = take(a.shape, axes) |
| 711 | else: |
| 712 | shapeless = False |
| 713 | s = list(s) |
| 714 | if axes is None: |
| 715 | if not shapeless: |
| 716 | msg = ("`axes` should not be `None` if `s` is not `None` " |
| 717 | "(Deprecated in NumPy 2.0). In a future version of NumPy, " |
| 718 | "this will raise an error and `s[i]` will correspond to " |
| 719 | "the size along the transformed axis specified by " |
| 720 | "`axes[i]`. To retain current behaviour, pass a sequence " |
| 721 | "[0, ..., k-1] to `axes` for an array of dimension k.") |
| 722 | warnings.warn(msg, DeprecationWarning, stacklevel=3) |
| 723 | axes = list(range(-len(s), 0)) |
| 724 | if len(s) != len(axes): |
| 725 | raise ValueError("Shape and axes have different lengths.") |
| 726 | if invreal and shapeless: |
| 727 | s[-1] = (a.shape[axes[-1]] - 1) * 2 |
| 728 | if None in s: |
| 729 | msg = ("Passing an array containing `None` values to `s` is " |
| 730 | "deprecated in NumPy 2.0 and will raise an error in " |
| 731 | "a future version of NumPy. To use the default behaviour " |
| 732 | "of the corresponding 1-D transform, pass the value matching " |
| 733 | "the default for its `n` parameter. To use the default " |
| 734 | "behaviour for every axis, the `s` argument can be omitted.") |
| 735 | warnings.warn(msg, DeprecationWarning, stacklevel=3) |
| 736 | # use the whole input array along axis `i` if `s[i] == -1` |
| 737 | s = [a.shape[_a] if _s == -1 else _s for _s, _a in zip(s, axes)] |
| 738 | return s, axes |
| 739 | |
| 740 | |
| 741 | def _raw_fftnd(a, s=None, axes=None, function=fft, norm=None, out=None): |
no test coverage detected
searching dependent graphs…