diff --git a/tools.py b/tools.py index 982870a538729930c0eefd881de7126d1a47fa2f..98697421570e8540b511534e7c5a2fbb68d0d897 100644 --- a/tools.py +++ b/tools.py @@ -116,14 +116,16 @@ class Main: if len(coord) > 0: roundness = ion_roundness(img, coord[0][:2]) img = compensate_gradient(img, coord) + max_int, num_pix = max_ion_intensity(img, coord) + coord = detect_dim_ions(img, coord, max_int) + linearity = ion_linearity(coord) + + if len(coord) > 1 and dist_factor is not None: + coord = dark_ions(img, coord, dist_factor) else: roundness = 0 - max_int, num_pix = max_ion_intensity(img, coord) - coord = detect_dim_ions(img, coord, max_int) - linearity = ion_linearity(coord) - - if len(coord) > 1 and dist_factor is not None: - coord = dark_ions(img, coord, dist_factor) + max_int, num_pix = (0, 0) + linearity = "No ions" old_coord = self.memory.get_value() self.memory.save_value(coord) @@ -467,8 +469,6 @@ def ion_linearity(points): """ # We use only bright ions points = points[points[:, 2] == 0] - if len(points) == 0: - return 'No ions' y = points[:, 0] x = points[:, 1]