def get_args(freqtime, ft, ftarg): time, freq, ft, ftarg = utils.check_time( freqtime, signal, ft, ftarg, verb) # Compute eta, zeta etaH = 1/res + np.outer(2j*np.pi*freq, epermH*epsilon_0) etaV = 1/(res*aniso*aniso) + np.outer(2j*np.pi*freq, epermV*epsilon_0) zetaH = np.outer(2j*np.pi*freq, mpermH*mu_0) zetaV = np.outer(2j*np.pi*freq, mpermV*mu_0) # `model.fem`-signature changed on 9bed72b0 # (29/04/2018; bef. v1.4.1) inp = (ab, off, angle, zsrc, zrec, lsrc, lrec, depth, freq, etaH, etaV, zetaH, zetaV, False, False, ht, htarg, msrc, mrec, loop_freq, loop_off) try: if not VERSION2: inp = (*inp[:17], use_ne_eval, *inp[17:]) out = model.fem(*inp) except VariableCatch: out = model.fem(*inp[:17], True, *inp[17:]) # `model.fem` returned in the beginning only fEM; # then (fEM, kcount) and finally (fEM, kcount, conv). if isinstance(out, tuple): fEM = np.squeeze(out[0]) else: fEM = np.squeeze(out) return (fEM, time, freq, ftarg)
def test_fem(): # Just ensure functionality stays the same, with one example. for i in ['1', '2', '3', '4', '5']: res = DATAFEMTEM['out'+i][()] fEM, kcount, _ = fem(**res['inp']) assert_allclose(fEM, res['EM']) assert kcount == res['kcount']
'etaH': np.ones((3, 3)) * etaH[:, 0], 'etaV': np.ones((3, 3)) * etaV[:, 0], 'zetaH': np.ones((3, 3)) * zetaH[:, 0], 'zetaV': np.ones((3, 3)) * zetaV[:, 0], 'xdirect': True, 'isfullspace': True, 'ht': ht, 'htarg': htarg, 'use_ne_eval': False, 'msrc': True, 'mrec': True, 'loop_freq': False, 'loop_off': False } EM1, kcount1, _ = fem(**inp1) # 2. NORMAL CASE inp2 = deepcopy(inp1) inp2['etaH'] = etaH inp2['etaV'] = etaV inp2['zetaH'] = zetaH inp2['zetaV'] = zetaV inp2['isfullspace'] = False inp2['msrc'] = False inp2['mrec'] = False EM2, kcount2, _ = fem(**inp2) # 3. NORMAL CASE; loop_freq inp3 = deepcopy(inp2)