Skip to content

Commit

Permalink
Check and test for SV number of shadings
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoe91 committed Nov 22, 2023
1 parent 81545e2 commit 68b2383
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/spikeinterface/widgets/tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,17 @@ def test_plot_unit_templates(self):
backend=backend,
**self.backend_kwargs[backend],
)
else:
# sortingview doesn't support more than 2 shadings
with self.assertRaises(AssertionError):
sw.plot_unit_templates(
self.we_sparse,
sparsity=self.sparsity_best,
unit_ids=unit_ids,
templates_percentile_shading=[1, 5, 25, 75, 95, 99],
backend=backend,
**self.backend_kwargs[backend],
)

def test_plot_unit_waveforms_density_map(self):
possible_backends = list(sw.UnitWaveformDensityMapWidget.get_possible_backends())
Expand Down
2 changes: 2 additions & 0 deletions src/spikeinterface/widgets/unit_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def plot_sortingview(self, data_plot, **backend_kwargs):

dp = to_attr(data_plot)

assert len(dp.templates_shading) <= 4, "Only 2 ans 4 templates shading are supported in sortingview"

# ensure serializable for sortingview
unit_id_to_channel_ids = dp.sparsity.unit_id_to_channel_ids
unit_id_to_channel_indices = dp.sparsity.unit_id_to_channel_indices
Expand Down

0 comments on commit 68b2383

Please sign in to comment.