Skip to content

Commit aabb3af

Browse files
committed
Allow supplying either a string or a function as the FFT method
1 parent 23a5f4b commit aabb3af

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

pysteps/cascade/decomposition.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ def decomposition_fft(X, filter, **kwargs):
3232
Parameters
3333
----------
3434
X : array_like
35-
Two-dimensional array containing the input field. All values are required
36-
to be finite.
35+
Two-dimensional array containing the input field. All values are required
36+
to be finite.
3737
filter : dict
38-
A filter returned by a method implemented in bandpass_filters.py.
38+
A filter returned by a method implemented in bandpass_filters.py.
3939
4040
Other Parameters
4141
----------------
42-
fft_method : tuple
43-
A tuple defining the FFT method to use (see utils.fft.get_method).
44-
Defaults to numpy.fft.
42+
fft_method : str or tuple
43+
A string or a (function,kwargs) tuple defining the FFT method to use
44+
(see utils.fft.get_method). Defaults to "numpy".
4545
MASK : array_like
4646
Optional mask to use for computing the statistics for the cascade levels.
4747
Pixels with MASK==False are excluded from the computations.
@@ -53,7 +53,11 @@ def decomposition_fft(X, filter, **kwargs):
5353
levels is determined from the filter (see bandpass_filters.py).
5454
5555
"""
56-
fft,fft_kwargs = fft_module.get_method(kwargs.get("fft_method", "numpy"))
56+
fft = kwargs.get("fft_method", "numpy")
57+
if type(fft) == str:
58+
fft,fft_kwargs = fft_module.get_method(fft)
59+
else:
60+
fft,fft_kwargs = fft
5761
MASK = kwargs.get("MASK", None)
5862

5963
if len(X.shape) != 2:

0 commit comments

Comments
 (0)