gwcelery.tasks.p_astro module

Utilities related to p_astro.json source classification files.

(task)gwcelery.tasks.p_astro.plot(contents)[source]

Make a visualization of the source classification.

Parameters:contents (str, bytes) – The contents of the p_astro.json file.
Returns:png – The contents of a PNG file.
Return type:bytes

Notes

The unusually small size of the plot (2.5 x 2 inches) is optimized for viewing in GraceDB’s image display widget.

Examples

>>> from gwcelery.tasks import p_astro
>>> contents = '''
... {"Terrestrial": 0.001, "BNS": 0.65, "NSBH": 0.20,
... "MassGap": 0.10, "BBH": 0.059}
... '''
>>> p_astro.plot(contents)

(Source code, png, hires.png, pdf)

_images/gwcelery-tasks-p_astro-1.png
(task)gwcelery.tasks.p_astro.handle(alert)[source]

LVAlert handler to plot and upload a visualization of every p_astro.json that is added to a superevent.