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

Hard code synchony_sizes #3559

Merged
merged 3 commits into from
Dec 5, 2024

Conversation

chrishalcrow
Copy link
Collaborator

Fix #3549

Currently there is one metric, synchony, whose column names depends on a kwarg: synchony_sizes. If the user inputs synchony_sizes = [3,5,7] the columns in the quality_metrics dataframe are sync_spikes_3, sync_spikes_5 and sync_spikes_7. This is a bit awkward to deal with in a few places. Computing these custom synchrony_sizes are a bit of an edge case, so me @alejoe91 and @zm711 decided to just hard code the default values of synchony_sizes = [2,4,8].

To help users who really want to compute custom synchony sizes, I've left the _compute_synchonry_counts function (which is called by the user-facing compute_synchrony_metrics function) with the ability to do this, but made it private.

No backwards compatibility issues spring to mind: using this PR you can still load an old sorting_analyzer with sync_spikes_3 columns. Also, it shouldn't be breaking: if you pass the synchony_sizes kwarg to compute_synchrony_metrics it still computes, just with a warning.

@alejoe91 alejoe91 added the qualitymetrics Related to qualitymetrics module label Dec 2, 2024
Copy link
Collaborator

@zm711 zm711 left a comment

Choose a reason for hiding this comment

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

Couple requests and one discussion point along with Alessio's comment. :)

@@ -520,18 +520,18 @@ def compute_sliding_rp_violations(
)


def get_synchrony_counts(spikes, synchrony_sizes, all_unit_ids):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does change the order in order to have the default. I guess I don't see a way around this, so it's okay.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or do we event need the auto default if the user api already feeds this. We could have this be the same, but private no? Something to think about @alejoe91 @chrishalcrow

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I think you're right. The function is only used in compute_synchrony_metrics, and this allows people to use get_synchrony_counts with the synchrony_sizes in another context and keeps the order in tact. Nice.

src/spikeinterface/qualitymetrics/misc_metrics.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@zm711 zm711 left a comment

Choose a reason for hiding this comment

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

This is good by me now!

@alejoe91 alejoe91 merged commit c260df1 into SpikeInterface:main Dec 5, 2024
15 checks passed
@chrishalcrow chrishalcrow deleted the hardcode-sync-sizes branch December 5, 2024 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qualitymetrics Related to qualitymetrics module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix handling of synchrony columns in qualitymetrics
3 participants