Commit 79552440 authored by Ryan Magee's avatar Ryan Magee Committed by Ryan Michael Magee

gstlal_inspiral_compress_ranking_stat: added option to remove large deviations in horizon history.

parent ec86589b
Pipeline #70562 passed with stages
in 34 minutes and 57 seconds
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
import math import math
from optparse import OptionParser from optparse import OptionParser
import sys import sys
import numpy
from ligo.lw import utils as ligolw_utils from ligo.lw import utils as ligolw_utils
from gstlal import far from gstlal import far
...@@ -55,6 +55,8 @@ def parse_command_line(): ...@@ -55,6 +55,8 @@ def parse_command_line():
version = "Name: %%prog\n%s" % "" # FIXME version = "Name: %%prog\n%s" % "" # FIXME
) )
parser.add_option("-t", "--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("-t", "--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("--remove-horizon-deviations", action = "store_true", help = "Remove horizon entries that display an uncharacteristic deviation in sensitivity from the non-zero mean.")
parser.add_option("--deviation-percent", type = "float", default = 0.50, help = "Remove horizon entries that deviate by this fraction from the non-zero mean.")
parser.add_option("-v", "--verbose", action = "store_true", help = "Be verbose.") parser.add_option("-v", "--verbose", action = "store_true", help = "Be verbose.")
options, filenames = parser.parse_args() options, filenames = parser.parse_args()
...@@ -117,6 +119,10 @@ for filename in filenames: ...@@ -117,6 +119,10 @@ for filename in filenames:
for instrument, horizon_history in list(rankingstat.numerator.horizon_history.items()): for instrument, horizon_history in list(rankingstat.numerator.horizon_history.items()):
# GPS time / distance pairs # GPS time / distance pairs
items = horizon_history.items() items = horizon_history.items()
if options.remove_horizon_deviations:
values = numpy.array(items)[:,1]
mean_horizon = values[values!=0].mean()
items = [item for item in items if item[1] < (mean_horizon * (1. + options.deviation_percent))]
# compress array # compress array
j = 1 j = 1
......
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