Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add statistic correction option #5061

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion pycbc/events/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,9 +963,16 @@ def __init__(self, sngl_ranking, files=None, ifos=None, **kwargs):
# This will be used to keep track of the template number being used
self.curr_tnum = None

# Applies a constant offset to all statistic values in a given instance.
# This can be used to e.g. change relative rankings between different
# event types. Default is zero offset.
self.stat_correction = float(
self.kwargs.get("statistic_correction", 0)
)

# Go through the keywords and add class information as needed:
if self.kwargs["sensitive_volume"]:
# Add network sensitivity beckmark
# Add network sensitivity benchmark
self.single_dtype.append(("benchmark_logvol", numpy.float32))
# benchmark_logvol is a benchmark sensitivity array
# over template id
Expand Down Expand Up @@ -1593,6 +1600,9 @@ def rank_stat_single(self, single_info):
# Combine the signal and noise rates
loglr = ln_s - ln_noise_rate

# Apply statistic correction
loglr += self.stat_correction

# cut off underflowing and very small values
loglr[loglr < self.min_stat] = self.min_stat
return loglr
Expand Down Expand Up @@ -1678,6 +1688,9 @@ def rank_stat_coinc(
# Combine the signal and noise rates
loglr = ln_s - ln_noise_rate

# Apply statistic correction
loglr += self.stat_correction

# cut off underflowing and very small values
loglr[loglr < self.min_stat] = self.min_stat

Expand Down Expand Up @@ -1757,6 +1770,9 @@ def coinc_lim_for_thresh(
# Combine the signal and noise rates
loglr = ln_s - ln_noise_rate

# Apply statistic correction
loglr += self.stat_correction

# From this combined rate, what is the minimum snglstat value
# in the pivot IFO needed to reach the threshold?
return loglr - thresh
Expand Down
Loading