Skip to content

Commit

Permalink
Remove "monkey patching" from scipy.fft tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbell10 committed Jul 22, 2019
1 parent 9697c15 commit 8a6455e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ backend to speed up :func:`scipy.signal.fftconvolve`.

t = Timer(lambda: scipy.signal.fftconvolve(a, b))

print('Time with scipy.fft: %1.3f seconds' % t.timeit(number=100))
print('Time with scipy.fft default backend: %1.3f seconds' % t.timeit(number=100))

# Configure PyFFTW to use all cores (the default is single-threaded)
pyfftw.config.NUM_THREADS = multiprocessing.cpu_count()
Expand All @@ -136,15 +136,15 @@ backend to speed up :func:`scipy.signal.fftconvolve`.
# Turn on the cache for optimum performance
pyfftw.interfaces.cache.enable()

print('Time with monkey patched scipy_fftpack: %1.3f seconds' %
print('Time with pyfftw backend installed: %1.3f seconds' %
t.timeit(number=100))

which outputs something like:

.. code-block:: none
Time with scipy.fft: 0.598 seconds
Time with monkey patched scipy_fft: 0.251 seconds
Time with scipy.fft default backend: 0.598 seconds
Time with pyfftw backend installed: 0.251 seconds
Prior to SciPy 1.4 it was necessary to monkey patch the libraries
directly. :mod:`pyfftw.interfaces.numpy_fft` and
Expand Down

0 comments on commit 8a6455e

Please sign in to comment.