diff --git a/gstlal-inspiral/bin/gstlal_inspiral b/gstlal-inspiral/bin/gstlal_inspiral index a04a5b7acd1f7d167242dce6c34cf4c6f735c075..2b6456fa148b280849d6d9d3e50a7e7143f741fa 100755 --- a/gstlal-inspiral/bin/gstlal_inspiral +++ b/gstlal-inspiral/bin/gstlal_inspiral @@ -265,6 +265,8 @@ def parse_command_line(): group.add_option("--ranking-stat-input", metavar = "url", help = "Set the URL from which to load a ranking statistic definition. When this is enabled, signal candidates will have ranking statistic values assigned on-the-fly. Required when --data-source is lvshm or framexmit; must also set --likelihood-snapshot-interval.") group.add_option("--ranking-stat-output", metavar = "filename", action = "append", default = [], help = "Set the name of the file to which to write ranking statistic data collected from triggers (optional). Can be given more than once. If given, exactly as many must be provided as there are --svd-bank options and they will be writen to in order.") group.add_option("--ranking-stat-output-cache", metavar = "filename", help = "Provide a cache of ranking statistic output files. This can be used instead of giving multiple --ranking-stat-output options. Cannot be combined with --ranking-stat-output.") + group.add_option("--compress-ranking-stat", action = "store_true", help = "Choose whether to compress the ranking stat upon start up. Only used when --ranking-stat-input is set.") + group.add_option("--compress-ranking-stat-threshold", type = "float", default = 0.03, help = "Only keep horizon distance values that differ by this much, fractionally, from their neighbours (default = 0.03).") group.add_option("--likelihood-snapshot-interval", type = "float", metavar = "seconds", help = "How often to snapshot candidate and ranking statistic data to disk when running online.") group.add_option("--ranking-stat-pdf", metavar = "url", help = "Set the URL from which to load the ranking statistic PDF. This is used to compute false-alarm probabilities and false-alarm rates and is required for online operation (when --data-source is framexmit or lvshm). It is forbidden for offline operation (all other data sources)") group.add_option("--time-slide-file", metavar = "filename", help = "Set the name of the xml file to get time slide offsets (required).") @@ -798,6 +800,14 @@ for output_file_number, (svd_bank_url_dict, output_url, ranking_stat_output_url, elif rankingstat.template_ids != template_ids: raise ValueError("\"%s\" is for the wrong templates" % options.ranking_stat_input) rankingstat.numerator.set_horizon_factors(horizon_factors) + + if options.compress_ranking_stat: + if options.verbose: + print >> sys.stderr, "compressing ranking stat..." + rankingstat.numerator.horizon_history.compress(threshold = options.compress_ranking_stat_threshold) + if options.verbose: + print >> sys.stderr, "...done." + if rankingstat is None: rankingstat = far.RankingStat(template_ids = template_ids, instruments = all_instruments, delta_t = options.coincidence_threshold, min_instruments = options.min_instruments, horizon_factors = horizon_factors) diff --git a/gstlal-inspiral/bin/gstlal_ll_inspiral_pipe b/gstlal-inspiral/bin/gstlal_ll_inspiral_pipe index d3401e3b20c321e1d9079010a9f7c06335e34df3..e80af79ded9191f58e6735620a293fffae847e46 100755 --- a/gstlal-inspiral/bin/gstlal_ll_inspiral_pipe +++ b/gstlal-inspiral/bin/gstlal_ll_inspiral_pipe @@ -133,6 +133,8 @@ def parse_command_line(): parser.add_option("--likelihood-cache", help = "set the cache containin likelihood files") parser.add_option("--zerolag-likelihood-cache", help = "set the cache containin zerolag likelihood files") parser.add_option("--marginalized-likelihood-file", help = "set the marginalized likelihood file, required") + parser.add_option("--compress-ranking-stat", action = "store_true", help = "Choose whether to compress the ranking stat upon start up. Only used when --ranking-stat-input is set.") + parser.add_option("--compress-ranking-stat-threshold", type = "float", default = 0.03, help = "Only keep horizon distance values that differ by this much, fractionally, from their neighbours (default = 0.03).") parser.add_option("--control-peak-time", default = 4, metavar = "secs", help = "set the control peak time, default 4") parser.add_option("--fir-stride", default = 4, metavar = "secs", help = "set the fir bank stride, default 4") parser.add_option("--gracedb-far-threshold", type = "float", help = "false alarm rate threshold for gracedb (Hz), if not given gracedb events are not sent") diff --git a/gstlal-inspiral/python/inspiral_pipe.py b/gstlal-inspiral/python/inspiral_pipe.py index 5c8a79f0e0da2c31287853ed3697dd7b281e0ec9..de9f3e43aff8b0f1df5271b1471a5e60264b825f 100644 --- a/gstlal-inspiral/python/inspiral_pipe.py +++ b/gstlal-inspiral/python/inspiral_pipe.py @@ -150,6 +150,14 @@ def online_inspiral_layer(dag, jobs, options): } common_opts.update(datasource_opts) + # add ranking stat compression options, if requested + if options.compress_ranking_stat: + compress_opts = { + "compress-ranking-stat": "", + "compress-ranking-stat-threshold": options.compress_ranking_stat_threshold + } + common_opts.update(compress_opts) + inspNode = dagparts.DAGNode(jobs['gstlalInspiral'], dag, [], opts = common_opts, input_files = {