Incorrect behaviour of `XLALSimIMREOBGenerateQNMFreqV2fromFinal` when mode requested is not supported
Description of problem
The function XLALSimIMREOBGenerateQNMFreqV2fromFinal
is supposed to return the QNM frequency of a given mode(s)in GR, based on a stored interpolation table. Only a certain set of modes is actually available (in particular, (2,2),(2,1),(3,3),(4,4),(5,5). However, if one calls this function with a mode which is not present, e.g. (3,2) it silently returns the wrong answer, namely the (3,3) mode. This is generic for all \ell>2
: for any (\ell, m)
one asks for it will silently return the (\ell,\ell)
mode QNM.
This should not have any effect on the past EOB waveform models because they only include the (2,2),(2,1),(3,3),(4,4) and (5,5) modes.
Expected behavior
An error is raised if one asks for a mode that is not supported.
Steps to reproduce
Consider the following code, which computes the QNM for (3,3) and (3,2) modes. The answer should not be the same:
def compute_QNM(ell, m, n, af, Mf):
qnm_temp = lal.CreateCOMPLEX16Vector(1)
lalsim.SimIMREOBGenerateQNMFreqV2fromFinal(qnm_temp, Mf, af, ell, m, 1)
omega = (qnm_temp.data * lal.MTSUN_SI)
return omega
print(compute_QNM(3,3,0,0.68,0.98))
print(compute_QNM(3,2,0,0.68,0.98))
Which outputs
[0.84786896+0.0854069j]
[0.84786896+0.0854069j]
The correct answer for (3,2) mode is 0.7665133298115957+0.0866615787630145j
.
Context/environment
This occurs on any installation of lalsuite
Suggested solutions
I believe the bug comes from if
statements being incorrect for any \ell>2
see e.g. here:
https://git.ligo.org/lscsoft/lalsuite/-/blob/master/lalsimulation/lib/LALSimBlackHoleRingdown.c#L2395
The if statement should instead be
if (m == 3) {
Same applies for the \ell=4,5
if
statements.