magali.detect_anomalies

Contents

magali.detect_anomalies#

magali.detect_anomalies(data, size_range, size_multiplier=2, num_scales=10, detection_threshold=0.5, overlap_ratio=0.5, border_exclusion=0)[source]#

Detect anomalies using blob detection.

Parameters:
dataxr.DataArray

Input data array with coordinates “x” and “y”.

size_rangetuple

Minimum and maximum size of detected anomalies in µm.

size_multiplierint, optional

Scaling factor for the detected blob sizes (default is 2).

num_scalesint, optional

Number of sigma values for the blob detection (default is 10). A sigma value represents the scale or size of the blobs that the algorithm will detect. Smaller sigma values correspond to smaller blobs, while larger sigma values correspond to larger blobs.

detection_thresholdfloat, optional

Detection threshold for the blob detection (default is 0.5). This parameter determines the sensitivity of the detection. A higher value means fewer blobs will be detected, and a lower value means more blobs will be detected.

overlap_ratiofloat, optional

Overlap fraction for merging blobs (default is 0.5).

border_exclusionint, optional

Border exclusion size in data units (default is 0). This parameter excludes blobs close to the border of the data array.

Returns:
bounding_boxeslist of lists

Bounding boxes of detected anomalies in data coordinates. Each bounding box corresponds to a detected blob, defined by the coordinates and size of the blob.