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

Method cohere

lib/matplotlib/axes/_axes.py:8448–8508  ·  view source on GitHub ↗

r""" Plot the coherence between *x* and *y*. Coherence is the normalized cross spectral density: .. math:: C_{xy} = \frac{|P_{xy}|^2}{P_{xx}P_{yy}} Parameters ---------- %(Spectral)s %(PSD)s noverlap : int, default: 0 (n

(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
               window=mlab.window_hanning, noverlap=0, pad_to=None,
               sides='default', scale_by_freq=None, **kwargs)

Source from the content-addressed store, hash-verified

8446 @_preprocess_data(replace_names=["x", "y"])
8447 @_docstring.interpd
8448 def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
8449 window=mlab.window_hanning, noverlap=0, pad_to=None,
8450 sides='default', scale_by_freq=None, **kwargs):
8451 r"""
8452 Plot the coherence between *x* and *y*.
8453
8454 Coherence is the normalized cross spectral density:
8455
8456 .. math::
8457
8458 C_{xy} = \frac{|P_{xy}|^2}{P_{xx}P_{yy}}
8459
8460 Parameters
8461 ----------
8462 %(Spectral)s
8463
8464 %(PSD)s
8465
8466 noverlap : int, default: 0 (no overlap)
8467 The number of points of overlap between blocks.
8468
8469 Fc : int, default: 0
8470 The center frequency of *x*, which offsets the x extents of the
8471 plot to reflect the frequency range used when a signal is acquired
8472 and then filtered and downsampled to baseband.
8473
8474 Returns
8475 -------
8476 Cxy : 1-D array
8477 The coherence vector.
8478
8479 freqs : 1-D array
8480 The frequencies for the elements in *Cxy*.
8481
8482 Other Parameters
8483 ----------------
8484 data : indexable object, optional
8485 DATA_PARAMETER_PLACEHOLDER
8486
8487 **kwargs
8488 Keyword arguments control the `.Line2D` properties:
8489
8490 %(Line2D:kwdoc)s
8491
8492 References
8493 ----------
8494 Bendat & Piersol -- Random Data: Analysis and Measurement Procedures,
8495 John Wiley & Sons (1986)
8496 """
8497 cxy, freqs = mlab.cohere(x=x, y=y, NFFT=NFFT, Fs=Fs, detrend=detrend,
8498 window=window, noverlap=noverlap,
8499 scale_by_freq=scale_by_freq, sides=sides,
8500 pad_to=pad_to)
8501 freqs += Fc
8502
8503 self.plot(freqs, cxy, **kwargs)
8504 self.set_xlabel('Frequency')
8505 self.set_ylabel('Coherence')

Callers 3

cohereFunction · 0.80
test_cohereFunction · 0.80
cohere.pyFile · 0.80

Calls 4

plotMethod · 0.95
gridMethod · 0.95
set_xlabelMethod · 0.80
set_ylabelMethod · 0.80

Tested by 1

test_cohereFunction · 0.64