Commit c1ae556c authored by chad.hanna's avatar chad.hanna
Browse files add pastro to gracedb uploads

parent 0407301f
Pipeline #70330 passed with stages
in 27 minutes and 8 seconds
......@@ -578,7 +578,7 @@ class GracedBWrapper(object):
self.__upload_aux_data(message, filename, tag, fobj.getvalue(), gracedb_ids)
del fobj
def do_alerts(self, last_coincs, psddict, rankingstat_xmldoc_func, seglistdicts):
def do_alerts(self, last_coincs, psddict, rankingstat_xmldoc_func, seglistdicts, get_p_astro_func):
gracedb_ids = []
# no-op short circuit
......@@ -820,6 +820,8 @@ class GracedBWrapper(object):
if self.verbose:
print >>sys.stderr, "event assigned grace ID %s" % resp_json["graceid"]
p_astro = get_p_astro_func(coinc_event.likelihood, last_coincs.sngl_inspirals(coinc_event.coinc_event_id)[0].mass1, last_coincs.sngl_inspirals(coinc_event.coinc_event_id)[0].mass2, coinc_inspiral_index[coinc_event.coinc_event_id].snr, coinc_inspiral_index[coinc_event.coinc_event_id].combined_far)
self.__upload_aux_data("GstLAL internally computed p-astro", "gstlal_p_astro.json", "p_astro", p_astro, [gracedb_ids[-1]])
print >>sys.stderr, "gracedb upload of %s failed on attempt %d/%d: %d: %s" % (filename, attempt, self.retries, resp.status, httplib.responses.get(resp.status, "Unknown"))
print >>sys.stderr, resp_json
......@@ -835,7 +837,7 @@ class GracedBWrapper(object):
except OSError:
with open(os.path.join("gracedb_uploads", filename), "w") as fileobj:
ligolw_utils.write_fileobj(xmldoc, fileobj, gz = False)
ligolw_utils.write_fileobj(xmldoc, fileobj, gz = False)
......@@ -82,6 +82,7 @@ from ligo.lw.utils import segments as ligolw_segments
from gstlal import bottle
from gstlal import far
from gstlal import inspiral
from gstlal import p_astro_gstlal
from gstlal import pipeio
from gstlal import simplehandler
from gstlal import streamthinca
......@@ -1296,6 +1297,8 @@ class Handler(simplehandler.Handler):
return xmldoc
def __get_p_astro_json(self, lr, m1, m2, snr, far):
return p_astro_gstlal.compute_p_astro(lr, m1, m2, snr, far, self.rankingstatpdf)
def __get_rankingstat_xmldoc_for_gracedb(self):
# FIXME: remove this wrapper when the horizon history
......@@ -1362,7 +1365,7 @@ class Handler(simplehandler.Handler):
assert self.fapfar is not None
# do alerts
self.gracedbwrapper.do_alerts(last_coincs, self.psds, self.__get_rankingstat_xmldoc_for_gracedb, self.segmentstracker.seglistdicts)
self.gracedbwrapper.do_alerts(last_coincs, self.psds, self.__get_rankingstat_xmldoc_for_gracedb, self.segmentstracker.seglistdicts, self.__get_p_astro_json)
def web_get_sngls_snr_threshold(self):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment