Skip to content

Commit

Permalink
A bunch of logging to track down acquisition abort bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ianohara committed Jan 20, 2025
1 parent 2a5b573 commit 14c7d42
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion software/control/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,7 @@ def run(self):
# wait until it's time to do the next acquisition
while time.time() < self.timestamp_acquisition_started + self.time_point * self.dt:
if self.multiPointController.abort_acqusition_requested:
self._log.debug("In run wait loop, abort_acquisition_requested=True")
break
time.sleep(0.05)

Expand Down Expand Up @@ -2181,7 +2182,7 @@ def __init__(
parent=None,
):
QObject.__init__(self)

self._log = squid.logging.get_logger(self.__class__.__name__)
self.camera = camera
if DO_FLUORESCENCE_RTP:
self.processingHandler = ProcessingHandler()
Expand Down Expand Up @@ -2535,6 +2536,7 @@ def run_acquisition(self):
self.thread.start()

def _on_acquisition_completed(self):
self._log.debug("MultiPointController._on_acquisition_completed called")
# restore the previous selected mode
if self.gen_focus_map:
self.autofocusController.clear_focus_map()
Expand Down
1 change: 1 addition & 0 deletions software/control/gui_hcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,7 @@ def toggleWellSelector(self, show):
self.wellSelectionWidget.setVisible(show)

def toggleAcquisitionStart(self, acquisition_started):
self.log.debug(f"toggleAcquisitionStarted({acquisition_started=})")
if acquisition_started:
self.log.info("STARTING ACQUISITION")
if self.is_live_scan_grid_on: # disconnect live scan grid during acquisition
Expand Down
16 changes: 11 additions & 5 deletions software/control/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1875,6 +1875,7 @@ def __init__(
):
super().__init__(*args, **kwargs)
self._log = squid.logging.get_logger(self.__class__.__name__)
self.acquisition_start_time = None
self.last_used_locations = None
self.last_used_location_ids = None
self.stage = stage
Expand Down Expand Up @@ -2426,7 +2427,7 @@ def update_region_progress(self, current_fov, num_fovs):
self.eta_timer.start(1000) # Update every 1000 ms (1 second)

def update_acquisition_progress(self, current_region, num_regions, current_time_point):
self.debug(f"updating acquisition progress for {current_region=}, {num_regions=}, {current_time_point=}...")
self._log.debug(f"updating acquisition progress for {current_region=}, {num_regions=}, {current_time_point=}...")
self.current_region = current_region
self.current_time_point = current_time_point

Expand Down Expand Up @@ -2526,6 +2527,7 @@ def display_stitcher_widget(self, checked):
self.signal_stitcher_widget.emit(checked)

def toggle_acquisition(self, pressed):
self._log.debug(f"FlexibleMultiPointWidget.toggle_acquisition, {pressed=}")
if self.base_path_is_set == False:
self.btn_startAcquisition.setChecked(False)
msg = QMessageBox()
Expand Down Expand Up @@ -2587,9 +2589,8 @@ def toggle_acquisition(self, pressed):
# Start coordinate-based acquisition
self.multipointController.run_acquisition()
else:
# This must eventually propagate through and call out acquisition_finished.
self.multipointController.request_abort_aquisition()
self.is_current_acquisition_widget = False
self.setEnabled_all(True)

def load_last_used_locations(self):
if self.last_used_locations is None or len(self.last_used_locations) == 0:
Expand Down Expand Up @@ -2986,6 +2987,8 @@ def import_location_list(self):
self._log.debug(self.location_list)

def acquisition_is_finished(self):
self._log.debug(f"In FlexibleMultiPointWidget, got acquisition_is_finished with {self.is_current_acquisition_widget=}")

if not self.is_current_acquisition_widget:
return # Skip if this wasn't the widget that started acquisition

Expand Down Expand Up @@ -3057,6 +3060,7 @@ def __init__(
**kwargs,
):
super().__init__(*args, **kwargs)
self._log = squid.logging.get_logger(self.__class__.__name__)
self.stage = stage
self.navigationViewer = navigationViewer
self.multipointController = multipointController
Expand Down Expand Up @@ -3667,6 +3671,7 @@ def update_live_coordinates(self, pos: squid.abc.Pos):
self._last_y_mm = y_mm

def toggle_acquisition(self, pressed):
self._log.debug(f"WellplateMultiPointWidget.toggle_acquisition, {pressed=}")
if not self.base_path_is_set:
self.btn_startAcquisition.setChecked(False)
QMessageBox.warning(self, "Warning", "Please choose base saving directory first")
Expand Down Expand Up @@ -3746,11 +3751,12 @@ def toggle_acquisition(self, pressed):
self.multipointController.run_acquisition()

else:
# This must eventually propagate through and call our aquisition_is_finished, or else we'll be left
# in an odd state.
self.multipointController.request_abort_aquisition()
self.is_current_acquisition_widget = False
self.setEnabled_all(True)

def acquisition_is_finished(self):
self._log.debug(f"In WellMultiPointWidget, got acquisition_is_finished with {self.is_current_acquisition_widget=}")
if not self.is_current_acquisition_widget:
return # Skip if this wasn't the widget that started acquisition

Expand Down

0 comments on commit 14c7d42

Please sign in to comment.