likelihood value is truncated for cwb events
I got an email this morning from Edoardo Milotti:
Hi Alex,
I noticed a small problem in the events uploaded by cWB on the playground. The field that is
identified as “likelihood” in the text files (a floating point number) is used by GraceDB
to calculate the “SNR” field in the event page: SNR = sort(likelihood). It seems that the
underlying code treats “likelihood” as an integer and the SNR result differs from the expected
one, can you please check? A quick check shows that the same problem exists for real events in GraceDB.
Thank you.
Best, Edoardo
I dug into it on production and playground, and it would appear that he's (kind of) right. Likelihood is still a float value, but it's being truncated when the event file is read in.
For example, this event on playground. The uploaded file has the following value for likelihood:
...
...
likelihood: 1.503621e+02
...
...
But in the database, it shows it as:
In [1]: from events.models import Event
In [2]: a = Event.getByGraceid('G240121')
In [3]: a
Out[3]: <MultiBurstEvent: G240121>
In [4]: a.likelihood
Out[4]: 150.0
The result of this is that the snr that is reported on the event page is slightly incorrect from the expected value, since GraceDB computes snr=sqrt(likelihood) for CWB events (code is here).
Also, as far as I can tell, this behavior has been in place since before even O1. For instance, here's the first cwb event of O1: https://gracedb.ligo.org/events/G185420/view/
I've spot checked other values for cwb and coincinspiral events, and the data looks right but I have to inspect it more thoroughly.