def csd(x, y, fs=1.0, window='hann', nperseg=None, noverlap=None, nfft=None, detrend='constant', return_onesided=True, scaling='density', axis=(-1)):
 (freqs, _, Pxy) = _spectral_helper(x, y, fs, window, nperseg, noverlap, nfft, detrend, return_onesided, scaling, axis, mode='psd')
 if ((len(Pxy.shape) >= 2) and (Pxy.size > 0)):
  if (Pxy.shape[(-1)] > 1):
   Pxy = Pxy.mean(axis=(-1))
  else:
   Pxy = np.reshape(Pxy, Pxy.shape[:(-1)])
 return (freqs, Pxy)

def csd ( x , y , fs = 1.0 , window = 'hann' , nperseg = None , noverlap = None , nfft = None , detrend = 'constant' , return_onesided = True , scaling = 'density' , axis = ( - 1 ) ) : ( freqs , _ , Pxy ) = _spectral_helper ( x , y , fs , window , nperseg , noverlap , nfft , detrend , return_onesided , scaling , axis , mode = 'psd' ) if ( ( len ( Pxy . shape ) >= 2 ) and ( Pxy . size > 0 ) ) : if ( Pxy . shape [ ( - 1 ) ] > 1 ) : Pxy = Pxy . mean ( axis = ( - 1 ) ) else : Pxy = np . reshape ( Pxy , Pxy . shape [ : ( - 1 ) ] ) return ( freqs , Pxy )
estimate the cross power spectral density .