Skip to content

Make sure default automerge params reflect their type#4483

Open
chrishalcrow wants to merge 1 commit intoSpikeInterface:mainfrom
chrishalcrow:make-slay-params-floats
Open

Make sure default automerge params reflect their type#4483
chrishalcrow wants to merge 1 commit intoSpikeInterface:mainfrom
chrishalcrow:make-slay-params-floats

Conversation

@chrishalcrow
Copy link
Copy Markdown
Member

In spikeinterface-gui, the parameter type of each autmerge algorithm is computed by computing the type of the default.

Before this PR there were some mismatches between the type (e.g. min_snr is a float param) and the type of the default value (min_snr has default value 2). This means the user cannot change min_snr to float values in the GUI. This PR ensures all default param values have the type intended by their param.

@chrishalcrow chrishalcrow added bug Something isn't working curation Related to curation module labels Mar 31, 2026
@zm711
Copy link
Copy Markdown
Member

zm711 commented Mar 31, 2026

Would it be worth adding type hints somewhere around here. Otherwise I think it would be too easy for these things to get out of sync in the future, no?

@chrishalcrow
Copy link
Copy Markdown
Member Author

chrishalcrow commented Apr 1, 2026

Would it be worth adding type hints somewhere around here. Otherwise I think it would be too easy for these things to get out of sync in the future, no?

Yeah it's a good point. It's a bit awkward: some of these are type-hinted in their function signatures but the values are given here. This is fine internally: it's only a problem when used externally by e.g. si-gui. It's not easy to test because the function signatures are scattered all over the place, and only covers some parameters e.g. min_spikes is just used here, and it passed through some generic params dict:

to_remove = num_spikes < params["min_spikes"]

so isn't typed anywhere...

EDIT: one option is to wait until 3.11 (~ a year's time) and then implement TypedDicts everywhere we use parameters...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working curation Related to curation module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants