added logging for multiple matches instead of crashing

This commit is contained in:
Abyss Halley 2025-08-28 12:24:55 -04:00
parent 0f86d58b20
commit 707cc6bd08

View file

@ -126,14 +126,17 @@ for detection in detections.itertuples():
) )
matches = injections.query(qstring) matches = injections.query(qstring)
if len(matches) > 0: if len(matches) > 0:
logger.debug(f"Detection: DM {detection.dm} and PW {detection.pulseWidth}") try:
logger.debug(matches) logger.debug(f"Detection: DM {detection.dm} and PW {detection.pulseWidth}")
if len(matches) == 1: logger.debug(matches)
i = matches.index[0] if len(matches) == 1:
matchCount[i] += 1 i = matches.index[0]
logger.debug("======") matchCount[i] += 1
elif len(matches) > 1: logger.debug("======")
raise ValueError("MULTIPLE MATCHES OHNO") elif len(matches) > 1:
raise ValueError("MULTIPLE MATCHES OHNO")
except ValueError:
logger.warn(f"Multiple matches found in file {detection.file}")
else: #no matching injection... else: #no matching injection...
falsePositiveMask[detection.Index] = True falsePositiveMask[detection.Index] = True
logger.debug(f"NO MATCH FOR: DM {detection.dm} and PW {detection.pulseWidth}") logger.debug(f"NO MATCH FOR: DM {detection.dm} and PW {detection.pulseWidth}")