Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 17, 2025
1 parent b44bcaf commit e8b4fe1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
11 changes: 5 additions & 6 deletions src/spikeinterface/widgets/sorting_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

_default_displayed_unit_properties = ["firing_rate", "num_spikes", "x", "y", "amplitude", "snr", "rp_violation"]


class SortingSummaryWidget(BaseWidget):
"""
Plots spike sorting summary.
Expand Down Expand Up @@ -65,6 +66,7 @@ class SortingSummaryWidget(BaseWidget):
This replaces the label_choices in the curation_format.
(spikeinterface_gui backend)
"""

def __init__(
self,
sorting_analyzer: SortingAnalyzer,
Expand All @@ -82,16 +84,15 @@ def __init__(
unit_table_properties=None,
**backend_kwargs,
):

if unit_table_properties is not None:
warnings.warn(
"plot_sorting_summary() : unit_table_properties is deprecated, use displayed_unit_properties instead",
category=DeprecationWarning,
stacklevel=2,
)
)
displayed_unit_properties = unit_table_properties


sorting_analyzer = self.ensure_sorting_analyzer(sorting_analyzer)
self.check_extensions(
sorting_analyzer, ["correlograms", "spike_amplitudes", "unit_locations", "template_similarity"]
Expand All @@ -108,7 +109,7 @@ def __init__(
displayed_unit_properties = list(_default_displayed_unit_properties)
if extra_unit_properties is not None:
displayed_unit_properties += list(extra_unit_properties.keys())

data_plot = dict(
sorting_analyzer=sorting_analyzer,
unit_ids=unit_ids,
Expand Down Expand Up @@ -230,7 +231,6 @@ def plot_spikeinterface_gui(self, data_plot, **backend_kwargs):

from spikeinterface_gui import run_mainwindow


run_mainwindow(
sorting_analyzer,
with_traces=True,
Expand All @@ -240,4 +240,3 @@ def plot_spikeinterface_gui(self, data_plot, **backend_kwargs):
extra_unit_properties=data_plot["extra_unit_properties"],
displayed_unit_properties=data_plot["displayed_unit_properties"],
)

10 changes: 6 additions & 4 deletions src/spikeinterface/widgets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ def array_to_image(
return output_image



def make_units_table_from_sorting(sorting, units_table=None):
"""
Make a DataFrame from sorting properties.
Expand All @@ -266,6 +265,7 @@ def make_units_table_from_sorting(sorting, units_table=None):

if units_table is None:
import pandas as pd

units_table = pd.DataFrame(index=sorting.unit_ids)

for col in sorting.get_property_keys():
Expand All @@ -275,10 +275,11 @@ def make_units_table_from_sorting(sorting, units_table=None):

return units_table


def make_units_table_from_analyzer(
analyzer,
extra_properties=None,
):
analyzer,
extra_properties=None,
):
"""
Make a DataFrame by aggregating :
* quality metrics
Expand All @@ -302,6 +303,7 @@ def make_units_table_from_analyzer(
Table containing all columns.
"""
import pandas as pd

all_df = []

if analyzer.get_extension("unit_locations") is not None:
Expand Down
5 changes: 2 additions & 3 deletions src/spikeinterface/widgets/utils_sortingview.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .utils import make_units_table_from_sorting, make_units_table_from_analyzer



def make_serializable(*args):
dict_to_serialize = {int(i): a for i, a in enumerate(args)}
serializable_dict = check_json(dict_to_serialize)
Expand Down Expand Up @@ -65,7 +64,7 @@ def generate_unit_table_view(
sorting = sorting_or_sorting_analyzer
units_tables = make_units_table_from_sorting(sorting)
# analyzer = None

if unit_properties is None:
ut_columns = []
ut_rows = [vv.UnitsTableRow(unit_id=u, values={}) for u in sorting.unit_ids]
Expand Down Expand Up @@ -105,5 +104,5 @@ def generate_unit_table_view(
ut_rows.append(vv.UnitsTableRow(unit_id=unit_id, values=check_json(row_values)))

v_units_table = vv.UnitsTable(rows=ut_rows, columns=ut_columns, similarity_scores=similarity_scores)

return v_units_table

0 comments on commit e8b4fe1

Please sign in to comment.