Skip to content

Commit

Permalink
MicroMAX collect: simplify calls to close cover
Browse files Browse the repository at this point in the history
In MICROMAXCollect.data_collection_hook(), call close_detector_cover()
from one place. Put the call into 'final' block, so that we don't need
to duplicate the call in 3 different places.
  • Loading branch information
elmjag committed Oct 30, 2024
1 parent faa0d37 commit 78b3719
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions mxcubecore/HardwareObjects/MAXIV/MicroMAX/MICROMAXCollect.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ def do_collect(self, owner):
self.user_log.error("[COLLECT] Data collection failed: %s" % ex)
self.emit_collection_failed()
self.close_fast_shutter()
self.close_detector_cover()

def prepare_acquisition(self):
"""
Expand Down Expand Up @@ -494,18 +493,17 @@ def data_collection_hook(self):
except Exception as ex:
self.log.error("[COLLECT] Detector error stopping acquisition: %s" % ex)

self.close_detector_cover()
self.emit("collectImageTaken", oscillation_parameters["number_of_images"])
except RuntimeError as ex:
self.data_collection_cleanup()
self.log.error("[COLLECT] Runtime Error: %s" % ex)
self.close_detector_cover()
raise Exception("data collection hook failed... ", str(ex))
except Exception:
self.log.exception("Unexpected error")
self.data_collection_cleanup()
self.close_detector_cover()
raise Exception("data collection hook failed... ", sys.exc_info()[0])
finally:
self.close_detector_cover()

def get_mesh_num_lines(self):
return self.mesh_num_lines
Expand Down

0 comments on commit 78b3719

Please sign in to comment.