def cross_correlation1(fft1, fft2, maxlag, dt, Nfft):
    corr = np.zeros(fft1.shape, dtype=np.complex64)
    corr = (np.conj(fft1) * fft2)
    ncorr = np.zeros((fft1.shape[0], Nfft), dtype=np.complex64)
    ncorr[:, :(Nfft // 2)] = corr[:, :]
    ncorr[:, ((- (Nfft // 2)) + 1):] = np.flip(np.conj(ncorr[:, 1:(Nfft // 2)]), axis=1)
    ncorr[:, 0] = complex(0, 0)
    ncorr = np.real(np.fft.ifftshift(scipy.fftpack.ifft(ncorr, Nfft, axis=1)))
    tcorr = (np.arange((((- Nfft) // 2) + 1), (Nfft // 2)) * dt)
    ind = np.where((np.abs(tcorr) <= maxlag))[0]
    ncorr = ncorr[:, ind]
    ncorr = np.mean(ncorr, axis=0)
    return ncorr
def cross_correlation1(fft1, fft2, maxlag, dt, Nfft):
    corr = np.zeros(fft1.shape, dtype=np.complex64)
    corr = (np.conj(fft1) * fft2)
    ncorr = np.zeros((fft1.shape[0], Nfft), dtype=np.complex64)
    ncorr[:, :(Nfft // 2)] = corr[:, :]
    ncorr[:, ((- (Nfft // 2)) + 1):] = np.flip(np.conj(ncorr[:, 1:(Nfft // 2)]), axis=1)
    ncorr[:, 0] = complex(0, 0)
    ncorr = np.real(np.fft.ifftshift(scipy.fftpack.ifft(ncorr, Nfft, axis=1)))
    tcorr = (np.arange((((- Nfft) // 2) + 1), (Nfft // 2)) * dt)
    ind = np.where((np.abs(tcorr) <= maxlag))[0]
    ncorr = ncorr[:, ind]
    ncorr = np.mean(ncorr, axis=0)
    return ncorr