Skip to content
Snippets Groups Projects
Commit ea711326 authored by Prathamesh Joshi's avatar Prathamesh Joshi
Browse files

Count Tracker: Suggested changes during code review

parent d89251f5
No related branches found
No related tags found
1 merge request!298Count Tracker: Suggested changes during code review
Pipeline #450480 passed
......@@ -1245,7 +1245,7 @@ class LLOIDTracker:
self.eye_candy.update(events, self.stream_thinca.last_coincs)
# store count tracker counts around the GraceDB times
if gracedb_ids_times != None and gracedb_ids_times[1] != []:
if gracedb_ids_times is not None:
store_counts_times.extend(gracedb_ids_times[1])
# after doing alerts, no longer need
......
......@@ -59,18 +59,6 @@ import lal
from lal import rate
from lalburst import snglcoinc
import lalsimulation
try:
import bottle
if tuple(map(int, bottle.__version__.split("."))) < (0, 13):
# FIXME: see
# https://git.ligo.org/lscsoft/gstlal/-/merge_requests/146
# if the required patch is added to the distro-supplied
# bottle before a 0.13 is released, update the version
# check to the correct version
raise ImportError
except ImportError:
# FIXME: remove after system-wide isntall can be relied on
from gstlal import bottle
# FIXME: caution, this information might get organized differently later.
......@@ -201,7 +189,7 @@ class LnLRDensity(snglcoinc.LnLRDensity):
# size and duration: useful stuff for the count tracker
def time_key(self, time):
size = 10 # granularity for tracking counts
size = 10 #granularity for tracking counts
return int(time) - int(time)%size
def increment(self, event):
......@@ -285,7 +273,6 @@ class LnLRDensity(snglcoinc.LnLRDensity):
(snr_ind, chi_ind) = numpy.unravel_index(bin_id, self.snr_chi_binning.shape)
assert lnpdf.array[snr_ind, chi_ind] - 1 >= 0., "Negative values in PDF while removing counts in " + ifo + " at time " + str(gps_time)
lnpdf.array[snr_ind, chi_ind] -= 1
self.densities[key] = lnpdf
def copy(self):
new = type(self)(self.template_ids, self.instruments, self.delta_t, self.min_instruments)
......@@ -394,8 +381,8 @@ class LnLRDensity(snglcoinc.LnLRDensity):
try:
elem = rate.BinnedArray.get_xml_root(xml, u"remove_counts_times")
self.remove_counts_times = ligolw_array.get_array(elem, "array").array
except:
print("No remove_counts data to load")
except ValueError:
print("No remove_counts data to load", file=sys.stderr)
try:
ct_gpstimes = {ifo:[] for ifo in self.instruments}
......@@ -407,8 +394,8 @@ class LnLRDensity(snglcoinc.LnLRDensity):
elem = rate.BinnedArray.get_xml_root(xml, ifo + "_" + str(gps_time) + u"_count_tracker")
ct[ifo][gps_time] = ligolw_array.get_array(elem, "array").array
self.count_tracker = ct
except:
print("No count_tracker data to load")
except ValueError:
print("No count_tracker data to load", file=sys.stderr)
for key in self.densities:
self.densities[key] = self.densities[key].from_xml(xml, key)
return self
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment