Skip to content
Snippets Groups Projects
Commit e183381e authored by Albert Mitjans I Coma's avatar Albert Mitjans I Coma
Browse files

save values in shared memory

parent 0a695b2a
No related branches found
No related tags found
No related merge requests found
...@@ -21,8 +21,8 @@ def main(): ...@@ -21,8 +21,8 @@ def main():
pos, _ = ion_positions(image) pos, _ = ion_positions(image)
user_2 = input("Use (detected) dark ions for calibration? (y, [n]) ") user_2 = input("Use (detected) dark ions for calibration? (y, [n]) ")
if user_2 in ("y", "yes"): if user_2 in ("y", "yes"):
read_factor(conn) dist_factor = read_factor(conn)
pos = dark_ions(image, pos) pos = dark_ions(image, pos, dist_factor)
pos = pos[:, 1] pos = pos[:, 1]
if len(pos) > 1: if len(pos) > 1:
......
...@@ -132,7 +132,7 @@ class Main: ...@@ -132,7 +132,7 @@ class Main:
self.roundness = -1 self.roundness = -1
if not ion_cloud: if not ion_cloud:
self._processing(self.image, dist_factor) self._processing(self.image.copy(), dist_factor)
# Update running time # Update running time
self.running_time = time.time() - self.init_time self.running_time = time.time() - self.init_time
...@@ -140,9 +140,10 @@ class Main: ...@@ -140,9 +140,10 @@ class Main:
self.init_time = time.time() self.init_time = time.time()
# Save variables in self.memory # Save variables in self.memory
self._save_in_memory()
self.num += 1 self.num += 1
self.sem.release() self.sem.release()
time.sleep(0.1)
def _processing(self, image, dist_factor): def _processing(self, image, dist_factor):
self.coord, self.max_spot_size = ion_positions(image) self.coord, self.max_spot_size = ion_positions(image)
......
...@@ -403,8 +403,9 @@ def dark_ions(image, coord, dist_factor): ...@@ -403,8 +403,9 @@ def dark_ions(image, coord, dist_factor):
coord = coord[coord[:, 1] < image.shape[1]] # remove points outside the image coord = coord[coord[:, 1] < image.shape[1]] # remove points outside the image
if loss.min() > 20: if loss.min() > 20:
warnings.warn("Loss is too high... " # warnings.warn("Loss is too high... "
"Try calculating a new factor value using calibrate() function.") # "Try calculating a new factor value using calibrate() function.")
pass
return coord return coord
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment