def test_Marchenko_timemulti_ana(par):
    """Solve marchenko equations using input Rs in time domain with multiple
    points
    """
    MarchenkoWM = Marchenko(R, dt=dt, dr=dr, nfmax=nfmax, wav=wav,
                            toff=toff, nsmooth=nsmooth)

    _, _, g_inv_minus, g_inv_plus = \
        MarchenkoWM.apply_multiplepoints(trav_multi, nfft=2**11, rtm=False,
                                         greens=True, dottest=True,
                                         **dict(iter_lim=par['niter'],
                                                show=0))
    ginvsub = (g_inv_minus + g_inv_plus)[:, 1, nt - 1:].T
    ginvsub_norm = ginvsub / ginvsub.max()
    gsub_norm = gsub / gsub.max()
    assert np.linalg.norm(gsub_norm - ginvsub_norm) / \
           np.linalg.norm(gsub_norm) < 1e-1
def test_Marchenko_multi(par):
    """Dot-test and comparison with pylops for Marchenko.apply_multiplepoints
    """
    if par['prescaled']:
        dRtwosided_fft_sc = np.sqrt(2 * nt - 1) * dt * dr * dRtwosided_fft
        Rtwosided_fft_sc = np.sqrt(2 * nt - 1) * dt * dr * Rtwosided_fft
    else:
        dRtwosided_fft_sc = dRtwosided_fft
        Rtwosided_fft_sc = Rtwosided_fft

    dMarchenkoWM = dMarchenko(dRtwosided_fft_sc,
                              nt=nt,
                              dt=dt,
                              dr=dr,
                              wav=wav,
                              toff=toff,
                              nsmooth=nsmooth,
                              saveRt=par['saveRt'],
                              prescaled=par['prescaled'])

    MarchenkoWM = Marchenko(Rtwosided_fft_sc,
                            nt=nt,
                            dt=dt,
                            dr=dr,
                            wav=wav,
                            toff=toff,
                            nsmooth=nsmooth,
                            prescaled=par['prescaled'])

    _, _, dp0_minus, dg_inv_minus, dg_inv_plus = \
        dMarchenkoWM.apply_multiplepoints(trav_multi, nfft=2 ** 11, rtm=True,
                                          greens=True, dottest=True,
                                          **dict(niter=10, compute=False))

    _, _, p0_minus = \
        MarchenkoWM.apply_multiplepoints(trav_multi, nfft=2 ** 11, rtm=True,
                                         greens=False, dottest=False,
                                         **dict(iter_lim=0, show=0))
    assert_array_almost_equal(dp0_minus, p0_minus, decimal=5)

    dginvsub = (dg_inv_minus + dg_inv_plus)[:, 1, nt - 1:].T
    dginvsub_norm = dginvsub / dginvsub.max()
    gsub_norm = gsub / gsub.max()
    assert np.linalg.norm(gsub_norm - dginvsub_norm) / \
           np.linalg.norm(gsub_norm) < 1e-1