Skip to content

Commit

Permalink
Merge pull request #601 from eqcorrscan/issue_598
Browse files Browse the repository at this point in the history
Always get new catalog from detections #598
  • Loading branch information
calum-chamberlain authored Dec 15, 2024
2 parents 8e40eac + 209bb0f commit 83b3d91
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions eqcorrscan/core/match_filter/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,13 @@ def __init__(self, template, detections=None, catalog=None):
if isinstance(detections, Detection):
detections = [detections]
self.detections = detections or []
self.__catalog = get_catalog(self.detections)
if catalog:
Logger.warning("Setting catalog directly is no-longer supported, "
"now generated from detections.")

@property
def catalog(self):
if len(self.__catalog) != len(self.detections):
self.__catalog = get_catalog(self.detections)
return self.__catalog
return get_catalog(self.detections)

@catalog.setter
def catalog(self, catalog):
Expand Down Expand Up @@ -151,13 +148,11 @@ def __iadd__(self, other):
if isinstance(other, Family):
if other.template == self.template:
self.detections.extend(other.detections)
self.__catalog.events.extend(get_catalog(other.detections))
else:
raise NotImplementedError('Templates do not match')
elif isinstance(other, Detection) and other.template_name \
== self.template.name:
self.detections.append(other)
self.__catalog.events.extend(get_catalog([other]))
elif isinstance(other, Detection):
raise NotImplementedError('Templates do not match')
else:
Expand Down

0 comments on commit 83b3d91

Please sign in to comment.