Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 77c4e28

Browse filesBrowse files
NelleVtacaswell
authored andcommitted
Merge pull request #7118 from NelleV/Exhor_numpy_doc_specgram
DOC specgram() documentation now in numpy style
1 parent f52af63 commit 77c4e28
Copy full SHA for 77c4e28

File tree

Expand file treeCollapse file tree

1 file changed

+42
-55
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+42
-55
lines changed

‎lib/matplotlib/mlab.py

Copy file name to clipboardExpand all lines: lib/matplotlib/mlab.py
+42-55Lines changed: 42 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,78 +1241,65 @@ def specgram(x, NFFT=None, Fs=None, detrend=None, window=None,
12411241
"""
12421242
Compute a spectrogram.
12431243
1244-
Call signature::
1245-
1246-
specgram(x, NFFT=256, Fs=2,detrend=mlab.detrend_none,
1247-
window=mlab.window_hanning, noverlap=128,
1248-
cmap=None, xextent=None, pad_to=None, sides='default',
1249-
scale_by_freq=None, mode='default')
1250-
1251-
Compute and plot a spectrogram of data in *x*. Data are split into
1252-
*NFFT* length segments and the spectrum of each section is
1253-
computed. The windowing function *window* is applied to each
1244+
Compute and plot a spectrogram of data in x. Data are split into
1245+
NFFT length segments and the spectrum of each section is
1246+
computed. The windowing function window is applied to each
12541247
segment, and the amount of overlap of each segment is
1255-
specified with *noverlap*.
1248+
specified with noverlap.
12561249
1257-
*x*: 1-D array or sequence
1258-
Array or sequence containing the data
1250+
Parameters
1251+
----------
1252+
x : array_like
1253+
1-D array or sequence.
12591254
12601255
%(Spectral)s
12611256
12621257
%(PSD)s
12631258
1264-
*mode*: [ 'default' | 'psd' | 'complex' | 'magnitude'
1265-
'angle' | 'phase' ]
1266-
1267-
What sort of spectrum to use. Default is 'psd'. which takes the
1268-
power spectral density. 'complex' returns the complex-valued
1269-
frequency spectrum. 'magnitude' returns the magnitude spectrum.
1270-
'angle' returns the phase spectrum without unwrapping. 'phase'
1271-
returns the phase spectrum with unwrapping.
1272-
1273-
*noverlap*: integer
1274-
The number of points of overlap between blocks. The default value
1275-
is 128.
1276-
1277-
Returns the tuple (*spectrum*, *freqs*, *t*):
1259+
noverlap : int, optional
1260+
The number of points of overlap between blocks. The default
1261+
value is 128.
1262+
mode : str, optional
1263+
What sort of spectrum to use, default is 'psd'.
1264+
'psd'
1265+
Returns the power spectral density.
12781266
1279-
*spectrum*: 2-D array
1280-
columns are the periodograms of successive segments
1267+
'complex'
1268+
Returns the complex-valued frequency spectrum.
12811269
1282-
*freqs*: 1-D array
1283-
The frequencies corresponding to the rows in *spectrum*
1284-
1285-
*t*: 1-D array
1286-
The times corresponding to midpoints of segments (i.e the columns
1287-
in *spectrum*).
1270+
'magnitude'
1271+
Returns the magnitude spectrum.
12881272
1289-
.. note::
1273+
'angle'
1274+
Returns the phase spectrum without unwrapping.
12901275
1291-
*detrend* and *scale_by_freq* only apply when *mode* is set to
1292-
'psd'
1276+
'phase'
1277+
Returns the phase spectrum with unwrapping.
12931278
1294-
.. seealso::
1279+
Returns
1280+
-------
1281+
spectrum : array_like
1282+
2-D array, columns are the periodograms of successive segments.
12951283
1296-
:func:`psd`
1297-
:func:`psd` differs in the default overlap; in returning
1298-
the mean of the segment periodograms; and in not returning
1299-
times.
1284+
freqs : array_like
1285+
1-D array, frequencies corresponding to the rows in *spectrum*.
13001286
1301-
:func:`complex_spectrum`
1302-
A single spectrum, similar to having a single segment when
1303-
*mode* is 'complex'.
1287+
t : array_like
1288+
1-D array, the times corresponding to midpoints of segments
1289+
(i.e the columns in *spectrum*).
13041290
1305-
:func:`magnitude_spectrum`
1306-
A single spectrum, similar to having a single segment when
1307-
*mode* is 'magnitude'.
1291+
See Also
1292+
--------
1293+
psd : differs in the overlap and in the return values.
1294+
complex_spectrum : similar, but with complex valued frequencies.
1295+
magnitude_spectrum : similar single segment when mode is 'magnitude'.
1296+
angle_spectrum : similar to single segment when mode is 'angle'.
1297+
phase_spectrum : similar to single segment when mode is 'phase'.
13081298
1309-
:func:`angle_spectrum`
1310-
A single spectrum, similar to having a single segment when
1311-
*mode* is 'angle'.
1299+
Notes
1300+
-----
1301+
detrend and scale_by_freq only apply when *mode* is set to 'psd'.
13121302
1313-
:func:`phase_spectrum`
1314-
A single spectrum, similar to having a single segment when
1315-
*mode* is 'phase'.
13161303
"""
13171304
if noverlap is None:
13181305
noverlap = 128

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.