diff --git a/gstlal-inspiral/bin/gstlal_inspiral b/gstlal-inspiral/bin/gstlal_inspiral index 19a82ab338ca3a56a1e7df3078ef87888c56188b..94844217191cf39bd4de3c52753a9afe0bf95c8e 100755 --- a/gstlal-inspiral/bin/gstlal_inspiral +++ b/gstlal-inspiral/bin/gstlal_inspiral @@ -147,6 +147,7 @@ import socket import StringIO import sys import tempfile +import time import uuid import warnings @@ -158,6 +159,7 @@ Gst.init(None) import lal from lal import LIGOTimeGPS +from lal import UTCToGPS from lal.utils import CacheEntry from ligo.gracedb.rest import DEFAULT_SERVICE_URL as gracedb_default_service_url @@ -181,6 +183,8 @@ from gstlal import servicediscovery from gstlal import simulation from gstlal import svd_bank +GSTLAL_PROCESS_START_TIME = UTCToGPS(time.gmtime()) + @lsctables.use_in class LIGOLWContentHandler(ligolw.LIGOLWContentHandler): pass @@ -812,6 +816,7 @@ for output_file_number, (svd_bank_url_dict, output_url, ranking_stat_output_url, coincs_document = inspiral.CoincsDocument( url = output_url or "%s-%s_LLOID-%d-%d.xml.gz" % (lsctables.instrumentsproperty.set(detectors.channel_dict.keys()).replace(",", ""), options.job_tag, int(detectors.seg[0]), int(abs(detectors.seg))), process_params = process_params, + process_start_time = GSTLAL_PROCESS_START_TIME, comment = options.comment, instruments = rankingstat.instruments, seg = detectors.seg, diff --git a/gstlal-inspiral/python/inspiral.py b/gstlal-inspiral/python/inspiral.py index 309b58f7d21c1aa1c49222c110b4cc9f6033efb0..8ca52401508f59e69d3cba64655d8cd285fd956b 100644 --- a/gstlal-inspiral/python/inspiral.py +++ b/gstlal-inspiral/python/inspiral.py @@ -313,12 +313,12 @@ def chisq_distribution(df, non_centralities, size): class CoincsDocument(object): sngl_inspiral_columns = ("process:process_id", "ifo", "end_time", "end_time_ns", "eff_distance", "coa_phase", "mass1", "mass2", "snr", "chisq", "chisq_dof", "bank_chisq", "bank_chisq_dof", "sigmasq", "spin1x", "spin1y", "spin1z", "spin2x", "spin2y", "spin2z", "template_duration", "event_id", "Gamma0", "Gamma1") - def __init__(self, url, process_params, comment, instruments, seg, offsetvectors, injection_filename = None, tmp_path = None, replace_file = None, verbose = False): + def __init__(self, url, process_params, process_start_time, comment, instruments, seg, offsetvectors, injection_filename = None, tmp_path = None, replace_file = None, verbose = False): # # how to make another like us # - self.get_another = lambda: CoincsDocument(url = url, process_params = process_params, comment = comment, instruments = instruments, seg = seg, offsetvectors = offsetvectors, injection_filename = injection_filename, tmp_path = tmp_path, replace_file = replace_file, verbose = verbose) + self.get_another = lambda: CoincsDocument(url = url, process_params = process_params, process_start_time = process_start_time, comment = comment, instruments = instruments, seg = seg, offsetvectors = offsetvectors, injection_filename = injection_filename, tmp_path = tmp_path, replace_file = replace_file, verbose = verbose) # # url @@ -332,7 +332,16 @@ class CoincsDocument(object): self.xmldoc = ligolw.Document() self.xmldoc.appendChild(ligolw.LIGO_LW()) + # NOTE FIXME override the process start time. Since gstlal + # inspiral can produce several output files from the same + # process, this can plot the process metadata by a factor of 50 + # even though the same process generated the files. It is a + # major contributor to the size of merged databases and xml + # files. A patch to ligolw_process.register_to_xmldoc would be + # welcomed self.process = ligolw_process.register_to_xmldoc(self.xmldoc, u"gstlal_inspiral", process_params, comment = comment, ifos = instruments) + if process_start_time is not None: + self.process.start_time = process_start_time self.xmldoc.childNodes[-1].appendChild(lsctables.New(lsctables.SnglInspiralTable, columns = self.sngl_inspiral_columns)) self.xmldoc.childNodes[-1].appendChild(lsctables.New(lsctables.CoincDefTable)) self.xmldoc.childNodes[-1].appendChild(lsctables.New(lsctables.CoincTable))