From 5aa95e6f52bf7d34ddc5414e67d36e51560eaea8 Mon Sep 17 00:00:00 2001 From: amitjans <amitjans@ethz.ch> Date: Sun, 4 Jul 2021 14:17:07 +0200 Subject: [PATCH] Set values to 0 when no ions --- tools.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools.py b/tools.py index 982870a..9869742 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] -- GitLab