Skip to content

Commit 41cc925

Browse files
committed
DOC: add pad to the API documentation
DOC: enable intersphinx extension to allow linking to numpy docs DOC: consistently link Modes documentation from docstrings
1 parent 26579c2 commit 41cc925

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

doc/source/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
extensions = ['sphinx.ext.doctest', 'sphinx.ext.autodoc', 'sphinx.ext.todo',
3737
'sphinx.ext.extlinks', 'sphinx.ext.mathjax',
3838
'sphinx.ext.autosummary', 'numpydoc',
39+
'sphinx.ext.intersphinx',
3940
'matplotlib.sphinxext.plot_directive']
4041

4142
# Add any paths that contain templates here, relative to this directory.
@@ -224,3 +225,9 @@
224225
plot_formats = [('png', 96), 'pdf']
225226
plot_html_show_formats = False
226227
plot_html_show_source_link = False
228+
229+
# -- Options for intersphinx extension ---------------------------------------
230+
231+
# Intersphinx to get Numpy and other targets
232+
intersphinx_mapping = {
233+
'numpy': ('https://docs.scipy.org/doc/numpy/', None)}

doc/source/ref/signal-extension-modes.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,15 @@ periodization per N/A
136136
antisymmetric asym, asymh N/A
137137
antireflect asymw reflect, reflect_type='odd'
138138
================== ============= ===========================
139+
140+
Padding using PyWavelets Signal Extension Modes - ``pad``
141+
---------------------------------------------------------
142+
143+
.. autofunction:: pad
144+
145+
Pywavelets provides a function, :func:`pad`, that operate like
146+
:func:`numpy.pad`, but supporting the PyWavelets signal extension modes
147+
discussed above. For efficiency, the DWT routines in PyWavelets do not
148+
expclitly create padded signals using this function. It can be used to manually
149+
prepad signals to reduce boundary effects in functions such as :func:`cwt` and
150+
:func:`swt` that do not currently support all of these signal extension modes.

pywt/_dwt.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ def dwt(data, wavelet, mode='symmetric', axis=-1):
135135
Axis over which to compute the DWT. If not given, the
136136
last axis is used.
137137
138-
139138
Returns
140139
-------
141140
(cA, cD) : tuple
@@ -211,7 +210,6 @@ def idwt(cA, cD, wavelet, mode='symmetric', axis=-1):
211210
Axis over which to compute the inverse DWT. If not given, the
212211
last axis is used.
213212
214-
215213
Returns
216214
-------
217215
rec: array_like
@@ -406,7 +404,7 @@ def upcoef(part, coeffs, wavelet, level=1, take=0):
406404
def pad(x, pad_widths, mode):
407405
"""Extend a 1D signal using a given boundary mode.
408406
409-
This function operates like `numpy.pad` but supports all signal extension
407+
This function operates like ``numpy.pad`` but supports all signal extension
410408
modes that can be used by PyWavelets discrete wavelet transforms.
411409
412410
Parameters
@@ -420,7 +418,7 @@ def pad(x, pad_widths, mode):
420418
axis. (pad,) or int is a shortcut for before = after = pad width for
421419
all axes.
422420
mode : str, optional
423-
Signal extension mode, see Modes.
421+
Signal extension mode, see :ref:`Modes <ref-modes>`.
424422
425423
Returns
426424
-------
@@ -430,9 +428,9 @@ def pad(x, pad_widths, mode):
430428
431429
Notes
432430
-----
433-
The performance of padding in dimensions > 1 will be substantially slower
434-
for modes `smooth` and `antisymmetric` as these modes are not supported in
435-
an efficient manner by the underlying `numpy.pad` function.
431+
The performance of padding in dimensions > 1 may be substantially slower
432+
for modes ``smooth`` and ``antisymmetric`` as these modes are not supported
433+
efficiently by the underlying ``numpy.pad`` function.
436434
"""
437435
x = np.asanyarray(x)
438436

0 commit comments

Comments
 (0)