@@ -6531,9 +6531,10 @@ def psd(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
65316531 call signature::
65326532
65336533 psd(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
6534- window=mlab.window_hanning, noverlap=0, **kwargs)
6534+ window=mlab.window_hanning, noverlap=0, pad_to=None,
6535+ sides='default', **kwargs)
65356536
6536- The power spectral density by Welches average periodogram
6537+ The power spectral density by Welch's average periodogram
65376538 method. The vector *x* is divided into *NFFT* length
65386539 segments. Each segment is detrended by function *detrend* and
65396540 windowed by function *window*. *noverlap* gives the length of
@@ -6542,41 +6543,14 @@ def psd(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
65426543 scaling to correct for power loss due to windowing. *Fs* is the
65436544 sampling frequency.
65446545
6545- Keyword arguments:
6546-
6547- *NFFT*: integer
6548- The length of the fft segment, must be a power of 2
6549-
6550- *Fs*: integer
6551- The sampling frequency.
6546+ %(PSD)s
65526547
65536548 *Fc*: integer
65546549 The center frequency of *x* (defaults to 0), which offsets
65556550 the x extents of the plot to reflect the frequency range used
65566551 when a signal is acquired and then filtered and downsampled to
65576552 baseband.
65586553
6559- *detrend*:
6560- The function applied to each segment before fft-ing,
6561- designed to remove the mean or linear trend. Unlike in
6562- matlab, where the *detrend* parameter is a vector, in
6563- matplotlib is it a function. The :mod:`~matplotlib.pylab`
6564- module defines :func:`~matplotlib.pylab.detrend_none`,
6565- :func:`~matplotlib.pylab.detrend_mean`, and
6566- :func:`~matplotlib.pylab.detrend_linear`, but you can use
6567- a custom function as well.
6568-
6569- *window*:
6570- The function used to window the segments. *window* is a
6571- function, unlike in matlab where it is a vector.
6572- :mod:`~matplotlib.pylab` defines
6573- :func:`~matplotlib.pylab.window_none`, and
6574- :func:`~matplotlib.pylab.window_hanning`, but you can use
6575- a custom function as well.
6576-
6577- *noverlap*: integer
6578- Gives the length of the overlap between segments.
6579-
65806554 Returns the tuple (*Pxx*, *freqs*).
65816555
65826556 For plotting, the power is plotted as
@@ -6615,17 +6589,24 @@ def psd(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
66156589 self .set_yticks (ticks )
66166590
66176591 return pxx , freqs
6618- psd .__doc__ = cbook .dedent (psd .__doc__ ) % martist .kwdocd
6592+
6593+ psd_doc_dict = dict ()
6594+ psd_doc_dict .update (martist .kwdocd )
6595+ psd_doc_dict .update (mlab .kwdocd )
6596+ psd_doc_dict ['PSD' ] = cbook .dedent (psd_doc_dict ['PSD' ])
6597+ psd .__doc__ = cbook .dedent (psd .__doc__ ) % psd_doc_dict
66196598
66206599 def csd (self , x , y , NFFT = 256 , Fs = 2 , Fc = 0 , detrend = mlab .detrend_none ,
6621- window = mlab .window_hanning , noverlap = 0 , ** kwargs ):
6600+ window = mlab .window_hanning , noverlap = 0 , pad_to = None ,
6601+ sides = 'default' , ** kwargs ):
66226602 """
66236603 call signature::
66246604
66256605 csd(x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
6626- window=window_hanning, noverlap=0, **kwargs)
6606+ window=mlab.window_hanning, noverlap=0, pad_to=None,
6607+ sides='default', **kwargs)
66276608
6628- The cross spectral density :math:`P_{xy}` by Welches average
6609+ The cross spectral density :math:`P_{xy}` by Welch's average
66296610 periodogram method. The vectors *x* and *y* are divided into
66306611 *NFFT* length segments. Each segment is detrended by function
66316612 *detrend* and windowed by function *window*. The product of
@@ -6637,6 +6618,14 @@ def csd(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
66376618 (complex valued), and :math:`10\log_{10}|P_{xy}|` is
66386619 plotted.
66396620
6621+ %(PSD)s
6622+
6623+ *Fc*: integer
6624+ The center frequency of *x* (defaults to 0), which offsets
6625+ the x extents of the plot to reflect the frequency range used
6626+ when a signal is acquired and then filtered and downsampled to
6627+ baseband.
6628+
66406629 References:
66416630 Bendat & Piersol -- Random Data: Analysis and Measurement
66426631 Procedures, John Wiley & Sons (1986)
@@ -6654,7 +6643,8 @@ def csd(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
66546643 For a description of the optional parameters.
66556644 """
66566645 if not self ._hold : self .cla ()
6657- pxy , freqs = mlab .csd (x , y , NFFT , Fs , detrend , window , noverlap )
6646+ pxy , freqs = mlab .csd (x , y , NFFT , Fs , detrend , window , noverlap ,
6647+ pad_to , sides )
66586648 pxy .shape = len (freqs ),
66596649 # pxy is complex
66606650 freqs += Fc
@@ -6672,7 +6662,8 @@ def csd(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
66726662 self .set_yticks (ticks )
66736663
66746664 return pxy , freqs
6675- csd .__doc__ = cbook .dedent (csd .__doc__ ) % martist .kwdocd
6665+ csd .__doc__ = cbook .dedent (csd .__doc__ ) % psd_doc_dict
6666+ del psd_doc_dict #So that this does not become an Axes attribute
66766667
66776668 def cohere (self , x , y , NFFT = 256 , Fs = 2 , Fc = 0 , detrend = mlab .detrend_none ,
66786669 window = mlab .window_hanning , noverlap = 0 , ** kwargs ):
0 commit comments