77Spectral functions
88-------------------
99
10- :func: `cohere`
10+ `cohere`
1111 Coherence (normalized cross spectral density)
1212
13- :func: `csd`
13+ `csd`
1414 Cross spectral density using Welch's average periodogram
1515
16- :func: `detrend`
16+ `detrend`
1717 Remove the mean or best fit line from an array
1818
19- :func: `psd`
19+ `psd`
2020 Power spectral density using Welch's average periodogram
2121
22- :func: `specgram`
22+ `specgram`
2323 Spectrogram (spectrum over segments of time)
2424
25- :func: `complex_spectrum`
25+ `complex_spectrum`
2626 Return the complex-valued frequency spectrum of a signal
2727
28- :func: `magnitude_spectrum`
28+ `magnitude_spectrum`
2929 Return the magnitude of the frequency spectrum of a signal
3030
31- :func: `angle_spectrum`
31+ `angle_spectrum`
3232 Return the angle (wrapped phase) of the frequency spectrum of a signal
3333
34- :func: `phase_spectrum`
34+ `phase_spectrum`
3535 Return the phase (unwrapped angle) of the frequency spectrum of a signal
3636
37- :func: `detrend_mean`
37+ `detrend_mean`
3838 Remove the mean from a line.
3939
40- :func: `detrend_linear`
40+ `detrend_linear`
4141 Remove the best fit line from a line.
4242
43- :func: `detrend_none`
43+ `detrend_none`
4444 Return the original line.
4545
46- :func: `stride_windows`
46+ `stride_windows`
4747 Get all windows in an array in a memory-efficient manner
4848
49- :func: `stride_repeat`
49+ `stride_repeat`
5050 Repeat an array in a memory-efficient manner
5151
52- :func: `apply_window`
52+ `apply_window`
5353 Apply a window along a given axis
5454"""
5555
@@ -67,8 +67,7 @@ def window_hanning(x):
6767
6868 See Also
6969 --------
70- :func:`window_none`
71- :func:`window_none` is another window algorithm.
70+ window_none : Another window algorithm.
7271 '''
7372 return np .hanning (len (x ))* x
7473
@@ -79,8 +78,7 @@ def window_none(x):
7978
8079 See Also
8180 --------
82- :func:`window_hanning`
83- :func:`window_hanning` is another window algorithm.
81+ window_hanning : Another window algorithm.
8482 '''
8583 return x
8684
@@ -152,9 +150,9 @@ def detrend(x, key=None, axis=None):
152150
153151 key : [ 'default' | 'constant' | 'mean' | 'linear' | 'none'] or function
154152 Specifies the detrend algorithm to use. 'default' is 'mean', which is
155- the same as :func: `detrend_mean`. 'constant' is the same. 'linear' is
156- the same as :func: `detrend_linear`. 'none' is the same as
157- :func: `detrend_none`. The default is 'mean'. See the corresponding
153+ the same as `detrend_mean`. 'constant' is the same. 'linear' is
154+ the same as `detrend_linear`. 'none' is the same as
155+ `detrend_none`. The default is 'mean'. See the corresponding
158156 functions for more details regarding the algorithms. Can also be a
159157 function that carries out the detrend operation.
160158
@@ -163,14 +161,9 @@ def detrend(x, key=None, axis=None):
163161
164162 See Also
165163 --------
166- :func:`detrend_mean`
167- :func:`detrend_mean` implements the 'mean' algorithm.
168-
169- :func:`detrend_linear`
170- :func:`detrend_linear` implements the 'linear' algorithm.
171-
172- :func:`detrend_none`
173- :func:`detrend_none` implements the 'none' algorithm.
164+ detrend_mean : Implementation of the 'mean' algorithm.
165+ detrend_linear : Implementation of the 'linear' algorithm.
166+ detrend_none : Implementation of the 'none' algorithm.
174167 '''
175168 if key is None or key in ['constant' , 'mean' , 'default' ]:
176169 return detrend (x , key = detrend_mean , axis = axis )
@@ -221,9 +214,7 @@ def demean(x, axis=0):
221214
222215 See Also
223216 --------
224- :func:`detrend_mean`
225- This function is the same as :func:`detrend_mean` except for the
226- default *axis*.
217+ detrend_mean : Same as `demean` except for the default *axis*.
227218 '''
228219 return detrend_mean (x , axis = axis )
229220
@@ -244,18 +235,9 @@ def detrend_mean(x, axis=None):
244235
245236 See Also
246237 --------
247- :func:`demean`
248- This function is the same as :func:`demean` except for the default
249- *axis*.
250-
251- :func:`detrend_linear`
252-
253- :func:`detrend_none`
254- :func:`detrend_linear` and :func:`detrend_none` are other detrend
255- algorithms.
256-
257- :func:`detrend`
258- :func:`detrend` is a wrapper around all the detrend algorithms.
238+ detrend_linear : Another detrend algorithm.
239+ detrend_none : Another detrend algorithm.
240+ detrend : A wrapper around all the detrend algorithms.
259241 '''
260242 x = np .asarray (x )
261243
@@ -280,14 +262,9 @@ def detrend_none(x, axis=None):
280262
281263 See Also
282264 --------
283- :func:`detrend_mean`
284-
285- :func:`detrend_linear`
286- :func:`detrend_mean` and :func:`detrend_linear` are other detrend
287- algorithms.
288-
289- :func:`detrend`
290- :func:`detrend` is a wrapper around all the detrend algorithms.
265+ detrend_mean : Another detrend algorithm.
266+ detrend_linear : Another detrend algorithm.
267+ detrend : A wrapper around all the detrend algorithms.
291268 '''
292269 return x
293270
@@ -307,14 +284,9 @@ def detrend_linear(y):
307284
308285 See Also
309286 --------
310- :func:`detrend_mean`
311-
312- :func:`detrend_none`
313- :func:`detrend_mean` and :func:`detrend_none` are other detrend
314- algorithms.
315-
316- :func:`detrend`
317- :func:`detrend` is a wrapper around all the detrend algorithms.
287+ detrend_mean : Another detrend algorithm.
288+ detrend_none : Another detrend algorithm.
289+ detrend : A wrapper around all the detrend algorithms.
318290 '''
319291 # This is faster than an algorithm based on linalg.lstsq.
320292 y = np .asarray (y )
@@ -653,14 +625,12 @@ def _single_spectrum_helper(x, mode, Fs=None, window=None, pad_to=None,
653625 unit. The default value is 2.
654626
655627 window : callable or ndarray
656- A function or a vector of length *NFFT*. To create window
657- vectors see :func:`window_hanning`, :func:`window_none`,
658- :func:`numpy.blackman`, :func:`numpy.hamming`,
659- :func:`numpy.bartlett`, :func:`scipy.signal`,
660- :func:`scipy.signal.get_window`, etc. The default is
661- :func:`window_hanning`. If a function is passed as the
662- argument, it must take a data segment as an argument and
663- return the windowed version of the segment.
628+ A function or a vector of length *NFFT*. To create window vectors see
629+ `window_hanning`, `window_none`, `numpy.blackman`, `numpy.hamming`,
630+ `numpy.bartlett`, `scipy.signal`, `scipy.signal.get_window`, etc. The
631+ default is `window_hanning`. If a function is passed as the argument,
632+ it must take a data segment as an argument and return the windowed
633+ version of the segment.
664634
665635 sides : {'default', 'onesided', 'twosided'}
666636 Specifies which sides of the spectrum to return. Default gives the
@@ -700,18 +670,14 @@ def _single_spectrum_helper(x, mode, Fs=None, window=None, pad_to=None,
700670 result will be incorrect. Use *pad_to* for this instead.
701671
702672 detrend : {'default', 'constant', 'mean', 'linear', 'none'} or callable
703- The function applied to each segment before fft-ing,
704- designed to remove the mean or linear trend. Unlike in
705- MATLAB, where the *detrend* parameter is a vector, in
706- matplotlib is it a function. The :mod:`~matplotlib.mlab`
707- module defines :func:`~matplotlib.mlab.detrend_none`,
708- :func:`~matplotlib.mlab.detrend_mean`, and
709- :func:`~matplotlib.mlab.detrend_linear`, but you can use
710- a custom function as well. You can also use a string to choose
711- one of the functions. 'default', 'constant', and 'mean' call
712- :func:`~matplotlib.mlab.detrend_mean`. 'linear' calls
713- :func:`~matplotlib.mlab.detrend_linear`. 'none' calls
714- :func:`~matplotlib.mlab.detrend_none`.
673+ The function applied to each segment before fft-ing, designed to
674+ remove the mean or linear trend. Unlike in MATLAB, where the
675+ *detrend* parameter is a vector, in Matplotlib is it a function.
676+ The :mod:`~matplotlib.mlab` module defines `.detrend_none`,
677+ `.detrend_mean`, and `.detrend_linear`, but you can use a custom
678+ function as well. You can also use a string to choose one of the
679+ functions. 'default', 'constant', and 'mean' call `.detrend_mean`.
680+ 'linear' calls `.detrend_linear`. 'none' calls `.detrend_none`.
715681
716682 scale_by_freq : bool, optional
717683 Specifies whether the resulting density values should be scaled
@@ -770,16 +736,13 @@ def psd(x, NFFT=None, Fs=None, detrend=None, window=None,
770736
771737 See Also
772738 --------
773- :func:`specgram`
774- :func:`specgram` differs in the default overlap; in not returning the
775- mean of the segment periodograms; and in returning the times of the
776- segments.
739+ specgram
740+ `specgram` differs in the default overlap; in not returning the mean of
741+ the segment periodograms; and in returning the times of the segments.
777742
778- :func:`magnitude_spectrum`
779- :func:`magnitude_spectrum` returns the magnitude spectrum.
743+ magnitude_spectrum : returns the magnitude spectrum.
780744
781- :func:`csd`
782- :func:`csd` returns the spectral density between two signals.
745+ csd : returns the spectral density between two signals.
783746 """
784747 Pxx , freqs = csd (x = x , y = None , NFFT = NFFT , Fs = Fs , detrend = detrend ,
785748 window = window , noverlap = noverlap , pad_to = pad_to ,
@@ -839,8 +802,7 @@ def csd(x, y, NFFT=None, Fs=None, detrend=None, window=None,
839802
840803 See Also
841804 --------
842- :func:`psd`
843- :func:`psd` is the equivalent to setting y=x.
805+ psd : equivalent to setting ``y = x``.
844806 """
845807 if NFFT is None :
846808 NFFT = 256
@@ -885,19 +847,14 @@ def complex_spectrum(x, Fs=None, window=None, pad_to=None,
885847
886848 See Also
887849 --------
888- :func:`magnitude_spectrum`
889- :func:`magnitude_spectrum` returns the absolute value of this function.
890-
891- :func:`angle_spectrum`
892- :func:`angle_spectrum` returns the angle of this function.
893-
894- :func:`phase_spectrum`
895- :func:`phase_spectrum` returns the phase (unwrapped angle) of this
896- function.
897-
898- :func:`specgram`
899- :func:`specgram` can return the complex spectrum of segments within the
900- signal.
850+ magnitude_spectrum
851+ Returns the absolute value of this function.
852+ angle_spectrum
853+ Returns the angle of this function.
854+ phase_spectrum
855+ Returns the phase (unwrapped angle) of this function.
856+ specgram
857+ Can return the complex spectrum of segments within the signal.
901858 """
902859 return _single_spectrum_helper (x = x , Fs = Fs , window = window , pad_to = pad_to ,
903860 sides = sides , mode = 'complex' )
@@ -930,23 +887,16 @@ def magnitude_spectrum(x, Fs=None, window=None, pad_to=None,
930887
931888 See Also
932889 --------
933- :func:`psd`
934- :func:`psd` returns the power spectral density.
935-
936- :func:`complex_spectrum`
937- This function returns the absolute value of :func:`complex_spectrum`.
938-
939- :func:`angle_spectrum`
940- :func:`angle_spectrum` returns the angles of the corresponding
941- frequencies.
942-
943- :func:`phase_spectrum`
944- :func:`phase_spectrum` returns the phase (unwrapped angle) of the
945- corresponding frequencies.
946-
947- :func:`specgram`
948- :func:`specgram` can return the magnitude spectrum of segments within
949- the signal.
890+ psd
891+ Returns the power spectral density.
892+ complex_spectrum
893+ This function returns the absolute value of `complex_spectrum`.
894+ angle_spectrum
895+ Returns the angles of the corresponding frequencies.
896+ phase_spectrum
897+ Returns the phase (unwrapped angle) of the corresponding frequencies.
898+ specgram
899+ Can return the complex spectrum of segments within the signal.
950900 """
951901 return _single_spectrum_helper (x = x , Fs = Fs , window = window , pad_to = pad_to ,
952902 sides = sides , mode = 'magnitude' )
@@ -979,19 +929,14 @@ def angle_spectrum(x, Fs=None, window=None, pad_to=None,
979929
980930 See Also
981931 --------
982- :func:`complex_spectrum`
983- This function returns the angle value of :func:`complex_spectrum`.
984-
985- :func:`magnitude_spectrum`
986- :func:`angle_spectrum` returns the magnitudes of the corresponding
987- frequencies.
988-
989- :func:`phase_spectrum`
990- :func:`phase_spectrum` returns the unwrapped version of this function.
991-
992- :func:`specgram`
993- :func:`specgram` can return the angle spectrum of segments within the
994- signal.
932+ complex_spectrum
933+ This function returns the angle value of `complex_spectrum`.
934+ magnitude_spectrum
935+ Returns the magnitudes of the corresponding frequencies.
936+ phase_spectrum
937+ Returns the phase (unwrapped angle) of the corresponding frequencies.
938+ specgram
939+ Can return the complex spectrum of segments within the signal.
995940 """
996941 return _single_spectrum_helper (x = x , Fs = Fs , window = window , pad_to = pad_to ,
997942 sides = sides , mode = 'angle' )
@@ -1024,19 +969,14 @@ def phase_spectrum(x, Fs=None, window=None, pad_to=None,
1024969
1025970 See Also
1026971 --------
1027- :func:`complex_spectrum`
1028- This function returns the angle value of :func:`complex_spectrum`.
1029-
1030- :func:`magnitude_spectrum`
1031- :func:`magnitude_spectrum` returns the magnitudes of the corresponding
1032- frequencies.
1033-
1034- :func:`angle_spectrum`
1035- :func:`angle_spectrum` returns the wrapped version of this function.
1036-
1037- :func:`specgram`
1038- :func:`specgram` can return the phase spectrum of segments within the
1039- signal.
972+ complex_spectrum
973+ This function returns the phase value of `complex_spectrum`.
974+ magnitude_spectrum
975+ Returns the magnitudes of the corresponding frequencies.
976+ angle_spectrum
977+ Returns the angle (wrapped phase) of the corresponding frequencies.
978+ specgram
979+ Can return the complex spectrum of segments within the signal.
1040980 """
1041981 return _single_spectrum_helper (x = x , Fs = Fs , window = window , pad_to = pad_to ,
1042982 sides = sides , mode = 'phase' )
0 commit comments