Skip to content
Snippets Groups Projects
Commit d52631a9 authored by Alexander Pace's avatar Alexander Pace
Browse files

new file: gstlal_inspiral_add_template_ids for compatibility for gstlal_inspiral_mass_model.

parent fb08490c
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ dist_bin_SCRIPTS = \
gstlal_iir_inspiral \
gstlal_inspiral \
gstlal_inspiral_add_mass_models \
gstlal_inspiral_add_template_ids \
gstlal_inspiral_calc_likelihood \
gstlal_inspiral_calc_rank_pdfs \
gstlal_inspiral_coinc_extractor \
......
#!/usr/bin/python
#
# Copyright (C) 2018 Chad Hanna
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
# # This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
### This program inputs a template bank from lalapps_tmpltbank, and returns
### a template bank with a unique template_id row. Used to overcome the
### "Asserion Error: assert row.template_id not in ids" error from
### gstlal_inspiral_mass_model.
import sys
from glue.ligolw import ligolw
from glue.ligolw import lsctables, param as ligolw_param, array as ligolw_array
from glue.ligolw import utils as ligolw_utils
@ligolw_array.use_in
@ligolw_param.use_in
@lsctables.use_in
class LIGOLWContentHandler(ligolw.LIGOLWContentHandler):
pass
fname = sys.argv[1]
xmldoc = ligolw_utils.load_filename(fname, verbose = True, contenthandler = LIGOLWContentHandler)
sngl_inspiral_table = lsctables.SnglInspiralTable.get_table(xmldoc)
for n, row in enumerate(sngl_inspiral_table):
row.template_id = n
ligolw_utils.write_filename(xmldoc, fname, gz = fname.endswith('gz'), verbose = True)
......@@ -385,6 +385,7 @@ gstlal_bank.xml.gz: frames.cache
--spectrum-type median \
--write-compress \
--verbose
gstlal_inspiral_add_template_ids H1-TMPLTBANK-1000000000-2048.xml.gz
mv H1-TMPLTBANK-1000000000-2048.xml.gz gstlal_bank.xml.gz
@echo ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment