Skip to content

fix bugs in template id mapping

Chad Hanna requested to merge population-model-bug-fix into master

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:

  1. With c916c40a
  2. From master (after reverting c916c40a)
  3. From this version of the code

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

  1. With c916c40a:

mass_model_c916c40

  1. From master (after reverting c916c40a):

mass_model_master

  1. From this version of the code:

mass_model_new

Edited by Rebecca Ewing

Merge request reports