Add errors to ensure functions in Base of widgets#2791
Add errors to ensure functions in Base of widgets#2791samuelgarcia merged 2 commits intoSpikeInterface:mainfrom
ensure functions in Base of widgets#2791Conversation
|
I see what the problem was. The correlograms were the exception that needed to allow the sorting to pass through. I think this solution is a bit better since it checks for sorting and if not sorting then we do the ensure which will raise an error if someone passes something random. This should be more robust to end-users potentially passing the wrong thing (in my opinion :) ) |
| if not isinstance(sorting_analyzer_or_sorting, BaseSorting): | ||
| sorting_analyzer_or_sorting = self.ensure_sorting_analyzer(sorting_analyzer_or_sorting) |
There was a problem hiding this comment.
Here you break the fact that sorting can be an input no ?
There was a problem hiding this comment.
Actually tests are passing now.
The logic for the if statement is
if base sorting => continue as base sorting
if not base sorting => ensure sorting analyzer (for sorting analyzer or mock waveform)
So both cases are addressed.
|
Theses function were more here for automatic convertion (with MockWaveform) than for a script type checking. |
|
This looks good to me |
|
lets merge and see. |
This came up during talking in #2782, but I think
TypeErrorinstead ofValueErrorno? @alejoe91 ?And was there a reason you didn't want an error here originally @samuelgarcia @alejoe91 ?