From 442559ae50633bbead9ca7638607ecf2d01f3ba8 Mon Sep 17 00:00:00 2001
From: Pierre Raybaut
Date: Fri, 2 Aug 2024 14:30:27 +0200
Subject: [PATCH] Remove unnecessary warning catch following plotpy verrsion
upgrade
---
CHANGELOG.md | 1 -
cdl/computation/image/__init__.py | 8 +-------
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 018e1424..009854e7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -33,7 +33,6 @@ See DataLab [roadmap page](https://datalab-platform.com/en/contributing/roadmap.
* Intensity profile / Segment profile extraction:
* When extracting a profile on an image with a ROI defined, the associated PlotPy feature show a warning message ('UserWarning: Warning: converting a masked element to nan.') but the profile is correctly extracted and displayed, with NaN values where the ROI is not defined.
- * This warning message will persist until PlotPy v2.5.2 is released
* NaN values are now removed from the profile before plotting it
* Simple processing features with a one-to-on mapping with a Python function (e.g. `numpy.absolute`, `numpy.log10`, etc.) and without parameters: fix result object title which was systematically ending with "|" (the character that usually precedes the list of parameters)
* Butterworth filter: fix cutoff frequency ratio default value and valid range
diff --git a/cdl/computation/image/__init__.py b/cdl/computation/image/__init__.py
index 45fe93d0..26740325 100644
--- a/cdl/computation/image/__init__.py
+++ b/cdl/computation/image/__init__.py
@@ -12,7 +12,6 @@
from __future__ import annotations
-import warnings
from collections.abc import Callable
from typing import Any, Literal
@@ -867,12 +866,7 @@ def compute_segment_profile(src: ImageObj, p: SegmentProfileParam) -> ImageObj:
p.row2 = min(p.row2, data.shape[0] - 1)
p.col2 = min(p.col2, data.shape[1] - 1)
suffix = f"({p.row1}, {p.col1})-({p.row2}, {p.col2})"
-
- # TODO: Remove the warning catch when upgrading to PlotPy >= 2.5.2
- with warnings.catch_warnings():
- warnings.simplefilter("ignore", UserWarning)
- x, y = csline(data, p.row1, p.col1, p.row2, p.col2)
-
+ x, y = csline(data, p.row1, p.col1, p.row2, p.col2)
x, y = x[~np.isnan(y)], y[~np.isnan(y)] # Remove NaN values
dst = dst_11_signal(src, "segment_profile", suffix)
dst.set_xydata(np.array(x, dtype=float), np.array(y, dtype=float))