gwcelery.tasks.p_astro module¶
Computation of p_astro
by source category and utilities
related to p_astro.json
source classification files.
See Kapadia et al (2019), doi:10.1088/1361-6382/ab5f2d, for details.
- (task)gwcelery.tasks.p_astro.compute_p_astro(snr, far, mass1, mass2, pipeline, instruments)[source]¶
Task to compute p_astro by source category.
- Parameters:
- Returns:
p_astros – JSON dump of the p_astro by source category
- Return type:
Example
>>> p_astros = json.loads(compute_p_astro(files)) >>> p_astros {'BNS': 0.999, 'BBH': 0.0, 'NSBH': 0.0, 'Terrestrial': 0.001}
- (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:
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, ... "BBH": 0.059} ... ''' >>> p_astro.plot(contents)