From 42a0c4f56675dd5c93aa89158c0f1df25315d80e Mon Sep 17 00:00:00 2001
From: amitjans <amitjans@ethz.ch>
Date: Mon, 5 Jul 2021 17:16:14 +0200
Subject: [PATCH] Small fix + increase ion detection threshold from 0.85 to 1

---
 tools.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools.py b/tools.py
index 164f0b0..30f1143 100644
--- a/tools.py
+++ b/tools.py
@@ -353,8 +353,11 @@ class TrapState:
         _thread.daemon = True
         _thread.start()
         if self.trap_state == 'Empty':
-            _laser_switch(False)
-            _laser_switch(True)
+            try:
+                _laser_switch(False)
+                _laser_switch(True)
+            except requests.exceptions.ConnectionError:
+                pass
 
     def update_coord(self, coord):
         """
@@ -791,7 +794,7 @@ def _max_coord(image, width=False):
     image = image[region[0, 1]:region[1, 1], region[0, 0]:region[1, 0]]
 
     filt_image = _difference_of_gaussians(image, low_sigma=settings.BLOB_SIZE, preserve_range=True)
-    coordinates = peak_local_max(filt_image, threshold_abs=0.85, min_distance=settings.ION_DIST)
+    coordinates = peak_local_max(filt_image, threshold_abs=1, min_distance=settings.ION_DIST)
 
     if width:
         try:
-- 
GitLab