def freq_domain_xcorr(tseries, events, t_before, t_after, Fs=1):
    fft = fftpack.fft
    ifft = fftpack.ifft
    fftshift = fftpack.fftshift

    xcorr = np.real(fftshift(ifft(fft(tseries) *
                                  fft(np.fliplr([events])))))

    return xcorr[0][int(np.ceil(len(xcorr[0]) // 2) - t_before * Fs):
                    int(np.ceil(len(xcorr[0]) // 2) + t_after // 2 * Fs)] / np.sum(events)
Calculates the  event related timeseries, using a cross-correlation in the
dataset/ETHPy150Open nipy/nitime/nitime/algorithms/event_related.py/freq_domain_xcorr