Skip to content
Snippets Groups Projects
Commit 775cd822 authored by Alexander Pace's avatar Alexander Pace
Browse files

Update views.py for public superevent page:

For S191216ap, the p_terrestrial value was so small:
pastro_values=[('BNS', 0.0), ('NSBH', 0.0), ('BBH', 0.0), ('Terrestrial', 8.427577149405988e-16), ('MassGap', 0.9999999999999991)]

python was converting it to a NoneType, which would then fail when you tried to sort or compare values. So, for this view, convert NoneType probabilities to 0.0.
parent 5152eacb
No related branches found
Tags gracedb-2.8.0
No related merge requests found
......@@ -233,9 +233,11 @@ class SupereventPublic(DisplayFarMixin, ListView):
("BBH", voe.prob_bbh),
("Terrestrial", voe.prob_terrestrial),
("MassGap", voe.prob_mass_gap)]
pastro_values.sort(reverse=True, key=lambda p_a: p_a[1])
pastro_values.sort(reverse=True, key=lambda p_a: 0.0 if p_a[1] is None else p_a[1])
sourcelist = []
for key, value in pastro_values:
if value is None:
value = 0.0
if value > 0.01:
prob = int(round(100*value))
if prob == 100: prob = '>99'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment