'Plot the cross-spectral density.
Call signature::
csd(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, return_line=None, **kwargs)
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 *window*.  *noverlap* gives
the length of the overlap between segments.  The product of
the direct FFTs of *x* and *y* are averaged over each segment
to compute :math:`P_{xy}`, with a scaling to correct for power
loss due to windowing.
If len(*x*) < *NFFT* or len(*y*) < *NFFT*, they will be zero
padded to *NFFT*.
Parameters
x, y : 1-D arrays or sequences
Arrays or sequences containing the data
%(Spectral)s
%(PSD)s
noverlap : integer
The number of points of overlap between segments.
The default value is 0 (no overlap).
Fc : integer
The center frequency of *x* (defaults to 0), which offsets
the x extents of the plot to reflect the frequency range used
when a signal is acquired and then filtered and downsampled to
baseband.
return_line : bool
Whether to include the line object plotted in the returned values.
Default is False.
Returns
Pxy : 1-D array
The values for the cross spectrum `P_{xy}` before scaling
(complex valued)
freqs : 1-D array
The frequencies corresponding to the elements in *Pxy*
line : a :class:`~matplotlib.lines.Line2D` instance
The line created by this function.
Only returned if *return_line* is True.
Other Parameters
**kwargs :
Keyword arguments control the :class:`~matplotlib.lines.Line2D`
properties:
%(Line2D)s
Notes
For plotting, the power is plotted as
:math:`10\log_{10}(P_{xy})` for decibels, though `P_{xy}` itself
is returned.
References
Bendat & Piersol -- Random Data: Analysis and Measurement Procedures,
John Wiley & Sons (1986)
See Also
:func:`psd`
:func:`psd` is the equivalent to setting y=x.'

@_preprocess_data(replace_names=[u'x', u'y'], label_namer=u'y')
@docstring.dedent_interpd
def csd(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):

    if (not self._hold):
        self.cla()
    if (Fc is None):
        Fc = 0
    (pxy, freqs) = mlab.csd(x=x, y=y, NFFT=NFFT, Fs=Fs, detrend=detrend, window=window, noverlap=noverlap, pad_to=pad_to, sides=sides, scale_by_freq=scale_by_freq)
    freqs += Fc
    line = self.plot(freqs, (10 * np.log10(np.abs(pxy))), **kwargs)
    self.set_xlabel(u'Frequency')
    self.set_ylabel(u'Cross    Spectrum    Magnitude    (dB)')
    self.grid(True)
    (vmin, vmax) = self.viewLim.intervaly
    intv = (vmax - vmin)
    step = (10 * int(np.log10(intv)))
    ticks = np.arange(math.floor(vmin), (math.ceil(vmax) + 1), step)
    self.set_yticks(ticks)
    if ((return_line is None) or (not return_line)):
        return (pxy, freqs)
    else:
        return (pxy, freqs, line)
