def _fft_helper(x, win, detrend_func, nperseg, noverlap, nfft):
 from scipy import fftpack
 if ((nperseg == 1) and (noverlap == 0)):
  result = x[..., np.newaxis]
 else:
  step = (nperseg - noverlap)
  shape = (x.shape[:(-1)] + (((x.shape[(-1)] - noverlap) // step), nperseg))
  strides = (x.strides[:(-1)] + ((step * x.strides[(-1)]), x.strides[(-1)]))
  result = np.lib.stride_tricks.as_strided(x, shape=shape, strides=strides)
 result = detrend_func(result)
 result = (win * result)
 result = fftpack.fft(result, n=nfft)
 return result

def _fft_helper ( x , win , detrend_func , nperseg , noverlap , nfft ) : from scipy import fftpack if ( ( nperseg == 1 ) and ( noverlap == 0 ) ) : result = x [ ... , np . newaxis ] else : step = ( nperseg - noverlap ) shape = ( x . shape [ : ( - 1 ) ] + ( ( ( x . shape [ ( - 1 ) ] - noverlap ) // step ) , nperseg ) ) strides = ( x . strides [ : ( - 1 ) ] + ( ( step * x . strides [ ( - 1 ) ] ) , x . strides [ ( - 1 ) ] ) ) result = np . lib . stride_tricks . as_strided ( x , shape = shape , strides = strides ) result = detrend_func ( result ) result = ( win * result ) result = fftpack . fft ( result , n = nfft ) return result
calculate windowed fft .