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

Online Detectors Check missing logic #100

Open
KaraMelih opened this issue May 29, 2024 · 0 comments
Open

Online Detectors Check missing logic #100

KaraMelih opened this issue May 29, 2024 · 0 comments
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed

Comments

@KaraMelih
Copy link
Collaborator

Thanks to @Sheshuk we have noticed a bug in the coincidence system.

Normally, in here

def ncr(n, r):
f = math.factorial
return int(f(n) / f(r) / f(n - r))
def cache_false_alarm_rate(cache_sub_list, hb_cache):
""" Assume false alarm rate of 1 per week
returns the combined false alarm rate in years
meaning; if there are 8 active detectors, each with false alarm rate of 1/week
We would get a false alarm with 2-fold coincidence every X years
The formula;
n = number of detectors
r = number of coincidences
C(n,r) = \frac{n!}{r!(n-r)!}
R_{combined} = C(n,r)+1 \times F_{im, d1} * F_{im, d2} ... * F_{im, dn} \times δt^{r-1}
"""
seconds_year = 31_556_926
seconds_week = 604800
single_imitation_freq = 1 / seconds_week # 1/week in seconds
online_detectors = len(hb_cache.Detector.unique()) # n
coincident_detectors = len(cache_sub_list['detector_name']) # r
time_window = 10 # seconds
combinations = ncr(online_detectors, coincident_detectors)
combined_imitation_freq = (combinations + 1) * np.power(single_imitation_freq, coincident_detectors) * np.power(
time_window, coincident_detectors - 1)
comb_Fim_year = combined_imitation_freq / seconds_year
return 1/comb_Fim_year

We compute the number of detectors available at the time of the alert to compute false-alarm probability of such a trigger. There are 2 problems at the moment, one was already discussed;

  1. We check the number of available detectors at the time when we receive the alerts not at the time where the neutrino events were detected. (See picture)
    Picture1

  2. We depend on the heartbeat messages to come frequently, however, if there are no heartbeats registered at the time of Observation message, the heartbeat cache will be empty and the FAR calculation thinks that there is a coincidence between 2 detectors out of 0 available detectors (since no HB is registered).

For the second issue, we talked about registering a heartbeat for each observation message but not yet implemented. Currently, when the heartbeat cache is empty, FAR tries to compute a factorial with 0 detectors and crashes before sending the message. We can do a quick-patch to ignore FAR when cache is empty. However, we need to fix the real issue.

@KaraMelih KaraMelih added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed labels May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant