30 phase = np.unwrap(np.angle(h))
34 return np.sqrt( np.sum( (x-y)**2 ) )
38 compute the difference between two waveforms
39 and compare to expected value
41 lalparams = lal.CreateDict()
44 ModeArray = lalsimulation.SimInspiralCreateModeArray()
45 for mode
in mode_array:
46 lalsimulation.SimInspiralModeArrayActivateMode(ModeArray, mode[0], mode[1])
47 lalsimulation.SimInspiralWaveformParamsInsertModeArray(lalparams, ModeArray)
50 lalsimulation.SimInspiralWaveformParamsInsertPhenomXPrecVersion(lalparams, PV)
52 lalsimulation.SimInspiralWaveformParamsInsertPhenomXPFinalSpinMod(lalparams, FS)
73 approximant=approximant
76 pars1=common_pars.copy()
78 pars2=common_pars.copy()
79 pars2.update({
"inclination":0.17})
80 pars2.update({
"phiRef":0.5})
82 hp1, hc1 = lalsimulation.SimInspiralChooseTDWaveform(**pars1)
83 hp2, hc2 = lalsimulation.SimInspiralChooseTDWaveform(**pars2)
86 h1_amp, h1_phase =
get_amp_phase(hp1.data.data - 1j * hc1.data.data)
88 h2_amp, h2_phase =
get_amp_phase(hp2.data.data - 1j * hc2.data.data)
93 return h_amp_diff, h_phase_diff
100 This test checks that IMRPhenomT hasn't changed.
101 It does this by generating two PhenomT waveforms and computing
102 their difference (according to their amplitude
and phases)
103 and compares them to pre-computed values.
105 these pre-computed values were computed using the following line:
107 `expected_result = np.array(
gen_test_data(0., lalsimulation.IMRPhenomT))`
111 expected_result = np.array([170742.89185874866, 38.13925592958284])
113 new_result = np.array(gen_test_data(0., lalsimulation.IMRPhenomT, None,
None,
None))
115 np.testing.assert_allclose(new_result, expected_result, rtol=1e-6, err_msg=
"IMRPhenomT test failed")
119 This test checks that IMRPhenomTHM hasn't changed.
120 It does this by generating two PhenomTHM waveforms and computing
121 their difference (according to their amplitude
and phases)
122 and compares them to pre-computed values.
124 these pre-computed values were computed using the following line:
126 `expected_result = np.array(
gen_test_data(0., lalsimulation.IMRPhenomTHM))`
130 expected_result = np.array([170645.95870333136, 200.68861022453908])
132 new_result = np.array(gen_test_data(0., lalsimulation.IMRPhenomTHM, None,
None,
None))
134 np.testing.assert_allclose(new_result, expected_result, rtol=1e-6, err_msg=
"IMRPhenomTHM test failed")
138 This test checks that IMRPhenomTPHM hasn't changed.
139 It does this by generating two PhenomTHM waveforms and computing
140 their difference (according to their amplitude
and phases)
141 and compares them to pre-computed values.
143 these pre-computed values were computed using the following line:
145 `expected_result = np.array(
gen_test_data(0.5, lalsimulation.IMRPhenomTP,
None, PV, FS))`
149 stored_resultsTP={None: {
None: (188638.18910822965, 32.420295013783644)}}
151 PVs = stored_resultsTP.keys()
154 FSs = stored_resultsTP[PV].keys()
157 expected_result = stored_resultsTP[PV][FS]
159 new_result = np.array(
gen_test_data(0.5, lalsimulation.IMRPhenomTP,
None, PV, FS))
161 np.testing.assert_allclose(new_result, expected_result, rtol=2e-3, err_msg=
"IMRPhenomTP test failed")
166 This test checks that IMRPhenomTPHM hasn't changed.
167 It does this by generating two PhenomTHM waveforms and computing
168 their difference (according to their amplitude
and phases)
169 and compares them to pre-computed values.
171 these pre-computed values were computed using the following line:
173 `expected_result = np.array(
gen_test_data(0.5, lalsimulation.IMRPhenomTPHM,
None, PV, FS))`
177 stored_resultsTPHM={None: {
None: (189109.04099927619, 207.74817055168765)}}
179 PVs = stored_resultsTPHM.keys()
182 FSs = stored_resultsTPHM[PV].keys()
185 expected_result = stored_resultsTPHM[PV][FS]
187 new_result = np.array(
gen_test_data(0.5, lalsimulation.IMRPhenomTPHM,
None, PV, FS))
189 np.testing.assert_allclose(new_result, expected_result, rtol=1e-4, err_msg=
"IMRPhenomTPHM test failed")
192if __name__ ==
'__main__':
193 args = sys.argv[1:]
or [
"-v",
"-rs",
"--junit-xml=junit-phenomT.xml"]
194 sys.exit(pytest.main(args=[__file__] + args))
def test_IMRPhenomT()
This test checks that IMRPhenomT hasn't changed.
def test_IMRPhenomTP()
This test checks that IMRPhenomTPHM hasn't changed.
def gen_test_data(spin1x, approximant, mode_array, PV, FS)
compute the difference between two waveforms and compare to expected value
def test_IMRPhenomTPHM()
This test checks that IMRPhenomTPHM hasn't changed.
def test_IMRPhenomTHM()
This test checks that IMRPhenomTHM hasn't changed.