fix bugs in template id mapping
This fixes some bugs in a previous commit regarding template id mapping
Tests
Ran the following script to plot the template IDs vs coefficients in three different cases:
The test script
from gstlal.stats import inspiral_intrinsics
from ligo.lw import ligolw
from ligo.lw import lsctables
from ligo.lw import utils as ligolw_utils
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
class LIGOLWContentHandler(ligolw.LIGOLWContentHandler):
pass
lsctables.use_in(LIGOLWContentHandler)
bank = 'bank/H1L1V1-O4_MANIFOLD_BANK_JACOB.xml.gz'
mass_model = 'mass_model/H1L1V1-GSTLAL_MASS_MODEL-0-0.h5'
xmldoc = ligolw_utils.load_filename(bank, contenthandler = LIGOLWContentHandler)
sngltable = lsctables.SnglInspiralTable.get_table(xmldoc)
template_ids = sngltable.getColumnByName('Gamma0')
ids = template_ids[::100]
pop_model = inspiral_intrinsics.SourcePopulationModel(ids, mass_model)
coefs = [pop_model.polys[t].__call__(pop_model.max_snr) for t in ids]
fig = plt.figure(111, figsize=(10, 5))
ax = fig.add_subplot(111)
ax.plot(ids, coefs, linestyle='None', markersize=2.0, marker = 'o')
Plots
- With c916c40a:
- From master (after reverting c916c40a):
- From this version of the code:
Edited by Rebecca Ewing