Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/spikeinterface/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,25 +109,25 @@ def do_plot(self):

@classmethod
def ensure_sorting_analyzer(cls, input):
# internal help to accept both SortingAnalyzer or MockWaveformExtractor for a ploter
# internal help to accept both SortingAnalyzer or MockWaveformExtractor for a plotter
if isinstance(input, SortingAnalyzer):
return input
elif isinstance(input, MockWaveformExtractor):
return input.sorting_analyzer
else:
return input
raise TypeError("input must be a SortingAnalyzer or MockWaveformExtractor")

@classmethod
def ensure_sorting(cls, input):
# internal help to accept both Sorting or SortingAnalyzer or MockWaveformExtractor for a ploter
# internal help to accept both Sorting or SortingAnalyzer or MockWaveformExtractor for a plotter
if isinstance(input, BaseSorting):
return input
elif isinstance(input, SortingAnalyzer):
return input.sorting
elif isinstance(input, MockWaveformExtractor):
return input.sorting_analyzer.sorting
else:
return input
raise TypeError("input must be a SortingAnalyzer, MockWaveformExtractor, or of type BaseSorting")

@staticmethod
def check_extensions(sorting_analyzer, extensions):
Expand Down
4 changes: 3 additions & 1 deletion src/spikeinterface/widgets/crosscorrelograms.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def __init__(
backend=None,
**backend_kwargs,
):
sorting_analyzer_or_sorting = self.ensure_sorting_analyzer(sorting_analyzer_or_sorting)

if not isinstance(sorting_analyzer_or_sorting, BaseSorting):
sorting_analyzer_or_sorting = self.ensure_sorting_analyzer(sorting_analyzer_or_sorting)
Comment on lines +50 to +51
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here you break the fact that sorting can be an input no ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok
then it is ok.


if min_similarity_for_correlograms is None:
min_similarity_for_correlograms = 0
Expand Down