Skip to content

Commit 18f0408

Browse files
committed
Fix: ensure analysis results are cleared when processing signals or images
Fix #136
1 parent 8a8b4b6 commit 18f0408

File tree

6 files changed

+15
-4
lines changed

6 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ See DataLab [roadmap page](https://datalab-platform.com/en/contributing/roadmap.
1010

1111
🛠️ Bug fixes:
1212

13+
* Fixed [Issue #136](https://github.com/DataLab-Platform/DataLab/issues/136) - When processing a signal or an image, the analysis result is kept from original object
14+
* Before this fix, when processing a signal or an image (e.g. when applying a filter, a threshold, etc.), the analysis result was kept from the original object, and was not updated with the new data. Thus the analysis result was not meaningful anymore, and was misleading the user.
15+
* This is now fixed: the analysis result is now removed when processing a signal or an image. However it is not recalculated automatically, because there is no way to know which analysis result should be recalculated (e.g. if the user has applied a filter, should the FWHM be recalculated?) - besides, the current implementation of the analysis features does not allow to recalculate the analysis results automatically when the data is modified. The user has to recalculate the analysis results manually if needed.
1316
* Fixed [Issue #132](https://github.com/DataLab-Platform/DataLab/issues/132) - Plot analysis results: "One curve per result title" mode ignores ROIs
1417
* Before this fix, the "One curve per result title" mode was ignoring ROIs, and was plotting the selected result for all objects (signals or images) without taking into account the ROI defined on the objects
1518
* This is now fixed: the "One curve per result title" mode now takes into account the ROI defined on the objects, and plots the selected result for each object (signal or image) and for each ROI defined on the object

cdl/computation/base.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ def dst_11(
199199
title += "|"
200200
if suffix: # suffix may be None or an empty string
201201
title += suffix
202-
return src.copy(title=title)
202+
dst = src.copy(title=title)
203+
dst.delete_results() # Remove any previous results
204+
return dst
203205

204206

205207
def dst_n1n(
@@ -225,7 +227,9 @@ def dst_n1n(
225227
title = f"{name}({src1.short_id}, {src2.short_id})"
226228
if suffix is not None:
227229
title += "|" + suffix
228-
return src1.copy(title=title)
230+
dst = src1.copy(title=title)
231+
dst.delete_results() # Remove any previous results
232+
return dst
229233

230234

231235
def new_signal_result(

cdl/computation/image/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ def compute_arithmetic(src1: ImageObj, src2: ImageObj, p: ArithmeticParam) -> Im
289289
initial_dtype = src1.data.dtype
290290
title = p.operation.replace("obj1", src1.short_id).replace("obj2", src2.short_id)
291291
dst = src1.copy(title=title)
292+
dst.delete_results() # Remove any previous results
292293
o, a, b = p.operator, p.factor, p.constant
293294
# Apply operator
294295
if o in ("×", "/") and a == 0.0:

cdl/computation/signal.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ def compute_arithmetic(
251251
initial_dtype = src1.xydata.dtype
252252
title = p.operation.replace("obj1", src1.short_id).replace("obj2", src2.short_id)
253253
dst = src1.copy(title=title)
254+
dst.delete_results() # Remove any previous results
254255
o, a, b = p.operator, p.factor, p.constant
255256
if o in ("×", "/") and a == 0.0:
256257
dst.y = np.ones_like(src1.y) * b

cdl/core/gui/processor/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ def compute_n1(
624624
src_dtype = src_obj1.data.dtype
625625
dst_dtype = complex if is_complex_dtype(src_dtype) else float
626626
dst_obj = src_obj1.copy(dtype=dst_dtype)
627+
dst_obj.delete_results() # Remove any previous results
627628
src_objs_pair = [src_obj1]
628629
for src_gid in src_gids[1:]:
629630
src_obj = src_objs[src_gid][i_pair]
@@ -672,6 +673,7 @@ def compute_n1(
672673
src_dtypes[src_gid] = src_dtype = src_obj.data.dtype
673674
dst_dtype = complex if is_complex_dtype(src_dtype) else float
674675
dst_objs[src_gid] = dst_obj = src_obj.copy(dtype=dst_dtype)
676+
dst_obj.delete_results() # Remove any previous results
675677
dst_obj.roi = None
676678
src_objs[src_gid] = [src_obj]
677679
else:

scripts/gettext_scan.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ call %FUNC% GetVersion CDL_VERSION
99

1010
set BUILDDIR=%SCRIPTPATH%\..\build\gettext
1111
cd %SCRIPTPATH%\..\doc
12-
sphinx-build . %BUILDDIR% -b gettext
13-
sphinx-intl update -p %BUILDDIR% -l fr --no-obsolete -w 0
12+
@REM sphinx-build . %BUILDDIR% -b gettext
13+
@REM sphinx-intl update -p %BUILDDIR% -l fr --no-obsolete -w 0
1414
call %~dp0gettext rescan

0 commit comments

Comments
 (0)