def fftsurr(x, detrend=detrend_none, window=window_none):
 if cbook.iterable(window):
  x = (window * detrend(x))
 else:
  x = window(detrend(x))
 z = np.fft.fft(x)
 a = ((2.0 * np.pi) * 1j)
 phase = (a * np.random.rand(len(x)))
 z = (z * np.exp(phase))
 return np.fft.ifft(z).real

def fftsurr ( x , detrend = detrend_none , window = window_none ) : if cbook . iterable ( window ) : x = ( window * detrend ( x ) ) else : x = window ( detrend ( x ) ) z = np . fft . fft ( x ) a = ( ( 2.0 * np . pi ) * 1j ) phase = ( a * np . random . rand ( len ( x ) ) ) z = ( z * np . exp ( phase ) ) return np . fft . ifft ( z ) . real
compute an fft phase randomized surrogate of *x* .