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
4 changes: 3 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This file records user-visible changes to phy. The format is based on

Changes below are available from the latest source checkout but have not yet
been included in a stable release. The current entries cover all user-visible
changes committed on 23–24 July 2026; test-only commits are represented by the
changes committed since 23 July 2026; test-only commits are represented by the
behavior they verify rather than listed separately.

### Added
Expand Down Expand Up @@ -48,6 +48,8 @@ behavior they verify rather than listed separately.
- Cluster and Similarity View filters only take keyboard focus after an
explicit click, including when a table is first shown or refreshed. Enter,
Escape, and outside clicks release filter focus so global shortcuts resume.
- Display metadata columns containing multiple values in the Cluster and
Similarity Views instead of leaving their cells blank.

### Changed

Expand Down
12 changes: 12 additions & 0 deletions phy/cluster/tests/test_supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,18 @@ def test_cluster_view_formats_spike_counts(qtbot, gui):
assert index.data(Qt.EditRole) == 1234567


def test_cluster_view_formats_multiple_values(qtbot, gui):
cv = ClusterView(
gui,
data=[{'id': 1, 'n_spikes': 10, 'tags': ['tag_a', 'tag_b']}],
columns=['tags'],
)
_wait_until_table_ready(qtbot, cv)

index = cv._proxy.index(0, cv.columns.index('tags'))
assert index.data(Qt.DisplayRole) == 'tag_a, tag_b'


def test_similarity_view_1(qtbot, gui):
sv = SimilarityView(gui)
_wait_until_table_ready(qtbot, sv)
Expand Down
8 changes: 7 additions & 1 deletion phy/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from contextlib import contextmanager
from functools import partial

import numpy as np
from phylib.utils import connect, emit
from phylib.utils._misc import _CustomEncoder, _pretty_floats
from phylib.utils._types import _is_integer
Expand Down Expand Up @@ -364,8 +365,13 @@ def data(self, index, role=Qt.DisplayRole):
return ''
# Qt's model/view cannot display numpy scalars (np.int64/np.float64),
# which render as blank cells; convert them to native Python types.
if hasattr(value, 'item'):
if isinstance(value, np.generic):
value = value.item()
if role == Qt.DisplayRole:
if isinstance(value, np.ndarray):
value = value.tolist()
if isinstance(value, (list, tuple)):
return ', '.join(map(str, value))
# Keep the raw value available for sorting and filtering, while making
# spike counts easier to scan in the cluster and similarity tables.
if role == Qt.DisplayRole and column == 'n_spikes' and isinstance(value, int):
Expand Down
Loading