Skip to content

Commit

Permalink
DOC: fix some issues in signal docstrings.
Browse files Browse the repository at this point in the history
- remove "default" from ricker docstring
- add plt.figure() to example
- add more math tags, elaborate on Hilbert transform

Reviewed as scipy#2455
  • Loading branch information
endolith authored and rgommers committed May 19, 2013
1 parent 6581958 commit 191e7a2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
17 changes: 10 additions & 7 deletions scipy/signal/signaltools.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,14 +773,14 @@ def deconvolve(signal, divisor):

def hilbert(x, N=None, axis=-1):
"""
Compute the analytic signal.
Compute the analytic signal, using the Hilbert transform.
The transformation is done along the last axis by default.
Parameters
----------
x : array_like
Signal data
Signal data. Must be real.
N : int, optional
Number of Fourier components. Default: ``x.shape[axis]``
axis : int, optional
Expand All @@ -793,14 +793,17 @@ def hilbert(x, N=None, axis=-1):
Notes
-----
The analytic signal `x_a(t)` of `x(t)` is::
The analytic signal ``x_a(t)`` of signal ``x(t)`` is:
x_a = F^{-1}(F(x) 2U) = x + i y
.. math:: x_a = F^{-1}(F(x) 2U) = x + i y
where ``F`` is the Fourier transform, ``U`` the unit step function,
and ``y`` the Hilbert transform of ``x``. [1]_
where `F` is the Fourier transform, `U` the unit step function,
and `y` the Hilbert transform of `x`. [1]_
`axis` argument is new in scipy 0.8.0.
In other words, the negative half of the frequency spectrum is zeroed
out, turning the real-valued signal into a complex signal. The Hilbert
transformed signal can be obtained from ``np.imag(hilbert(x))``, and the
original signal from ``np.real(hilbert(x))``.
References
----------
Expand Down
1 change: 1 addition & 0 deletions scipy/signal/waveforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def square(t, duty=0.5):
A pulse-width modulated sine wave:
>>> plt.figure()
>>> sig = np.sin(2 * np.pi * t)
>>> pwm = signal.square(2 * np.pi * 30 * t, duty=(sig + 1)/2)
>>> plt.subplot(2, 1, 1)
Expand Down
2 changes: 1 addition & 1 deletion scipy/signal/wavelets.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def ricker(points, a):
Parameters
----------
points : int
Number of points in `vector`. Default is ``10 * a``.
Number of points in `vector`.
Will be centered around 0.
a : scalar
Width parameter of the wavelet.
Expand Down

0 comments on commit 191e7a2

Please sign in to comment.