Skip to content

Commit

Permalink
backwards compatible loading
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishalcrow committed Nov 14, 2024
1 parent fdc01f5 commit 9db0b83
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/spikeinterface/postprocessing/template_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,18 @@ def _run(self, verbose=False):
def _get_data(self):
return self.data["metrics"]

def load_params(self):
AnalyzerExtension.load_params(self)
# For backwards compatibility - this reformats metrics_kwargs as metric_params
if (metrics_kwargs := self.params.get("metrics_kwargs")) is not None:

metric_params = {}
for metric_name in self.params["metric_names"]:
metric_params[metric_name] = deepcopy(metrics_kwargs)
self.params["metric_params"] = metric_params

del self.params["metrics_kwargs"]


register_result_extension(ComputeTemplateMetrics)
compute_template_metrics = ComputeTemplateMetrics.function_factory()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,13 @@ def _run(self, verbose=False, **job_kwargs):
def _get_data(self):
return self.data["metrics"]

def load_params(self):
AnalyzerExtension.load_params(self)
# For backwards compatibility - this renames qm_params as metric_params
if (qm_params := self.params.get("qm_params")) is not None:
self.params["metric_params"] = qm_params
del self.params["qm_params"]


register_result_extension(ComputeQualityMetrics)
compute_quality_metrics = ComputeQualityMetrics.function_factory()
Expand Down

0 comments on commit 9db0b83

Please sign in to comment.