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

Skip to content

Commit ede44e5

Browse files
authored
Merge pull request #7118 from NelleV/Exhor_numpy_doc_specgram
DOC specgram() documentation now in numpy style
2 parents 4d511dc + 884a2a6 commit ede44e5

File tree

1 file changed

+42
-55
lines changed

1 file changed

+42
-55
lines changed

lib/matplotlib/mlab.py

Lines changed: 42 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,78 +1239,65 @@ def specgram(x, NFFT=None, Fs=None, detrend=None, window=None,
12391239
"""
12401240
Compute a spectrogram.
12411241
1242-
Call signature::
1243-
1244-
specgram(x, NFFT=256, Fs=2,detrend=mlab.detrend_none,
1245-
window=mlab.window_hanning, noverlap=128,
1246-
cmap=None, xextent=None, pad_to=None, sides='default',
1247-
scale_by_freq=None, mode='default')
1248-
1249-
Compute and plot a spectrogram of data in *x*. Data are split into
1250-
*NFFT* length segments and the spectrum of each section is
1251-
computed. The windowing function *window* is applied to each
1242+
Compute and plot a spectrogram of data in x. Data are split into
1243+
NFFT length segments and the spectrum of each section is
1244+
computed. The windowing function window is applied to each
12521245
segment, and the amount of overlap of each segment is
1253-
specified with *noverlap*.
1246+
specified with noverlap.
12541247
1255-
*x*: 1-D array or sequence
1256-
Array or sequence containing the data
1248+
Parameters
1249+
----------
1250+
x : array_like
1251+
1-D array or sequence.
12571252
12581253
%(Spectral)s
12591254
12601255
%(PSD)s
12611256
1262-
*mode*: [ 'default' | 'psd' | 'complex' | 'magnitude'
1263-
'angle' | 'phase' ]
1264-
1265-
What sort of spectrum to use. Default is 'psd'. which takes the
1266-
power spectral density. 'complex' returns the complex-valued
1267-
frequency spectrum. 'magnitude' returns the magnitude spectrum.
1268-
'angle' returns the phase spectrum without unwrapping. 'phase'
1269-
returns the phase spectrum with unwrapping.
1270-
1271-
*noverlap*: integer
1272-
The number of points of overlap between blocks. The default value
1273-
is 128.
1274-
1275-
Returns the tuple (*spectrum*, *freqs*, *t*):
1257+
noverlap : int, optional
1258+
The number of points of overlap between blocks. The default
1259+
value is 128.
1260+
mode : str, optional
1261+
What sort of spectrum to use, default is 'psd'.
1262+
'psd'
1263+
Returns the power spectral density.
12761264
1277-
*spectrum*: 2-D array
1278-
columns are the periodograms of successive segments
1265+
'complex'
1266+
Returns the complex-valued frequency spectrum.
12791267
1280-
*freqs*: 1-D array
1281-
The frequencies corresponding to the rows in *spectrum*
1282-
1283-
*t*: 1-D array
1284-
The times corresponding to midpoints of segments (i.e the columns
1285-
in *spectrum*).
1268+
'magnitude'
1269+
Returns the magnitude spectrum.
12861270
1287-
.. note::
1271+
'angle'
1272+
Returns the phase spectrum without unwrapping.
12881273
1289-
*detrend* and *scale_by_freq* only apply when *mode* is set to
1290-
'psd'
1274+
'phase'
1275+
Returns the phase spectrum with unwrapping.
12911276
1292-
.. seealso::
1277+
Returns
1278+
-------
1279+
spectrum : array_like
1280+
2-D array, columns are the periodograms of successive segments.
12931281
1294-
:func:`psd`
1295-
:func:`psd` differs in the default overlap; in returning
1296-
the mean of the segment periodograms; and in not returning
1297-
times.
1282+
freqs : array_like
1283+
1-D array, frequencies corresponding to the rows in *spectrum*.
12981284
1299-
:func:`complex_spectrum`
1300-
A single spectrum, similar to having a single segment when
1301-
*mode* is 'complex'.
1285+
t : array_like
1286+
1-D array, the times corresponding to midpoints of segments
1287+
(i.e the columns in *spectrum*).
13021288
1303-
:func:`magnitude_spectrum`
1304-
A single spectrum, similar to having a single segment when
1305-
*mode* is 'magnitude'.
1289+
See Also
1290+
--------
1291+
psd : differs in the overlap and in the return values.
1292+
complex_spectrum : similar, but with complex valued frequencies.
1293+
magnitude_spectrum : similar single segment when mode is 'magnitude'.
1294+
angle_spectrum : similar to single segment when mode is 'angle'.
1295+
phase_spectrum : similar to single segment when mode is 'phase'.
13061296
1307-
:func:`angle_spectrum`
1308-
A single spectrum, similar to having a single segment when
1309-
*mode* is 'angle'.
1297+
Notes
1298+
-----
1299+
detrend and scale_by_freq only apply when *mode* is set to 'psd'.
13101300
1311-
:func:`phase_spectrum`
1312-
A single spectrum, similar to having a single segment when
1313-
*mode* is 'phase'.
13141301
"""
13151302
if noverlap is None:
13161303
noverlap = 128

0 commit comments

Comments
 (0)