Skip to content
Snippets Groups Projects

Plot horizon distance from ranking statistics

Merged ChiWai Chan requested to merge plot_psd_horizon into master
1 unresolved thread
1 file
+ 8
15
Compare changes
  • Side-by-side
  • Inline
@@ -775,27 +775,20 @@ for output_file_number, (svd_bank_url_dict, output_url, ranking_stat_output_url,
options.upload_time_before_merger = {row.template_id: abs(row.end.gpsSeconds) + 1e-9*abs(row.end.gpsNanoSeconds) for bank in list(banks.items())[0][-1] for row in bank.sngl_inspiral_table}
#
# calculate expected injection SNR if processing injections
# and a PSD is available. if so, this will filter the set
# of injections, calculate the expected the SNR and write
# the new injection file to disk before the pipeline starts up
# trim down injection list to the job's analysis segments if processing
# injections. this is done for two reasons:
# 1. increase efficiency for the injection element
# 2. decrease size of sim_inspiral table in output trigger files
#
if (options.injections and options.reference_psd) and not options.data_source in ("lvshm", "framexmit"):
if options.verbose:
print("calculating expected SNR for injections...", file=sys.stderr)
if options.injections:
# read in injections
xmldoc = ligolw_utils.load_filename(options.injections, verbose = options.verbose, contenthandler = LIGOLWContentHandler)
sim_inspiral_table = lsctables.SimInspiralTable.get_table(xmldoc)
# calculate expected SNR
# NOTE: f_high is determined from the bank's highest sampling
# rate with a fudge factor to safely deal with roll-off
f_low = min(set(bank.f_low for ifo in banks.keys() for bank in banks[ifo]))
max_rate = max(set(rate for ifo in banks.keys() for bank in banks[ifo] for rate in bank.get_rates()))
f_high = 0.8 * (max_rate / 2.)
inspiral.calc_sim_inspiral_table_snrs(sim_inspiral_table, psd, detectors.seg, f_low = f_low, f_high = f_high, sample_rate = max_rate)
# trim injection list to analysis segments
injections = [inj for inj in sim_inspiral_table if inj.time_geocent in detectors.seg]
sim_inspiral_table[:] = injections
# write the injection file back out to a temporary directory
f, fname = tempfile.mkstemp(".xml.gz")
Loading