Skip to content
Snippets Groups Projects

Process injections in online analysis

Merged Wanting Niu requested to merge test_sim_row_kafka_2 into master
1 unresolved thread
Compare and
2 files
+ 24
4
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -374,7 +374,7 @@ class CoincsDocument(object):
#
# build the XML document
#
+1
self.xmldoc = ligolw.Document()
self.xmldoc.appendChild(ligolw.LIGO_LW())
# NOTE FIXME override the process start time. Since gstlal
@@ -403,7 +403,13 @@ class CoincsDocument(object):
#
if injection_filename is not None:
ligolw_add.ligolw_add(self.xmldoc, [injection_filename], contenthandler = LIGOLWContentHandler, verbose = verbose)
# sort and add the sim_insprial
xmldoc_sim_inspiral = ligolw_untils.load_filname(injection_filename, verbose = verbose, contenthandler = LIGOWContentHandler)
self.sim_inspiral_table = lsctables.SimInspiralTable.get_table(xmldoc_sim_inspiral)
self.sim_inspiral_table.sort(key = lambda row:row.end)
self.xmldoc.childNodes[-1].appendChild(self.sim_inspiral_table)
else:
self.sim_inspiral_table = None
#
# insert time slide offset vectors. remove duplicate
@@ -652,7 +658,17 @@ 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, get_p_astro_func):
def nearest_sim_table(self, gps_time):
# search through the sim inspiral table
# find the row with geo-centric ends time nearest to the specific gps time (using by bisect)
# return the new sim inspiral table with a single row corresponding to the nearest time
sim_inspiral_table = lsctables.New(lsctables.SimInspiralTable)
idx = bisect.bisect(self.sim_inspiral, gps_time, lo=0, hi=len(self.sim_inspiral))
row = self.sim_inspiral[idx][1]
sim_inspiral_table.append(row)
return sim_inspiral_table
def do_alerts(self, last_coincs, psddict, rankingstat_xmldoc_func, seglistdicts, get_p_astro_func, sim_inspiral_table = None):
gracedb_ids = []
# no-op short circuit
@@ -721,6 +737,10 @@ class GracedBWrapper(object):
print("sending %s to gracedb ..." % filename, file=sys.stderr)
message = io.StringIO()
xmldoc = last_coincs[coinc_event.coinc_event_id]
if self.sim_inspiral_table is not None:
xmldoc.childNodes[-1].appendChild(self.nearest_sim_table(end_time))
# give the alert all the standard inspiral
# columns (attributes should all be
# populated). FIXME: ugly.
Loading