Commit cd3e1441 authored by Rory Smith's avatar Rory Smith

added routine to get graceDB trigger mchirp in roq setup

Original: 99851436aaa8d091f66dc17eb7345f4ca42ef5e1
parent aa31f57e
......@@ -441,7 +441,40 @@ def get_xml_psds(psdxml,ifos,outpath,end_time=None):
return out
def get_roq_mchirp_priors(path, roq_paths, roq_params, key):
def get_trigger_chirpmass(gid=None,gracedb="gracedb"):
from glue.ligolw import lsctables
from glue.ligolw import ligolw
from glue.ligolw import utils
class PSDContentHandler(ligolw.LIGOLWContentHandler):
import subprocess
cwd=os.getcwd()[gracedb,"download", gid ,"coinc.xml"])
xmldoc=utils.load_filename("coinc.xml",contenthandler = PSDContentHandler)
coinctable = lsctables.CoincInspiralTable.get_table(xmldoc)
coinc_events = [event for event in coinctable]
sngltable = lsctables.SnglInspiralTable.get_table(xmldoc)
sngl_events = [event for event in sngltable]
coinc_map = lsctables.CoincMapTable.get_table(xmldoc)
mass1 = []
mass2 = []
for coinc in coinc_events:
these_sngls = [e for e in sngl_events if e.event_id in [c.event_id for c in coinc_map if c.coinc_event_id == coinc.coinc_event_id] ]
for e in these_sngls:
# check that trigger masses are identical in each IFO
assert len(set(mass1)) == 1
assert len(set(mass2)) == 1
mchirp = (mass1[0]*mass2[0])**(3./5.) / ( (mass1[0] + mass2[0])**(1./5.) )
return mchirp
def get_roq_mchirp_priors(path, roq_paths, roq_params, key, gid):
mc_priors = {}
......@@ -459,8 +492,13 @@ def get_roq_mchirp_priors(path, roq_paths, roq_params, key):
if i<len(roq_paths)-1:
mc_priors[roq][1]-= (mc_priors[roq][1]- mc_priors[ordered_roq_paths[i+1]][0])/2.
return mc_priors
# used to scale mass-frequency range of basis to accommodate trigger mass
trigger_mchirp = get_trigger_chirpmass(gid)
return mc_priors, trigger_mchirp
def create_pfn_tuple(filename,protocol='file://',site='local'):
return( (os.path.basename(filename),protocol+os.path.abspath(filename),site) )
......@@ -98,7 +98,7 @@ if cp.has_option('paths','roq_b_matrix_directory'):
print "WARNING: Overwriting user choice of flow, srate, seglen,mc_min, mc_max and q-min"
mc_priors = pipe_utils.get_roq_mchirp_priors(path, roq_paths, roq_params, key)
mc_priors, trigger_mchirp = pipe_utils.get_roq_mchirp_priors(path, roq_paths, roq_params, key, opts.gid)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment