示例#1
0
def test_fields():  # 4. fields
    dat = DATAKERNEL['fields'][()]
    for key, val in dat.items():
        for i in [2, 4, 6, 8, 10]:
            ab = val[0]
            TM = val[1]
            Pu, Pd = kernel.fields(ab=ab, TM=TM, **val[i])
            assert_allclose(Pu, val[i + 1][0])
            assert_allclose(Pd, val[i + 1][1])
            val[i]['use_ne_eval'] = use_ne_eval
            Pu, Pd = kernel.fields(ab=ab, TM=TM, **val[i])
            assert_allclose(Pu, val[i + 1][0])
            assert_allclose(Pd, val[i + 1][1])
示例#2
0
def test_fields():
    Gam = np.sqrt((etaH/etaV)[:, None, :, None] *
                  (lambd**2)[None, :, None, :] + (zeta**2)[:, None, :, None])

    for lay in [0, 1, 5]:  # Src/rec in first, second, and last layer

        inp1 = {'depth': depth[:-1], 'e_zH': etaH, 'Gam': Gam,
                'lrec': np.array(lay), 'lsrc': np.array(lay)}
        Rp1, Rm1 = kernel.reflections(**inp1)

        inp2 = {'depth': depth[:-1], 'Gam': Gam, 'Rp': Rp1, 'Rm': Rm1,
                'lrec': np.array(lay), 'lsrc': np.array(lay),
                'zsrc': depth[lay+1]-50}

        for TM in [True, False]:
            inp2['TM'] = TM

            # empymod-version
            out = kernel.fields(ab=11, **inp2)

            # empymod.scripts-version
            TMTE = tmtemod.fields(**inp2)

            # Check
            assert_allclose(out[0], TMTE[0] + TMTE[1])
            assert_allclose(out[1], TMTE[2] + TMTE[3])
示例#3
0
文件: kernel.py 项目: visiope/empymod
inp11 = {'depth': depth,
         'Rp': Rp5,
         'Rm': Rm5,
         'Gam': Gam,
         'lrec': np.array(5),
         'lsrc': np.array(0),
         'zsrc': -30.}


fields = {}
for TM in [False, True]:
    for ab in pab:
        if TM and ab in [16, 26]:
            continue
        elif not TM and ab in [13, 23, 31, 32, 33, 34, 35]:
            continue
        elif ab == 36:
            continue

        out1 = kernel.fields(ab=ab, TM=TM, **inp7)
        out2 = kernel.fields(ab=ab, TM=TM, **inp8)
        out3 = kernel.fields(ab=ab, TM=TM, **inp9)
        out4 = kernel.fields(ab=ab, TM=TM, **inp10)
        out5 = kernel.fields(ab=ab, TM=TM, **inp11)
        fields[ab] = (ab, TM, inp7, out1, inp8, out2, inp9, out3, inp10, out4,
                      inp11, out5)

# # F -- Store data # #
np.savez_compressed('../data/kernel.npz', angres=angres, wave=wave,
                    green=green, refl=refl, fields=fields)