Skip to content
Snippets Groups Projects
Commit d3e6fb4d authored by Kipp Cannon's avatar Kipp Cannon
Browse files

LnNoiseDensity: trigger rate adjustment

- combine adjacent segments up to +/- 1 h from the trigger to estimate the trigger rate.
- this is a work-around for the situation in which vetoes slice up the SNR stream so badly that no triggers can be collected, even though very loud injections can still be recovered (which creates apparently impossible candidates)
parent 50e5527d
No related branches found
No related tags found
No related merge requests found
......@@ -587,14 +587,15 @@ class LnNoiseDensity(LnLRDensity):
if len(snrs) < self.min_instruments:
return float("-inf")
# FIXME: the +/-3600 s window thing is a temporary hack to
# work around the problem of vetoes creating short segments
# that have no triggers in them but that can have
# injections recovered in them. the +/- 3600 s window is
# just a guess as to what might be sufficient to work
# around it. you might might to make this bigger.
triggers_per_second_per_template = {}
for instrument, seg in segments.items():
try:
triggers_per_second_per_template[instrument] = self.triggerrates[instrument].density_at(seg[1]) / len(self.template_ids)
except IndexError:
# no rate data at segment end-time =
# instrument was off
triggers_per_second_per_template[instrument] = 0.
triggers_per_second_per_template[instrument] = (self.triggerrates[instrument] & trigger_rate.ratebinlist([trigger_rate.ratebin(seg[1] - 3600., seg[1] + 3600., count = 0)])).density() / len(self.template_ids)
# sanity check rates
assert all(triggers_per_second_per_template[instrument] for instrument in snrs), "impossible candidate in %s at %s when rates were %s triggers/s/template" % (", ".join(sorted(snrs)), ", ".join("%s s in %s" % (str(seg[1]), instrument) for instrument, seg in sorted(segments.items())), str(triggers_per_second_per_template))
......
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