[Scipy-svn] r4358 - branches/refactor_fft/scipy/fftpack
scipy-svn at scipy.org
scipy-svn at scipy.org
Fri May 16 01:59:00 EDT 2008
Author: cdavid
Date: 2008-05-16 00:58:56 -0500 (Fri, 16 May 2008)
New Revision: 4358
Modified:
branches/refactor_fft/scipy/fftpack/common.py
Log:
A bit more explanation of the magic in backend loading.
Modified: branches/refactor_fft/scipy/fftpack/common.py
===================================================================
--- branches/refactor_fft/scipy/fftpack/common.py 2008-05-16 05:54:13 UTC (rev 4357)
+++ branches/refactor_fft/scipy/fftpack/common.py 2008-05-16 05:58:56 UTC (rev 4358)
@@ -1,7 +1,14 @@
+"""This module takes care of exposing the fft implementation from available
+backends.
+
+The exposed implementation consists solely in the __all__ items.
+
+The functions are set up in load_backend function, which initialize the
+dictionary _FUNCS with working functions. If a backend does not implement one
+of the function, a fallback is automatically used."""
+# Default backend: fftpack.
import fftpack as _DEF_BACKEND
-# XXX: this will break for many configurations, e.g. loading
-# init_convolution_kernel of one backend, and convolve from another one...
__all__ = ["zfft", "drfft", "zfftnd", "zrfft", "init_convolution_kernel",
"convolve", "convolve_z", "destroy_convolve_cache"]
@@ -9,7 +16,9 @@
_CONVOLVE_FUNCNAME = ["init_convolution_kernel",
"convolve", "convolve_z", "destroy_convolve_cache"]
+# Dictionary of (name, callable)
_FUNCS = dict([(name, None) for name in __all__])
+
_FALLBACK = dict([(name, _DEF_BACKEND.__dict__[f]) for f in _FUNCS.keys()])
def myimport(name):
More information about the Scipy-svn
mailing list