19Simple test to see if SEOBNRv5_ROM_NRTidalv3 have changed
20Adapted from test_SEOBNRv5HM_ROM.py.
26 from pathlib
import Path
27except ImportError
as exc:
29 warnings.warn(str(exc))
41 phase = np.unwrap(np.angle(h))
45 return np.sqrt( np.sum( (x-y)**2 ) )
49 compute the difference between two waveforms
50 and compare to expected value
53 LALparams = lal.CreateDict()
56 lalsimulation.SimInspiralWaveformParamsInsertTidalLambda1(LALparams, lambda1)
57 lalsimulation.SimInspiralWaveformParamsInsertTidalLambda2(LALparams, lambda2)
78 approximant=approximant
81 pars1 = common_pars.copy()
83 pars2 = common_pars.copy()
84 pars2.update({"m2":1.0*lal.MSUN_SI})
85 hp1, hc1 = lalsimulation.SimInspiralChooseFDWaveform(**pars1)
86 hp2, hc2 = lalsimulation.SimInspiralChooseFDWaveform(**pars2)
101 return hp_amp_diff, hp_phase_diff, hc_amp_diff, hc_phase_diff
108 "LAL_DATA_PATH" not in os.environ,
109 reason=
"LAL_DATA_PATH not found",
113 This test checks that SEOBNRv5_ROM_NRTidalv3 hasn't changed.
114 It does this by generating two SEOBNRv5_ROM_NRTidalv3 waveforms and computing
115 their difference (according to their amplitude
and phases)
116 and compares them to pre-computed values.
118 these pre-computed values were computed using the following line:
120 `expected_result = np.array(
gen_test_data(lalsimulation.SEOBNRv5_ROM_NRTidalv3))`
122 LAL_DATA_PATH = os.environ['LAL_DATA_PATH']
123 for D
in LAL_DATA_PATH.split(
':'):
124 path = Path(D) /
"SEOBNRv5ROM_v1.0.hdf5"
126 have_ROM_data_file =
True
130 "SEOBNRv5ROM_v1.0.hdf5 not found in $LAL_DATA_PATH:{}".format(LAL_DATA_PATH),
133 expected_result = np.array([35.01601891, 1112.2071495, 35.01601891, 1112.0829081])
134 new_result = np.array(
gen_test_data(lalsimulation.SEOBNRv5_ROM_NRTidalv3))
135 np.testing.assert_almost_equal(new_result, expected_result, 7,
"SEOBNRv5ROM_NRTidalv3 test failed")
139if __name__ ==
'__main__':
140 if "LAL_DATA_PATH" not in os.environ:
141 warnings.warn(
"LAL_DATA_PATH not found, cannot execute tests")
143 args = sys.argv[1:]
or [
"-v",
"-rs",
"--junit-xml=junit-SEOBNRv5_ROM_NRTidalv3.xml"]
144 sys.exit(pytest.main(args=[__file__] + args))
def gen_test_data(approximant)
compute the difference between two waveforms and compare to expected value
def test_SEOBNRv5_ROM_NRTidalv3()
This test checks that SEOBNRv5_ROM_NRTidalv3 hasn't changed.