Skip to content
Snippets Groups Projects
Commit 17077172 authored by Sarah Caudill's avatar Sarah Caudill
Browse files

gstlal_inspiral_injection_snr: adding support for Virgo

parent 402a8c71
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -79,7 +79,7 @@ def calc_expected_snr(inj):
if len(cachelist) < 1:
# We know no PSD covers the injection.
return 0.0, 0.0
return 0.0, 0.0, 0.0
elif len(cachelist) >= 2:
# More than one PSD covers the injection time.
# Find the one that encompasses the injection the most.
......@@ -87,11 +87,11 @@ def calc_expected_snr(inj):
#Return the distance of the injection from the center of each segment
return numpy.absolute(((time1-time0)/2.0 + 1.0*time0) - injtime)
# FIXME If there are overlapping PSD files for both double and single
# ifo times, then use the double coinc files. Will need fixing when Virgo
# comes online.
if len(cachelist.sieve(ifos='H1L1')) > 0:
cachelist = cachelist.sieve(ifos='H1L1')
# FIXME If there are overlapping PSD files for both triple and double
# ifo times, then use the triple coinc files. Will need fixing when singles
# doubles and triples are enabled
if len(cachelist.sieve(ifos='H1L1V1')) > 0:
cachelist = cachelist.sieve(ifos='H1L1V1')
seg_start = int(sorted([(dist_from_center(cachelist[index].segment[0], cachelist[index].segment[1], geocent_end_time[0]), cachelist[index].segment[0]) for index in range(len(cachelist))])[0][1])
chosenPSD = allPSDs[seg_start]
......@@ -146,7 +146,15 @@ def calc_expected_snr(inj):
except KeyError:
l1snr = 0.0
return h1snr, l1snr
detector = lalsimulation.DetectorPrefixToLALDetector('V1')
h = lalsimulation.SimDetectorStrainREAL8TimeSeries(h_plus, h_cross, inj.longitude, inj.latitude, inj.polarization, detector)
try:
v1snr = lalsimulation.MeasureSNR(h,chosenPSD['V1'],options.flow,0.85*(sample_rate/2.))
except KeyError:
v1snr = 0.0
return h1snr, l1snr, v1snr
class LIGOLWContentHandler(ligolw.LIGOLWContentHandler):
pass
......@@ -182,15 +190,18 @@ for cacheentry in reference_psd_files:
pool = multiprocessing.Pool(options.npool)
h1snr = []
l1snr = []
v1snr = []
#print pool.map(calc_expected_snr,[inj for idx, inj in enumerate(sim_inspiral_table)])
for h1sim, l1sim in pool.map(calc_expected_snr,[inj for idx, inj in enumerate(sim_inspiral_table)]):
for h1sim, l1sim, v1sim in pool.map(calc_expected_snr,[inj for idx, inj in enumerate(sim_inspiral_table)]):
h1snr.append(h1sim)
l1snr.append(l1sim)
v1snr.append(v1sim)
pool.close()
pool.join()
for idx, inj in enumerate(sim_inspiral_table):
inj.alpha1 = h1snr[idx]
inj.alpha2 = l1snr[idx]
inj.alpha4 = h1snr[idx]
inj.alpha5 = l1snr[idx]
inj.alpha6 = v1snr[idx]
ligolw_utils.write_filename(simxmldoc,options.injection_file,verbose = True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment