Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 17b3c44

Browse files
committed
Improve mlab documentation (and example)
1 parent 8b1881f commit 17b3c44

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

examples/lines_bars_and_markers/csd_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@
3838
ax1.grid(True)
3939

4040
cxy, f = ax2.csd(s1, s2, 256, 1. / dt)
41-
ax2.set_ylabel('CSD (db)')
41+
ax2.set_ylabel('CSD (dB)')
4242
plt.show()

lib/matplotlib/mlab.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
def window_hanning(x):
6262
"""
63-
Return x times the hanning window of len(x).
63+
Return *x* times the Hanning (or Hann) window of len(*x*).
6464
6565
See Also
6666
--------
@@ -71,7 +71,7 @@ def window_hanning(x):
7171

7272
def window_none(x):
7373
"""
74-
No window function; simply return x.
74+
No window function; simply return *x*.
7575
7676
See Also
7777
--------
@@ -82,7 +82,7 @@ def window_none(x):
8282

8383
def detrend(x, key=None, axis=None):
8484
"""
85-
Return x with its trend removed.
85+
Return *x* with its trend removed.
8686
8787
Parameters
8888
----------
@@ -131,7 +131,7 @@ def detrend(x, key=None, axis=None):
131131

132132
def detrend_mean(x, axis=None):
133133
"""
134-
Return x minus the mean(x).
134+
Return *x* minus the mean(*x*).
135135
136136
Parameters
137137
----------
@@ -140,7 +140,7 @@ def detrend_mean(x, axis=None):
140140
Can have any dimensionality
141141
142142
axis : int
143-
The axis along which to take the mean. See numpy.mean for a
143+
The axis along which to take the mean. See `numpy.mean` for a
144144
description of this argument.
145145
146146
See Also
@@ -159,7 +159,7 @@ def detrend_mean(x, axis=None):
159159

160160
def detrend_none(x, axis=None):
161161
"""
162-
Return x: no detrending.
162+
Return *x*: no detrending.
163163
164164
Parameters
165165
----------
@@ -181,7 +181,7 @@ def detrend_none(x, axis=None):
181181

182182
def detrend_linear(y):
183183
"""
184-
Return x minus best fit line; 'linear' detrending.
184+
Return *x* minus best fit line; 'linear' detrending.
185185
186186
Parameters
187187
----------
@@ -216,7 +216,7 @@ def detrend_linear(y):
216216
@_api.deprecated("3.6")
217217
def stride_windows(x, n, noverlap=None, axis=0):
218218
"""
219-
Get all windows of x with length n as a single array,
219+
Get all windows of *x* with length *n* as a single array,
220220
using strides to avoid data duplication.
221221
222222
.. warning::
@@ -497,8 +497,8 @@ def _single_spectrum_helper(
497497
the FFT. While not increasing the actual resolution of the spectrum (the
498498
minimum distance between resolvable peaks), this can give more points in
499499
the plot, allowing for more detail. This corresponds to the *n* parameter
500-
in the call to fft(). The default is None, which sets *pad_to* equal to
501-
the length of the input signal (i.e. no padding).""",
500+
in the call to `~numpy.fft.fft`. The default is None, which sets *pad_to*
501+
equal to the length of the input signal (i.e. no padding).""",
502502

503503
PSD="""\
504504
pad_to : int, optional
@@ -507,8 +507,8 @@ def _single_spectrum_helper(
507507
of data points used. While not increasing the actual resolution of the
508508
spectrum (the minimum distance between resolvable peaks), this can give
509509
more points in the plot, allowing for more detail. This corresponds to
510-
the *n* parameter in the call to fft(). The default is None, which sets
511-
*pad_to* equal to *NFFT*
510+
the *n* parameter in the call to `~numpy.fft.fft`. The default is None,
511+
which sets *pad_to* equal to *NFFT*
512512
513513
NFFT : int, default: 256
514514
The number of data points used in each block for the FFT. A power 2 is
@@ -526,7 +526,7 @@ def _single_spectrum_helper(
526526
527527
scale_by_freq : bool, default: True
528528
Whether the resulting density values should be scaled by the scaling
529-
frequency, which gives density in units of Hz^-1. This allows for
529+
frequency, which gives density in units of 1/Hz. This allows for
530530
integration over the returned frequency values. The default is True for
531531
MATLAB compatibility.""")
532532

@@ -714,11 +714,11 @@ def specgram(x, NFFT=None, Fs=None, detrend=None, window=None,
714714
"""
715715
Compute a spectrogram.
716716
717-
Compute and plot a spectrogram of data in x. Data are split into
718-
NFFT length segments and the spectrum of each section is
719-
computed. The windowing function window is applied to each
717+
Compute and plot a spectrogram of data in *x*. Data are split into
718+
*NFFT* length segments and the spectrum of each section is
719+
computed. The windowing function *window* is applied to each
720720
segment, and the amount of overlap of each segment is
721-
specified with noverlap.
721+
specified with *noverlap*.
722722
723723
Parameters
724724
----------
@@ -760,13 +760,13 @@ def specgram(x, NFFT=None, Fs=None, detrend=None, window=None,
760760
--------
761761
psd : differs in the overlap and in the return values.
762762
complex_spectrum : similar, but with complex valued frequencies.
763-
magnitude_spectrum : similar single segment when mode is 'magnitude'.
764-
angle_spectrum : similar to single segment when mode is 'angle'.
765-
phase_spectrum : similar to single segment when mode is 'phase'.
763+
magnitude_spectrum : similar single segment when *mode* is 'magnitude'.
764+
angle_spectrum : similar to single segment when *mode* is 'angle'.
765+
phase_spectrum : similar to single segment when *mode* is 'phase'.
766766
767767
Notes
768768
-----
769-
detrend and scale_by_freq only apply when *mode* is set to 'psd'.
769+
*detrend* and *scale_by_freq* only apply when *mode* is set to 'psd'.
770770
771771
"""
772772
if noverlap is None:

0 commit comments

Comments
 (0)