Skip to content

Commit

Permalink
Clarify that the lock is for the stat calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
GarethCabournDavies committed Apr 23, 2024
1 parent 3c44532 commit 8c18195
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pycbc/events/coinc.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ class (in seconds), default not do do this
)

self.time_stat_refreshed = dt.now()
self.lock = threading.Lock()
self.stat_calculator_lock = threading.Lock()
self.statistic_refresh_rate = statistic_refresh_rate

self.timeslide_interval = timeslide_interval
Expand Down Expand Up @@ -1381,7 +1381,7 @@ def add_singles(self, results):
valid_ifos = [k for k in results.keys() if results[k] and k in self.ifos]
if len(valid_ifos) == 0: return {}

with self.lock:
with self.stat_calculator_lock:
# Add single triggers to the internal buffer
self._add_singles_to_buffer(results, ifos=valid_ifos)

Expand Down Expand Up @@ -1422,7 +1422,7 @@ def refresh_statistic(self):
"Checking %s statistic for updated files",
''.join(self.ifos),
)
with self.lock:
with self.stat_calculator_lock:
self.stat_calculator.check_update_files()
# Sleep one second for safety
time.sleep(1)
Expand Down
8 changes: 4 additions & 4 deletions pycbc/events/single.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class (in seconds), default not do do this
self.maximum_ifar = maximum_ifar

self.time_stat_refreshed = dt.now()
self.lock = threading.Lock()
self.stat_calculator_lock = threading.Lock()
self.statistic_refresh_rate = statistic_refresh_rate

stat_class = stat.get_statistic(statistic)
Expand Down Expand Up @@ -275,7 +275,7 @@ def check(self, trigs, data_reader):
trigsc['chisq_dof'] = (cut_trigs['chisq_dof'] + 2) / 2

# Calculate the ranking reweighted SNR for cutting
with self.lock:
with self.stat_calculator_lock:
single_rank = self.stat_calculator.get_sngl_ranking(trigsc)

sngl_idx = single_rank > self.thresholds['newsnr']
Expand All @@ -286,7 +286,7 @@ def check(self, trigs, data_reader):
for k in trigs}

# Calculate the ranking statistic
with self.lock:
with self.stat_calculator_lock:
sngl_stat = self.stat_calculator.single(cutall_trigs)
rank = self.stat_calculator.rank_stat_single((self.ifo, sngl_stat))

Expand Down Expand Up @@ -380,7 +380,7 @@ def refresh_statistic(self):
"Checking %s statistic for updated files",
self.ifo,
)
with self.lock:
with self.stat_calculator_lock:
self.stat_calculator.check_update_files()
# Sleep one second for safety
time.sleep(1)
Expand Down

0 comments on commit 8c18195

Please sign in to comment.