Commit 51b05fb3 authored by Salvatore Vitale's avatar Salvatore Vitale
Browse files

lalinference_pipe to run with LIB injections

Original: cf0758816af3376c3aeac2a9ad0d7f29addfcbc0
parent 5213e45b
......@@ -32,6 +32,7 @@ parser.add_option("-t","--single-triggers",action="store",type="string",default=
parser.add_option("-C","--coinc-triggers",action="store",type="string",default=None,help="CoinInspiralTable trigger list",metavar="COINC_FILE.xml")
parser.add_option("--gid",action="store",type="string",default=None,help="GraceDB ID")
parser.add_option("-I","--injections",action="store",type="string",default=None,help="List of injections to perform and analyse",metavar="INJFILE.xml")
parser.add_option("-B","--burst_injections",action="store",type="string",default=None,help="SimBurst table for LIB injections",metavar="INJFILE.xml")
parser.add_option("-P","--pipedown-db",action="store",type="string",default=None,help="Pipedown database to read and analyse",metavar="pipedown.sqlite")
parser.add_option("--condor-submit",action="store_true",default=False,help="Automatically submit the condor dag")
parser.add_option("--pegasus-submit",action="store_true",default=False,help="Automatically submit the pegasus dax")
......@@ -81,6 +82,12 @@ if opts.single_triggers is not None:
if opts.injections is not None:
cp.set('input','injection-file',os.path.abspath(opts.injections))
if opts.burst_injections is not None:
if opts.injections is not None:
print "ERROR: cannot pass both inspiral and burst tables for injection\n"
sys.exit(1)
cp.set('input','burst-injection-file',os.path.abspath(opts.burst_injections))
if opts.coinc_triggers is not None:
cp.set('input','coinc-inspiral-file',os.path.abspath(opts.coinc_triggers))
......
......@@ -27,9 +27,10 @@ class Event():
Represents a unique event to run on
"""
new_id=itertools.count().next
def __init__(self,trig_time=None,SimInspiral=None,SnglInspiral=None,CoincInspiral=None,event_id=None,timeslide_dict=None,GID=None,ifos=None, duration=None,srate=None,trigSNR=None,fhigh=None):
def __init__(self,trig_time=None,SimInspiral=None,SimBurst=None,SnglInspiral=None,CoincInspiral=None,event_id=None,timeslide_dict=None,GID=None,ifos=None, duration=None,srate=None,trigSNR=None,fhigh=None):
self.trig_time=trig_time
self.injection=SimInspiral
self.burstinjection=SimBurst
self.sngltrigger=SnglInspiral
if timeslide_dict is None:
self.timeslides={}
......@@ -52,6 +53,9 @@ class Event():
if self.injection is not None:
self.trig_time=self.injection.get_end()
if event_id is None: self.event_id=int(str(self.injection.simulation_id).split(':')[2])
if self.burstinjection is not None:
self.trig_time=self.burstinjection.get_end()
if event_id is None: self.event_id=int(str(self.burstinjection.simulation_id).split(':')[2])
if self.sngltrigger is not None:
self.trig_time=self.sngltrigger.get_end()
self.event_id=int(str(self.sngltrigger.event_id).split(':')[2])
......@@ -721,10 +725,14 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
# SimBurst Table
if self.config.has_option('input','burst-injection-file'):
#from pylal import SimBurstUtils
from glue.ligolw import lsctables
from glue.ligolw import utils
from glue.ligolw import ligolw
injfile=self.config.get('input','burst-injection-file')
#xmldoc = utils.load_filename(injfile,contenthandler=ExtractSimBurstTableLIGOLWContentHandler)
#injTable=table.get_table(xmldoc,lsctables.SimBurstTable.tableName)
injTable=lsctables.SimBurstTable.get_table(ligolw_utils.load_filename(injfile))
class LIGOLWContentHandler(ligolw.LIGOLWContentHandler):
pass
lsctables.use_in(LIGOLWContentHandler)
injTable=lsctables.SimBurstTable.get_table(utils.load_filename(injfile,contenthandler = LIGOLWContentHandler))
events=[Event(SimBurst=inj) for inj in injTable]
self.add_pfn_cache([create_pfn_tuple(self.config.get('input','burst-injection-file'))])
# SnglInspiral Table
......
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