From dca7a0e9313edfcc9d89ec3e816c927f0f18f49c Mon Sep 17 00:00:00 2001 From: maximpavliv Date: Tue, 26 Aug 2025 14:29:56 +0200 Subject: [PATCH] Suppress RuntimeWarnings caused by NaNs in dataframe (predictions) --- src/napari_deeplabcut/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/napari_deeplabcut/__init__.py b/src/napari_deeplabcut/__init__.py index 7b49e80..3e34644 100644 --- a/src/napari_deeplabcut/__init__.py +++ b/src/napari_deeplabcut/__init__.py @@ -4,6 +4,14 @@ # FIXME: Circumvent the need to access window.qt_viewer warnings.filterwarnings("ignore", category=FutureWarning) +import re +# Suppress RuntimeWarnings caused by NaN values in dataframe +# (encountered during model-predicted labels refinement stage) +warnings.filterwarnings( + "ignore", + category=RuntimeWarning, + message=re.escape("invalid value encountered in cast"), +) class VispyWarningFilter(logging.Filter): def filter(self, record):