diff --git a/gstlal-inspiral/bin/gstlal_bank_splitter b/gstlal-inspiral/bin/gstlal_bank_splitter index 98c8baf4bb0fee1ce06201ebbd1f41dd46694457..409f4ebc0c18cd1004da9491777246ef2e019abb 100755 --- a/gstlal-inspiral/bin/gstlal_bank_splitter +++ b/gstlal-inspiral/bin/gstlal_bank_splitter @@ -145,7 +145,7 @@ sngl_inspiral_table = lsctables.SnglInspiralTable.get_table(xmldoc) # assign ids and write out the full template bank with ids assigned for nrow, row in enumerate(sngl_inspiral_table): - row.Gamma0 = nrow + options.template_id_start_index + row.template_id = nrow + options.template_id_start_index # FIXME #process = ligolw_process.register_to_xmldoc(xmldoc, program = "gstlal_bank_splitter", paramdict = options.__dict__, comment = "Assign template IDs") ligolw_utils.write_filename(xmldoc, options.output_full_bank_file_with_ids, gz = options.output_full_bank_file_with_ids.endswith('gz'), verbose = options.verbose) diff --git a/gstlal-inspiral/bin/gstlal_inspiral b/gstlal-inspiral/bin/gstlal_inspiral index f92ed5aa821ebd1325de044d00d2c20652c9a395..6f9e3eaef09034db39e830e9550dad9333971622 100755 --- a/gstlal-inspiral/bin/gstlal_inspiral +++ b/gstlal-inspiral/bin/gstlal_inspiral @@ -680,8 +680,7 @@ for output_file_number, (svd_bank_url_dict, output_url, ranking_stat_output_url, outstr = output.getvalue() output.close() return outstr - # FIXME: don't use Gamma0, switch to a proper column - template_ids = frozenset(map(int, sngl_inspiral_table.getColumnByName("Gamma0"))) + template_ids = frozenset(row.template_id for row in sngl_inspiral_table) @bottle.route("/template_ids.txt") def get_template_ids(template_ids = sorted(template_ids)): return "\n".join("%d" % template_id for template_id in template_ids) diff --git a/gstlal-inspiral/bin/gstlal_inspiral_lvalert_snrtimeseries_plotter b/gstlal-inspiral/bin/gstlal_inspiral_lvalert_snrtimeseries_plotter index 8b71bb4553dcb48e7f282febb939210c2d1f7446..84a5c17c2470a17c50729bb5394d868238b18004 100755 --- a/gstlal-inspiral/bin/gstlal_inspiral_lvalert_snrtimeseries_plotter +++ b/gstlal-inspiral/bin/gstlal_inspiral_lvalert_snrtimeseries_plotter @@ -115,7 +115,7 @@ for gid in gid_list: # COMPLEX8TimeSeries which contain the snr time series, the second dict # contains a tuple with the ifo and template number timeseries_ligolw_dict = dict((ligolw_param.get_pyvalue(elem, u"event_id"), lalseries.parse_COMPLEX8TimeSeries(elem)) for elem in xmldoc.getElementsByTagName(ligolw.LIGO_LW.tagName) if elem.hasAttribute(u"Name") and elem.Name == u"COMPLEX8TimeSeries") - eventid_ifoGamma0_dict = dict((row.event_id, (row.ifo, row.Gamma0)) for row in lsctables.SnglInspiralTable.get_table(xmldoc)) + eventid_ifotemplate_id_dict = dict((row.event_id, (row.ifo, row.template_id)) for row in lsctables.SnglInspiralTable.get_table(xmldoc)) # Parse the bank files # NOTE This assumes --svd-bank will also be provided once in the ProcessParamsTable @@ -128,8 +128,8 @@ for gid in gid_list: banknum = None for i, bank in enumerate(banks.values()[0]): for j, row in enumerate(bank.sngl_inspiral_table): - # The templates should all have the same Gamma0, so just grab one - if row.Gamma0 == eventid_ifoGamma0_dict.values()[0][-1]: + # The templates should all have the same template_id, so just grab one + if row.template_id == eventid_ifotemplate_id_dict.values()[0][-1]: banknum = i tmpltnum = j break @@ -147,7 +147,7 @@ for gid in gid_list: FigureCanvas(fig) for i, (eventid, complex8timeseries) in enumerate(timeseries_ligolw_dict.items()): - ifo = eventid_ifoGamma0_dict[eventid][0] + ifo = eventid_ifotemplate_id_dict[eventid][0] complex_snr_timeseries = complex8timeseries.data.data autocorr_length = complex8timeseries.data.length time = numpy.linspace(float(complex8timeseries.epoch), float(complex8timeseries.epoch)+(autocorr_length-1)*complex8timeseries.deltaT, autocorr_length) diff --git a/gstlal-inspiral/python/far.py b/gstlal-inspiral/python/far.py index 19ce7d30561a3a2a036017349754007a96cb69fe..6961ba0e34d68d05327454882f67e1d81dd30d80 100644 --- a/gstlal-inspiral/python/far.py +++ b/gstlal-inspiral/python/far.py @@ -224,8 +224,7 @@ class RankingStat(snglcoinc.LnLikelihoodRatioMixin): reference = min(events, key = lambda event: event.ifo) ref_end, ref_offset = reference.end, offsetvector[reference.ifo] - # FIXME: use a proper ID column when one is available - template_id = reference.Gamma0 + template_id = reference.template_id if template_id not in self.template_ids: raise ValueError("event IDs %s are from the wrong template" % ", ".join(sorted(str(event.event_id) for event in events))) # segment spanned by reference event @@ -535,6 +534,8 @@ class RankingStatPDF(object): def collect_zero_lag_rates(self, connection, coinc_def_id): + # FIXME: Gamma0 contains the template_id, switch to proper + # column when one is available for ln_likelihood_ratio, template_id in connection.cursor().execute(""" SELECT likelihood, diff --git a/gstlal-inspiral/python/snglinspiraltable.py b/gstlal-inspiral/python/snglinspiraltable.py index 72bddfd37d551cfb5346e18d8df154f12568c622..2e51863c44eedee257f5b625e354d1950deea3b8 100644 --- a/gstlal-inspiral/python/snglinspiraltable.py +++ b/gstlal-inspiral/python/snglinspiraltable.py @@ -86,3 +86,16 @@ class GSTLALSnglInspiral(_snglinspiraltable.GSTLALSnglInspiral): @snr_time_series.deleter def snr_time_series(self): self._snr_time_series_deleter() + + # + # simulate template_id column + # FIXME: add a proper column for this + # + + @property + def template_id(self): + return int(self.Gamma0) + + @template_id.setter + def template_id(self, template_id): + self.Gamma0 = float(template_id) diff --git a/gstlal-inspiral/python/stats/inspiral_lr.py b/gstlal-inspiral/python/stats/inspiral_lr.py index 16653154c323e1ac86fb2c88bdeba90416362b1a..168844b70332fac2099f66b6dd45c5204c07436f 100644 --- a/gstlal-inspiral/python/stats/inspiral_lr.py +++ b/gstlal-inspiral/python/stats/inspiral_lr.py @@ -140,8 +140,7 @@ class LnLRDensity(snglcoinc.LnLRDensity): # this test is intended to fail if .template_ids is None: # must not collect trigger statistics unless we can verify # that they are for the correct templates. - # FIXME: use a proper ID column when one is available - if event.Gamma0 not in self.template_ids: + if event.template_id not in self.template_ids: raise ValueError("event from wrong template") self.densities["%s_snr_chi" % event.ifo].count[event.snr, event.chisq / event.snr**2.] += 1.0