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

Avoid duplicated template and quality metric names #2210

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

alejoe91
Copy link
Member

In principle, the user can set duplicated metrics name. This simple PR makes a unique of the metric names to avoid duplication in the output dataframes

@alejoe91 alejoe91 added postprocessing Related to postprocessing module qualitymetrics Related to qualitymetrics module labels Nov 15, 2023
@@ -60,7 +60,7 @@ def _set_params(
metric_names += get_multi_channel_template_metric_names()
metrics_kwargs = metrics_kwargs or dict()
params = dict(
metric_names=[str(name) for name in metric_names],
metric_names=[str(name) for name in np.unique(metric_names)],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a list maybe you can use set?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g: {str(name) for name in metric_names}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well it needs to be a list!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it could also be:
[[str(name) for name in set(metric_names)]

But it probably does not matter for this size anyway : )

Copy link
Collaborator

@h-mayorquin h-mayorquin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, looks good to me. Simple change. Was it causing any trouble?

@alejoe91
Copy link
Member Author

yes, especially if you use include_multi_channel_metrics=True and you define some of these metrics in the metric_names

@alejoe91 alejoe91 merged commit 6b170c5 into SpikeInterface:main Nov 15, 2023
9 checks passed
@alejoe91 alejoe91 deleted the template-metrics-duplication branch April 12, 2024 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
postprocessing Related to postprocessing module qualitymetrics Related to qualitymetrics module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants