2This script checks that the list of approximants
3has not been changed in a backward-incompatible way
4by reordering the Approximant enum.
8import lalsimulation
as lalsim
21 'TaylorF2RedSpinTidal': 10,
32 'SpinTaylorFrameless': 22,
35 'PhenSpinTaylorRD': 25,
58 'SEOBNRv3_opt_rk4': 48,
65 'SEOBNRv1_ROM_EffectiveSpin': 55,
66 'SEOBNRv1_ROM_DoubleSpin': 56,
67 'SEOBNRv2_ROM_EffectiveSpin': 57,
68 'SEOBNRv2_ROM_DoubleSpin': 58,
69 'SEOBNRv2_ROM_DoubleSpin_HI': 59,
70 'Lackey_Tidal_2013_SEOBNRv2_ROM': 60,
73 'SEOBNRv4_ROM_NRTidal': 63,
74 'SEOBNRv4_ROM_NRTidalv2': 64,
75 'SEOBNRv4_ROM_NRTidalv2_NSBH': 65,
76 'SEOBNRv4T_surrogate': 66,
84 'IMRPhenomD_NRTidal': 74,
85 'IMRPhenomD_NRTidalv2': 75,
90 'IMRPhenomPv2_NRTidal': 80,
91 'IMRPhenomPv2_NRTidalv2': 81,
97 'SpinTaylorT4Fourier': 87,
98 'SpinTaylorT5Fourier': 88,
99 'SpinDominatedWf': 89,
109 'IMRPhenomPv3HM': 99,
111 'IMRPhenomXPHM': 101,
116 'IMRPhenomTPHM': 106,
118 'SEOBNRv4HM_PA': 108,
119 'pSEOBNRv4HM_PA': 109,
120 'IMRPhenomXAS_NRTidalv2': 110,
121 'IMRPhenomXP_NRTidalv2': 111,
122 'IMRPhenomXO4a': 112,
123 'ExternalPython': 113,
124 'SEOBNRv5HM_ROM': 114,
125 'IMRPhenomXAS_NRTidalv3': 115,
126 'IMRPhenomXP_NRTidalv3': 116,
127 'SEOBNRv5_ROM_NRTidalv3': 117
130@pytest.mark.parametrize("name, i", known_approximants.items())
132 a = lalsim.GetApproximantFromString(name)
134 "The Approximant enum is modified in an non-backward-compatible way, "
135 "Approximant {name} is {a} but it should be {i}; "
136 "please append new approximants to the Approximants enum in LALSimInspiral.h, "
137 "rather than reordering the list".format(
147 Function here for convenience
if you need to regenerate the list
151 for i
in range(lalsim.NumApproximants):
153 appx[lalsim.GetStringFromApproximant(i)]=i
156 print(
'No approximant numbered {}'.format(i))
160if __name__ ==
'__main__':
161 args = sys.argv[1:]
or [
"-v",
"-rs",
"--junit-xml=junit-enum_compatibility.xml"]
162 sys.exit(pytest.main(args=[__file__] + args))
def regenerate_known_approximants()
Function here for convenience if you need to regenerate the list Not used in test.
def test_approximant(name, i)