From cc9e0ec08f71ca39099842794690709772fb7269 Mon Sep 17 00:00:00 2001 From: Kevin Dean <42547789+AdvancedImagingUTSW@users.noreply.github.com> Date: Sat, 11 May 2024 12:09:41 -0500 Subject: [PATCH 1/2] Update model.py Check to see if model has attribute signal_container before trying to reset it. Otherwise, reset the feature list... Slight refactor to hopefully make the logic more obvious. Please doublecheck. --- src/navigate/model/model.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/navigate/model/model.py b/src/navigate/model/model.py index 7beef75cc..d2159174a 100644 --- a/src/navigate/model/model.py +++ b/src/navigate/model/model.py @@ -503,7 +503,7 @@ def run_command(self, command, *args, **kwargs): return if command == "acquire": - """ Begin an acquisition.""" + """Begin an acquisition.""" self.is_acquiring = True self.imaging_mode = self.configuration["experiment"]["MicroscopeState"][ "image_mode" @@ -751,7 +751,8 @@ def run_command(self, command, *args, **kwargs): # elif command == "change_camera": # new_camera = list(self.active_microscope.cameras.values())[args[0]] - # print(f"Using new camera >> {new_camera.camera_controller._serial_number}") + # print(f"Using new camera >> { + # new_camera.camera_controller._serial_number}") # self.active_microscope.camera = new_camera elif command == "exit": @@ -1065,7 +1066,7 @@ def snap_image(self): self.event_queue.put( ( "warning", - "There is an error happened. Please read the log files for details!", + "An error happened. Please read the log files for details!", ) ) return @@ -1089,12 +1090,15 @@ def run_live_acquisition(self): acquisition parameters in real-time. """ self.stop_acquisition = False - while self.stop_acquisition is False and self.stop_send_signal is False: + while not self.stop_acquisition and not self.stop_send_signal: self.run_acquisition() - if not self.injected_flag.value: + if self.injected_flag.value: + self.reset_feature_list() + elif hasattr(self, "signal_container"): self.signal_container.reset() else: self.reset_feature_list() + # Update the stage position. # Allows the user to externally move the stage in the continuous mode. self.get_stage_position() @@ -1152,7 +1156,6 @@ def reset_feature_list(self): ) injected_flag.value = False - def change_resolution(self, resolution_value): """Switch resolution mode of the microscope. From a999dcbd6725b096bb4bfcb116be434c287aad89 Mon Sep 17 00:00:00 2001 From: Annie Wang Date: Fri, 17 May 2024 10:27:43 -0700 Subject: [PATCH 2/2] reset feature list if injected feature list is finished --- src/navigate/model/model.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/navigate/model/model.py b/src/navigate/model/model.py index d2159174a..9f9993651 100644 --- a/src/navigate/model/model.py +++ b/src/navigate/model/model.py @@ -1096,8 +1096,6 @@ def run_live_acquisition(self): self.reset_feature_list() elif hasattr(self, "signal_container"): self.signal_container.reset() - else: - self.reset_feature_list() # Update the stage position. # Allows the user to externally move the stage in the continuous mode.