Skip to content

Commit 9c0ed54

Browse files
committed
Merge branch 'develop'
2 parents 9e0a0ac + 7111d34 commit 9c0ed54

File tree

132 files changed

+8093
-24120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+8093
-24120
lines changed

CHANGELOG.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,43 @@
22

33
See DataLab [roadmap page](https://datalab-platform.com/en/contributing/roadmap.html) for future and past milestones.
44

5-
## DataLab Version 0.18.3 ##
5+
## DataLab Version 0.19.0 ##
6+
7+
💥 New features and enhancements:
8+
9+
* New "Open from directory" feature:
10+
* This feature allows to open multiple files from a directory at once, recursively (only the files with the supported extensions by the current panel are opened)
11+
* Add "Open from directory" action to the "File" menu for both Signal and Image panels
12+
* Add support for folders when dropping files in the Signal and Image panels
13+
* Add `1/x` operation to the "Operations" menu for both Signal and Image panels:
14+
* This feature relies on the `numpy.reciprocal` function, and handles the case where the denominator is zero by catching warnings and replacing the `np.inf` values with `np.nan` values
15+
* Add `compute_inverse` method for image and signal processors
16+
* This closes [Issue #143] - New feature: `1/x` for signals and images
17+
* Public API (local or remote):
18+
* Add `add_group` method with `title` and `select` arguments to create a new group in a data panel (e.g. Signal or Image panel) and eventually select it after creation:
19+
* Method was added to the following classes: `AbstractCDLControl`, `BaseDataPanel` and `RemoteClient`
20+
* This closes the following issues:
21+
* [Issue #131](https://github.com/DataLab-Platform/DataLab/issues/131) - `BaseDataPanel.add_group`: add `select` argument
22+
* [Issue #47](https://github.com/DataLab-Platform/DataLab/issues/47) - Remote proxy / Public API: add `add_group` method
23+
* `AbstractCDLControl.get_object_uuids`: add an optional `group` argument (group ID, title or number) to eventually filter the objects by group (this closes [Issue #130](https://github.com/DataLab-Platform/DataLab/issues/130))
24+
* When opening an HDF5 file, the confirmation dialog box asking if current workspace should be cleared has a new possible answer "Ignore":
25+
* Choosing "Ignore" will prevent the confirmation dialog box from being displayed again, and will choose the current setting (i.e. clear or not the workspace) for all subsequent file openings
26+
* Added a new "Clear workspace before loading HDF5 file" option in the "Settings" dialog box, to allow the user to change the current setting (i.e. clear or not the workspace) for all subsequent file openings
27+
* Added a new "Ask before clearing workspace" option in the "Settings" dialog box, to allow the user to disable or re-enable the confirmation dialog box asking if current workspace should be cleared when opening an HDF5 file
28+
* This closes [Issue #146](https://github.com/DataLab-Platform/DataLab/issues/146) - Ask before clearing workspace when opening HDF5 file: add "Ignore" option to prevent dialog from being displayed again
29+
* Object and group title renaming:
30+
* Removed "Rename group" feature from the "Edit" menu and context menu
31+
* Added "Rename object" feature to the "Edit" menu and context menu, with F2 shortcut, to rename the title of the selected object or group
32+
* This closes [Issue #148](https://github.com/DataLab-Platform/DataLab/issues/148) - Rename signal/image/group title by pressing F2
33+
* Region of Interest editor:
34+
* Regrouped the graphical actions (new rectangular ROI, new circular ROI, new polygonal ROI) in a single menu "Graphical ROI"
35+
* Added new "Coordinate-based ROI" menu to create a ROI using manual input of the coordinates:
36+
* For signals, the ROI is defined by the start and end coordinates
37+
* For images:
38+
* The rectangular ROI is defined by the top-left and bottom-right coordinates
39+
* The circular ROI is defined by the center and radius coordinates
40+
* The polygonal ROI is not supported yet
41+
* This closes [Issue #145](https://github.com/DataLab-Platform/DataLab/issues/145) - ROI editor: add manual input of the coordinates
642

743
🛠️ Bug fixes:
844

@@ -249,7 +285,7 @@ This release requires PlotPy v2.4.0 or later, which brings the following bug fix
249285

250286
* Progress bar is now automatically closed as expected when an error occurrs during a long operation (e.g. when opening a file)
251287

252-
* Difference, division, ...: dialog box for the second operand selection was allowing to select a group (only a signal or an image should be selected)
288+
* Difference, division...: dialog box for the second operand selection was allowing to select a group (only a signal or an image should be selected)
253289

254290
* When doing an operation which involves an object (signal or image) with higher order number than the current object (e.g. when subtracting an image with an image from a group below the current image), the resulting object's title now correctly refers to the order numbers of the objects involved in the operation (e.g., to continue with the subtraction example mentioned above, the resulting object's title was previously referring to the order number before the insertion of the resulting image)
255291

@@ -303,7 +339,7 @@ NumPy 2.0 support has been added with this release.
303339
* The menu bar and toolbars have been reorganized to make the application more intuitive and easier to use
304340
* Operations and processing features have been regrouped in submenus
305341
* All visualization-related actions are now grouped in the plot view vertical toolbar
306-
* Clarified the "Annotations" management (new buttons, toolbar action, ...)
342+
* Clarified the "Annotations" management (new buttons, toolbar action...)
307343

308344
* New validation process for signal and image features:
309345
* Before this release, DataLab's validation process was exclusively done from the programmer's point of view, by writing unit tests and integration tests, thus ensuring that the code was working as expected (i.e. that no exception was raised and that the behavior was correct)
@@ -338,7 +374,7 @@ NumPy 2.0 support has been added with this release.
338374
| Processing | Level Adjustment | Offset correction |
339375
| Processing | Fourier analysis | Power spectrum, Phase spectrum, Magnitude spectrum, Power spectral density |
340376
| Processing | Frequency filters | Low-pass, High-pass, Band-pass, Band-stop |
341-
| Processing | | Windowing (Hanning, Hamming, Blackman, Blackman-Harris, Nuttall, Flat-top, ...) |
377+
| Processing | | Windowing (Hanning, Hamming, Blackman, Blackman-Harris, Nuttall, Flat-top...) |
342378
| Processing | Fit | Linear fit, Sinusoidal fit, Exponential fit, CDF fit |
343379
| Analysis | | FWHM (Zero-crossing method), X value @ min/max, Sampling period/frequency, Dynamic parameters (ENOB, SNR, SINAD, THD, SFDR), -3dB bandwidth, Contrast |
344380

@@ -591,7 +627,7 @@ NumPy 2.0 support has been added with this release.
591627
* This fixes [Issue #32](https://github.com/DataLab-Platform/DataLab/issues/32) - Contour detection: show circle `(x, y, r)` and ellipse `(x, y, a, b, theta)` instead of `(x0, y0, x1, x1, ...)`
592628
* 1D and 2D analysis results:
593629
* Additionnaly to the previous enhancement, more analysis results are now shown in the "Results" dialog box
594-
* This concerns both 1D (FHWM, ...) and 2D analysis results (contours, blobs, ...):
630+
* This concerns both 1D (FHWM...) and 2D analysis results (contours, blobs...):
595631
* Segment results now also show length (L) and center coordinates (Xc, Yc)
596632
* Circle and ellipse results now also show area (A)
597633
* Added "Plot results" entry in "Analysis" menu:
@@ -821,7 +857,7 @@ New features:
821857
* Signal processing:
822858
* Added support for optional FFT shift (see Settings dialog box)
823859
* Image processing:
824-
* Added pixel binning operation (X/Y binning factors, operation: sum, mean, ...)
860+
* Added pixel binning operation (X/Y binning factors, operation: sum, mean...)
825861
* Added "Distribute on a grid" and "Reset image positions" in operation menu
826862
* Added Butterworth filter
827863
* Added exposure processing features:

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.18.3"
16+
__version__ = "0.19.0"
1717
__docurl__ = __homeurl__ = "https://datalab-platform.com/"
1818
__supporturl__ = "https://github.com/DataLab-Platform/DataLab/issues/new/choose"
1919

cdl/algorithms/coordinates.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
from __future__ import annotations
1010

11+
import warnings
12+
from typing import Literal
13+
1114
import numpy as np
1215

1316

@@ -178,3 +181,57 @@ def array_ellipse_to_center_axes_angle(data: np.ndarray) -> np.ndarray:
178181
theta = np.arctan2(y1 - y0, x1 - x0)
179182
result = np.column_stack((xc, yc, a, b, theta)).astype(float)
180183
return result
184+
185+
186+
def cartesian2polar(
187+
x: np.ndarray, y: np.ndarray, unit: Literal["rad", "deg"] = "rad"
188+
) -> tuple[np.ndarray, np.ndarray]:
189+
"""Convert Cartesian coordinates to polar coordinates.
190+
191+
Args:
192+
x: Cartesian x-coordinate.
193+
y: Cartesian y-coordinate.
194+
unit: Unit of the angle ('rad' or 'deg').
195+
196+
Returns:
197+
Polar coordinates (r, theta) where r is the radius and theta is the angle.
198+
"""
199+
assert x.shape == y.shape, "x and y must have the same shape"
200+
assert unit in ["rad", "deg"], "unit must be 'rad' or 'deg'"
201+
r = np.sqrt(x**2 + y**2)
202+
theta = np.arctan2(y, x)
203+
if unit == "deg":
204+
theta = np.rad2deg(theta)
205+
return r, theta
206+
207+
208+
def polar2cartesian(
209+
r: np.ndarray, theta: np.ndarray, unit: Literal["rad", "deg"] = "rad"
210+
) -> tuple[np.ndarray, np.ndarray]:
211+
"""Convert polar coordinates to Cartesian coordinates.
212+
213+
Args:
214+
r: Polar radius.
215+
theta: Polar angle.
216+
unit: Unit of the angle ('rad' or 'deg').
217+
218+
Returns:
219+
Cartesian coordinates (x, y) where x is the x-coordinate and y is the
220+
y-coordinate.
221+
222+
.. note::
223+
224+
Negative radius values are not supported. They will be set to 0.
225+
"""
226+
assert r.shape == theta.shape, "r and theta must have the same shape"
227+
assert unit in ["rad", "deg"], "unit must be 'rad' or 'deg'"
228+
if np.any(r < 0):
229+
warnings.warn(
230+
"Negative radius values are not supported. They will be set to 0."
231+
)
232+
r = np.maximum(r, 0)
233+
if unit == "deg":
234+
theta = np.deg2rad(theta)
235+
x = r * np.cos(theta)
236+
y = r * np.sin(theta)
237+
return x, y

0 commit comments

Comments
 (0)