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

Always get new catalog from detections #598 #601

Merged
merged 2 commits into from
Dec 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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)

Check warning on line 54 in eqcorrscan/core/match_filter/family.py

View check run for this annotation

Codecov / codecov/patch

eqcorrscan/core/match_filter/family.py#L54

Added line #L54 was not covered by tests

@catalog.setter
def catalog(self, catalog):
Expand Down Expand Up @@ -151,13 +148,11 @@
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
Loading