Commit 02b635ff authored by megmillhouse's avatar megmillhouse

update BW internal injections to have the option to do injections in order,...

update BW internal injections to have the option to do injections in order, instead of randomly drawing from the chain
parent 3216f486
......@@ -29,7 +29,10 @@ from glue import pipeline
from glue.ligolw import ligolw
from glue.ligolw import utils as ligolw_utils
from glue.ligolw import lsctables
try:
from glue.ligolw import lsctables
except:
print("Warning! Unable to import lsctables.")
#import lalinspiral, lalburst
......@@ -51,9 +54,12 @@ else: # other python3 compatibility stuff
CVMFS_FRAMES="/cvmfs/oasis.opensciencegrid.org/ligo/frames/"
# define a content handler
class LIGOLWContentHandler(ligolw.LIGOLWContentHandler):
pass
lsctables.use_in(LIGOLWContentHandler)
try:
class LIGOLWContentHandler(ligolw.LIGOLWContentHandler):
pass
lsctables.use_in(LIGOLWContentHandler)
except:
print("Warning: could not set LIGOLW content handler")
def write_pre_cmd(workdir):
"""
......@@ -524,13 +530,18 @@ class triggerList:
BW_chainLength = file_len(filename)
try:
BW_seed = cp.getint('bayeswave_options', 'BW-seed')
except:
BW_seed = None
random.seed(BW_seed)
BW_events = random.sample(xrange(0,BW_chainLength), BW_Nsamples)
# Add option for doing deterministic BW injections
if cp.has_option('bayeswave_options','BW-internal-all'):
BW_events = range(0,BW_chainLength)
else:
try:
BW_seed = cp.getint('bayeswave_options', 'BW-seed')
except:
BW_seed = None
random.seed(BW_seed)
BW_events = random.sample(xrange(0,BW_chainLength), BW_Nsamples)
triggers=[]
for BW_event in BW_events:
......
......@@ -38,7 +38,10 @@ import numpy as np
from glue import pipeline
from lalapps import inspiralutils
try:
from lalapps import inspiralutils
except:
print("Warning! could not import inspiralutils")
from ligo import segments
from bayeswave_pipe import bayeswave_pipe_utils as pipe_utils
......
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