MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / csd

Method csd

lib/matplotlib/axes/_axes.py:8118–8216  ·  view source on GitHub ↗

r""" Plot the cross-spectral density. The cross spectral density :math:`P_{xy}` by Welch's average periodogram method. The vectors *x* and *y* are divided into *NFFT* length segments. Each segment is detrended by function *detrend* and windowed by function

(self, x, y, NFFT=None, Fs=None, Fc=None, detrend=None,
            window=None, noverlap=None, pad_to=None,
            sides=None, scale_by_freq=None, return_line=None, **kwargs)

Source from the content-addressed store, hash-verified

8116 @_preprocess_data(replace_names=["x", "y"], label_namer="y")
8117 @_docstring.interpd
8118 def csd(self, x, y, NFFT=None, Fs=None, Fc=None, detrend=None,
8119 window=None, noverlap=None, pad_to=None,
8120 sides=None, scale_by_freq=None, return_line=None, **kwargs):
8121 r"""
8122 Plot the cross-spectral density.
8123
8124 The cross spectral density :math:`P_{xy}` by Welch's average
8125 periodogram method. The vectors *x* and *y* are divided into
8126 *NFFT* length segments. Each segment is detrended by function
8127 *detrend* and windowed by function *window*. *noverlap* gives
8128 the length of the overlap between segments. The product of
8129 the direct FFTs of *x* and *y* are averaged over each segment
8130 to compute :math:`P_{xy}`, with a scaling to correct for power
8131 loss due to windowing.
8132
8133 If len(*x*) < *NFFT* or len(*y*) < *NFFT*, they will be zero
8134 padded to *NFFT*.
8135
8136 Parameters
8137 ----------
8138 x, y : 1-D arrays or sequences
8139 Arrays or sequences containing the data.
8140
8141 %(Spectral)s
8142
8143 %(PSD)s
8144
8145 noverlap : int, default: 0 (no overlap)
8146 The number of points of overlap between segments.
8147
8148 Fc : int, default: 0
8149 The center frequency of *x*, which offsets the x extents of the
8150 plot to reflect the frequency range used when a signal is acquired
8151 and then filtered and downsampled to baseband.
8152
8153 return_line : bool, default: False
8154 Whether to include the line object plotted in the returned values.
8155
8156 Returns
8157 -------
8158 Pxy : 1-D array
8159 The values for the cross spectrum :math:`P_{xy}` before scaling
8160 (complex valued).
8161
8162 freqs : 1-D array
8163 The frequencies corresponding to the elements in *Pxy*.
8164
8165 line : `~matplotlib.lines.Line2D`
8166 The line created by this function.
8167 Only returned if *return_line* is True.
8168
8169 Other Parameters
8170 ----------------
8171 data : indexable object, optional
8172 DATA_PARAMETER_PLACEHOLDER
8173
8174 **kwargs
8175 Keyword arguments control the `.Line2D` properties:

Callers 7

csdFunction · 0.80
test_csdMethod · 0.80
test_csd_paddingMethod · 0.80
test_psd_csd_equalMethod · 0.80
test_psd_csdFunction · 0.80
test_psd_csd_edge_casesFunction · 0.80
csd_demo.pyFile · 0.80

Calls 6

plotMethod · 0.95
gridMethod · 0.95
set_xlabelMethod · 0.80
set_ylabelMethod · 0.80
get_yboundMethod · 0.80
set_yticksMethod · 0.80

Tested by 5

test_csdMethod · 0.64
test_csd_paddingMethod · 0.64
test_psd_csd_equalMethod · 0.64
test_psd_csdFunction · 0.64
test_psd_csd_edge_casesFunction · 0.64