def _csd_from_mt(x_mt, y_mt, weights_x, weights_y):
 csd = np.sum(((weights_x * x_mt) * (weights_y * y_mt).conj()), axis=(-2))
 denom = (np.sqrt((weights_x * weights_x.conj()).real.sum(axis=(-2))) * np.sqrt((weights_y * weights_y.conj()).real.sum(axis=(-2))))
 csd *= (2 / denom)
 return csd

def _csd_from_mt ( x_mt , y_mt , weights_x , weights_y ) : csd = np . sum ( ( ( weights_x * x_mt ) * ( weights_y * y_mt ) . conj ( ) ) , axis = ( - 2 ) ) denom = ( np . sqrt ( ( weights_x * weights_x . conj ( ) ) . real . sum ( axis = ( - 2 ) ) ) * np . sqrt ( ( weights_y * weights_y . conj ( ) ) . real . sum ( axis = ( - 2 ) ) ) ) csd *= ( 2 / denom ) return csd
compute csd from tapered spectra .