-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
DOC specgram() documentation now in numpy style #7038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1239,78 +1239,65 @@ def specgram(x, NFFT=None, Fs=None, detrend=None, window=None, | |
""" | ||
Compute a spectrogram. | ||
|
||
Call signature:: | ||
|
||
specgram(x, NFFT=256, Fs=2,detrend=mlab.detrend_none, | ||
window=mlab.window_hanning, noverlap=128, | ||
cmap=None, xextent=None, pad_to=None, sides='default', | ||
scale_by_freq=None, mode='default') | ||
|
||
Compute and plot a spectrogram of data in *x*. Data are split into | ||
*NFFT* length segments and the spectrum of each section is | ||
computed. The windowing function *window* is applied to each | ||
Compute and plot a spectrogram of data in x. Data are split into | ||
NFFT length segments and the spectrum of each section is | ||
computed. The windowing function window is applied to each | ||
segment, and the amount of overlap of each segment is | ||
specified with *noverlap*. | ||
specified with noverlap. | ||
|
||
*x*: 1-D array or sequence | ||
Array or sequence containing the data | ||
Parameters | ||
---------- | ||
x : array_like | ||
1-D array or sequence. | ||
|
||
%(Spectral)s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This probably won't work correctly without fixing these interpolated portions as well. |
||
|
||
%(PSD)s | ||
|
||
*mode*: [ 'default' | 'psd' | 'complex' | 'magnitude' | ||
'angle' | 'phase' ] | ||
|
||
What sort of spectrum to use. Default is 'psd'. which takes the | ||
power spectral density. 'complex' returns the complex-valued | ||
frequency spectrum. 'magnitude' returns the magnitude spectrum. | ||
'angle' returns the phase spectrum without unwrapping. 'phase' | ||
returns the phase spectrum with unwrapping. | ||
|
||
*noverlap*: integer | ||
The number of points of overlap between blocks. The default value | ||
is 128. | ||
|
||
Returns the tuple (*spectrum*, *freqs*, *t*): | ||
noverlap : int, optional | ||
The number of points of overlap between blocks. The default | ||
value is 128. | ||
mode : str, optional | ||
What sort of spectrum to use, default is 'psd'. | ||
'psd' | ||
Returns the power spectral density. | ||
|
||
*spectrum*: 2-D array | ||
columns are the periodograms of successive segments | ||
'complex' | ||
Returns the complex-valued frequency spectrum. | ||
|
||
*freqs*: 1-D array | ||
The frequencies corresponding to the rows in *spectrum* | ||
|
||
*t*: 1-D array | ||
The times corresponding to midpoints of segments (i.e the columns | ||
in *spectrum*). | ||
'magnitude' | ||
Returns the magnitude spectrum. | ||
|
||
.. note:: | ||
'angle' | ||
Returns the phase spectrum without unwrapping. | ||
|
||
*detrend* and *scale_by_freq* only apply when *mode* is set to | ||
'psd' | ||
'phase' | ||
Returns the phase spectrum with unwrapping. | ||
|
||
.. seealso:: | ||
Returns | ||
------- | ||
spectrum : array_like | ||
2-D array, columns are the periodograms of successive segments. | ||
|
||
:func:`psd` | ||
:func:`psd` differs in the default overlap; in returning | ||
the mean of the segment periodograms; and in not returning | ||
times. | ||
freqs : array_like | ||
1-D array, frequencies corresponding to the rows in *spectrum*. | ||
|
||
:func:`complex_spectrum` | ||
A single spectrum, similar to having a single segment when | ||
*mode* is 'complex'. | ||
t : array_like | ||
1-D array, the times corresponding to midpoints of segments | ||
(i.e the columns in *spectrum*). | ||
|
||
:func:`magnitude_spectrum` | ||
A single spectrum, similar to having a single segment when | ||
*mode* is 'magnitude'. | ||
See Also | ||
-------- | ||
psd : differs in the overlap and in the return values. | ||
complex_spectrum : similar, but with complex valued frequencies. | ||
magnitude_spectrum : similar single segment when mode is 'magnitude'. | ||
angle_spectrum : similar to single segment when mode is 'angle'. | ||
phase_spectrum : similar to single segment when mode is 'phase'. | ||
|
||
:func:`angle_spectrum` | ||
A single spectrum, similar to having a single segment when | ||
*mode* is 'angle'. | ||
Notes | ||
----- | ||
detrend and scale_by_freq only apply when *mode* is set to 'psd'. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a blank line at the end of the docstring? |
||
|
||
:func:`phase_spectrum` | ||
A single spectrum, similar to having a single segment when | ||
*mode* is 'phase'. | ||
""" | ||
if noverlap is None: | ||
noverlap = 128 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the special formatting on the argument names? It makes them stand out more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also makes it harder to read in plain text. I prefer it this way.