Skip to content
Closed
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
6 changes: 5 additions & 1 deletion src/napari_deeplabcut/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from dask_image.imread import imread
from napari.types import LayerData
from natsort import natsorted
from pandas.api.types import is_numeric_dtype

from napari_deeplabcut import misc

Expand Down Expand Up @@ -228,7 +229,10 @@ def read_hdf(filename: str) -> list[LayerData]:
nrows = df.shape[0]
data = np.empty((nrows, 3))
image_paths = df["level_0"]
if np.issubdtype(image_paths.dtype, np.number):
dtype = getattr(image_paths, "dtype", None)
if dtype is None:
dtype = np.asarray(image_paths).dtype
if is_numeric_dtype(dtype):
image_inds = image_paths.values
paths2inds = []
else:
Expand Down
5 changes: 4 additions & 1 deletion src/napari_deeplabcut/_tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,11 @@ def test_matplotlib_canvas_initialization_and_slider(viewer, points, qtbot):
assert canvas._window == initial_window + 100
assert canvas.slider_value.text() == str(initial_window + 100)

# Test plot refresh on frame change
# Test plot refresh does nothing when plot is hidden
canvas.update_plot_range(event=type("Event", (), {"value": [5]}))
assert canvas._n == 0
# Test plot refresh on frame change (forced as it is hidden)
canvas.update_plot_range(event=type("Event", (), {"value": [5]}), force=True)
assert canvas._n == 5
# Check that x-limits reflect the new window
start, end = canvas.ax.get_xlim()
Expand Down
Loading