21"""Simple test to see if TEOBResumS has changed
23Some functions copied from test_phenomPv3HM.py.
36 phase = np.unwrap(np.angle(h))
40 return np.sqrt( np.sum( (x-y)**2 ) )
44 compute the difference between two waveforms
45 and compare to expected value
67 approximant=lalsimulation.TEOBResumS
70 pars1 = common_pars.copy()
71 pars2 = common_pars.copy()
72 pars2.update({
"m2":20.*lal.MSUN_SI})
74 hp1, hc1 = lalsimulation.SimInspiralChooseTDWaveform(**pars1)
75 hp2, hc2 = lalsimulation.SimInspiralChooseTDWaveform(**pars2)
84 npeak1 = np.argmax(hp1_amp)
85 npeak2 = np.argmax(hp2_amp)
86 ni = min(npeak1, npeak2)
87 no = min(hp1.data.length - npeak1, hp2.data.length - npeak2)
90 hp1_amp = hp1_amp[npeak1-ni:npeak1+no]
91 hc1_amp = hc1_amp[npeak1-ni:npeak1+no]
92 hp2_amp = hp2_amp[npeak2-ni:npeak2+no]
93 hc2_amp = hc2_amp[npeak2-ni:npeak2+no]
94 hp1_phase = hp1_phase[npeak1-ni:npeak1+no]
95 hc1_phase = hc1_phase[npeak1-ni:npeak1+no]
96 hp2_phase = hp2_phase[npeak2-ni:npeak2+no]
97 hc2_phase = hc2_phase[npeak2-ni:npeak2+no]
107 return hp_amp_diff/1e6, hp_phase_diff/1e3, hc_amp_diff/1e6, hc_phase_diff/1e3
115 This test checks that TEOBResumS hasn't changed.
116 It does this by generating two TEOBResumS waveforms and computing
117 their difference (according to their amplitude
and phases)
118 and compares them to pre-computed values.
120 these pre-computed values were computed using the following line:
127 expected_result = np.array([0.27385, 0.14397, 0.27356, 0.14324])
129 np.testing.assert_almost_equal(new_result, expected_result, 5, "TEOBResumS test failed")
135if __name__ ==
'__main__':
136 sys.exit(pytest.main(args=[__file__] + sys.argv[1:] + [
'-v']))
def test_TEOBResumS()
This test checks that TEOBResumS hasn't changed.
def gen_test_data()
compute the difference between two waveforms and compare to expected value