Skip to content

Commit 07d0590

Browse files
committed
Fix "Merge branch 'main' into develop" (commit 9d306a4)
1 parent 15d8688 commit 07d0590

File tree

13 files changed

+71
-75
lines changed

13 files changed

+71
-75
lines changed

cdl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import os
1515

16-
__version__ = "0.20.1"
16+
__version__ = "0.21.0"
1717
__docurl__ = __homeurl__ = "https://datalab-platform.com/"
1818
__supporturl__ = "https://github.com/DataLab-Platform/DataLab/issues/new/choose"
1919

cdl/computation/image/detection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class ContourShapeParam(GenericDetectionParam):
8080
)
8181

8282
# The following item is used to store the 'shape type' and is implicitly accessed by
83-
# the `cdl.core.gui.processor.base.BaseProcessor.compute_10` method. The keys of the
84-
# item choices (i.e. the first element of each tuple of `shapes`) must match the
83+
# the `cdl.core.gui.processor.base.BaseProcessor.compute_1_to_0` method. The keys of
84+
# the item choices (i.e. the first element of each tuple of `shapes`) must match the
8585
# names of the `cdl.core.model.base.ShapeTypes` (when uppercased).
8686
assert {shape[0].upper() for shape in shapes}.issubset(
8787
set(ShapeTypes.__members__.keys())

cdl/computation/signal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def __call__(self, src: SignalObj) -> SignalObj:
128128
return dst
129129

130130

131-
# MARK: compute_n_to_1 functions -------------------------------------------------------
131+
# MARK: n_to_1 functions -------------------------------------------------------
132132
# Functions with N input signals and 1 output signal
133133
# --------------------------------------------------------------------------------------
134134
# Those functions are perfoming a computation on N input signals and return a single
@@ -266,7 +266,7 @@ def division_constant(src: SignalObj, p: ConstantParam) -> SignalObj:
266266
return dst
267267

268268

269-
# MARK: compute_2_to_1 functions -------------------------------------------------------
269+
# MARK: 2_to_1 functions -------------------------------------------------------
270270
# Functions with N input images + 1 input image and N output images
271271
# --------------------------------------------------------------------------------------
272272

@@ -379,7 +379,7 @@ def division(src1: SignalObj, src2: SignalObj) -> SignalObj:
379379
return dst
380380

381381

382-
# MARK: compute_1_to_1 functions -------------------------------------------------------
382+
# MARK: 1_to_1 functions -------------------------------------------------------
383383
# Functions with 1 input image and 1 output image
384384
# --------------------------------------------------------------------------------------
385385

cdl/core/model/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def set_plot_item_editable(
230230

231231
class BaseResult(abc.ABC):
232232
"""Base class for results, i.e. objects returned by computation functions
233-
used by :py:class`cdl.core.gui.processor.base.BaseProcessor.compute_10` method.
233+
used by :py:class`cdl.core.gui.processor.base.BaseProcessor.compute_1_to_0` method.
234234
235235
Args:
236236
title: result title
@@ -595,7 +595,7 @@ def __get_coords_labels(self) -> tuple[str]:
595595
if self.shapetype is ShapeTypes.POLYGON:
596596
labels = []
597597
for i in range(0, self.array.shape[1] - 1, 2):
598-
labels += [f"x{i//2}", f"y{i//2}"]
598+
labels += [f"x{i // 2}", f"y{i // 2}"]
599599
return tuple(labels)
600600
try:
601601
return {

cdl/plugins/cdl_testdata.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ def add_noise_to_signal(
2525
src: dlo.SignalObj, p: test_data.GaussianNoiseParam
2626
) -> dlo.SignalObj:
2727
"""Add gaussian noise to signal"""
28-
dst = cpsig.dst_11(src, "add_gaussian_noise", f"mu={p.mu},sigma={p.sigma}")
28+
dst = cpsig.dst_1_to_1(src, "add_gaussian_noise", f"mu={p.mu},sigma={p.sigma}")
2929
test_data.add_gaussian_noise_to_signal(dst, p)
3030
return dst
3131

3232

3333
def add_noise_to_image(src: dlo.ImageObj, p: dlo.NormalRandomParam) -> dlo.ImageObj:
3434
"""Add gaussian noise to image"""
35-
dst = cpima.dst_11(src, "add_gaussian_noise", f"mu={p.mu},sigma={p.sigma}")
35+
dst = cpima.dst_1_to_1(src, "add_gaussian_noise", f"mu={p.mu},sigma={p.sigma}")
3636
test_data.add_gaussian_noise_to_image(dst, p)
3737
return dst
3838

@@ -49,7 +49,7 @@ class PluginTestData(PluginBase):
4949
# Signal processing features ------------------------------------------------
5050
def add_noise_to_signal(self) -> None:
5151
"""Add noise to signal"""
52-
self.signalpanel.processor.compute_11(
52+
self.signalpanel.processor.compute_1_to_1(
5353
add_noise_to_signal,
5454
paramclass=test_data.GaussianNoiseParam,
5555
title=_("Add noise"),
@@ -73,7 +73,7 @@ def create_noisy_signal(self) -> None:
7373
# Image processing features ------------------------------------------------
7474
def add_noise_to_image(self) -> None:
7575
"""Add noise to image"""
76-
self.imagepanel.processor.compute_11(
76+
self.imagepanel.processor.compute_1_to_1(
7777
add_noise_to_image,
7878
paramclass=dlo.NormalRandomParam,
7979
title=_("Add noise"),

cdl/tests/backbone/errorcatcher_unit_test.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,17 @@ def test_catcher():
5151
panel = win.signalpanel
5252
sig = test_data.create_paracetamol_signal()
5353
panel.add_object(sig)
54-
panel.processor.compute_11(comp_no_error, title="Test no error")
55-
panel.processor.compute_11(comp_error, title="Test error")
54+
panel.processor.compute_1_to_1(comp_no_error, title="Test no error")
55+
panel.processor.compute_1_to_1(comp_error, title="Test error")
5656
Conf.proc.ignore_warnings.set(True)
57-
panel.processor.compute_11(comp_warning, title="Test warning (ignored)")
57+
panel.processor.compute_1_to_1(comp_warning, title="Test warning (ignored)")
5858
Conf.proc.ignore_warnings.set(False)
59-
panel.processor.compute_11(comp_warning, title="Test warning (not ignored)")
60-
panel.processor.compute_11(comp_warning_error, title="Test warning + error")
59+
panel.processor.compute_1_to_1(
60+
comp_warning, title="Test warning (not ignored)"
61+
)
62+
panel.processor.compute_1_to_1(
63+
comp_warning_error, title="Test warning + error"
64+
)
6165

6266

6367
if __name__ == "__main__":

cdl/tests/features/common/operation_modes_app_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def check_titles(title, titles):
4141

4242
def test_single_operand_mode_compute_n1():
4343
"""Run single operand mode test scenario
44-
with compute_n1 operation (e.g. sum)"""
44+
with `compute_n_to_1` operation (e.g. sum)"""
4545
original_mode = Conf.proc.operation_mode.get()
4646
Conf.proc.operation_mode.set("single")
4747

@@ -109,7 +109,7 @@ def test_single_operand_mode_compute_n1():
109109

110110
def test_pairwise_operations_mode_compute_n1():
111111
"""Run pairwise operations mode test scenario
112-
with compute_n1 operation (e.g. sum)"""
112+
with `compute_n_to_1` operation (e.g. sum)"""
113113
original_mode = Conf.proc.operation_mode.get()
114114
Conf.proc.operation_mode.set("pairwise")
115115

@@ -188,7 +188,7 @@ def test_pairwise_operations_mode_compute_n1():
188188

189189
def test_single_operand_mode_compute_n1n():
190190
"""Run single operand mode test scenario
191-
with compute_n1n operation (e.g. difference)"""
191+
with `compute_2_to_1` operation (e.g. difference)"""
192192
original_mode = Conf.proc.operation_mode.get()
193193
Conf.proc.operation_mode.set("single")
194194

@@ -272,7 +272,7 @@ def test_single_operand_mode_compute_n1n():
272272

273273
def test_pairwise_operations_mode_compute_n1n():
274274
"""Run pairwise operations mode test scenario
275-
with compute_n1n operation (e.g. difference)"""
275+
with `compute_2_to_1` operation (e.g. difference)"""
276276
original_mode = Conf.proc.operation_mode.get()
277277
Conf.proc.operation_mode.set("pairwise")
278278

cdl/tests/features/utilities/installconf_unit_test.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,16 @@
66

77
# guitest: show
88

9-
from __future__ import annotations
10-
119
from guidata.qthelpers import qt_app_context
1210

13-
import cdl.utils.qthelpers as qth
14-
from cdl.widgets import instconfviewer
11+
from cdl.widgets.instconfviewer import exec_cdl_installconfig_dialog
1512

1613

17-
def test_dep_viewer(screenshots: bool = False) -> None:
14+
def test_dep_viewer():
1815
"""Test dep viewer window"""
1916
with qt_app_context():
20-
instconfviewer.exec_cdl_installconfig_dialog()
21-
if screenshots:
22-
dlg = instconfviewer.InstallConfigViewerWindow()
23-
dlg.show()
24-
qth.grab_save_window(dlg, dlg.objectName())
17+
exec_cdl_installconfig_dialog()
2518

2619

2720
if __name__ == "__main__":
28-
test_dep_viewer(screenshots=True)
21+
test_dep_viewer()

cdl/tests/scenarios/common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
from cdl.widgets import fitdialog
3232

3333

34-
def __compute_11_operations(panel: SignalPanel | ImagePanel, number: int) -> None:
35-
"""Test compute_11 type operations on a signal or image
34+
def __compute_1_to_1_operations(panel: SignalPanel | ImagePanel, number: int) -> None:
35+
"""Test `compute_1_to_1` type operations on a signal or image
3636
3737
Requires that one signal or image has been added at index."""
3838
assert len(panel) >= number - 1
@@ -122,7 +122,7 @@ def compute_common_operations(panel: SignalPanel | ImagePanel) -> None:
122122

123123
panel.add_label_with_title()
124124

125-
__compute_11_operations(panel, 2)
125+
__compute_1_to_1_operations(panel, 2)
126126

127127

128128
def run_signal_computations(

doc/intro/tutorials/custom_func.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ operating on DataLab's native image objects (:class:`cdl.obj.ImageObj`), instead
297297
operating on NumPy arrays. So we need to find a way to call our custom function
298298
``weighted_average_denoise`` with a :class:`cdl.obj.ImageObj` as input and output.
299299
To avoid writing a lot of boilerplate code, we can use the function wrapper provided
300-
by DataLab: :class:`cdl.computation.image.Wrap11Func`.
300+
by DataLab: :class:`cdl.computation.image.Wrap1to1Func`.
301301

302302
Besides we need to define a class that describes our plugin, which must inherit
303303
from :class:`cdl.plugins.PluginBase` and name the Python script that contains the

0 commit comments

Comments
 (0)