Skip to content

Commit

Permalink
Remove unnecessary warning catch following plotpy verrsion upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed Aug 2, 2024
1 parent be1ff39 commit 442559a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions cdl/computation/image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from __future__ import annotations

import warnings
from collections.abc import Callable
from typing import Any, Literal

Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 442559a

Please sign in to comment.