diff --git a/daq/src/aaredaq/daq.py b/daq/src/aaredaq/daq.py index 4b0a4d42..bf083128 100644 --- a/daq/src/aaredaq/daq.py +++ b/daq/src/aaredaq/daq.py @@ -307,14 +307,29 @@ class AareDAQ: if target is not None or not curr_sample_is_manual: self.__mount(target) - + if target is not None and target.db_id is not None: + #self.__aare.sample_mounted(self.__cfg.current_sample) + self.save_screenshot_db(target.db_id , f"post_mount_{target.db_id }_{self.__devs.zoom}") self.__cfg.state_busy = False except Exception as e: self.__cfg.state_busy = False # If unmount succeeded, but mount failed - if self.__devs.tell.get_mounted_sample() is None: + mounted_sample = self.__devs.tell.get_mounted_sample() + if target is not None: + print(f"TELL: Error mounting, TELL believes current sample is {mounted_sample}, while expected {target.location}") + if mounted_sample is None: + print("TELL: After mounting there is no sample on gonio according to TELL") self.__cfg.current_sample = None - raise e + if target is not None: + raise e + elif (target.location is not None + and mounted_sample.puck.pos == target.location.pos + and mounted_sample.puck.segment == target.location.segment + and mounted_sample.pin == target.pin): + print("TELL: Actually mounting was correct according to TELL, so setting current sample to target") + self.__cfg.current_sample = target + else: + raise e self.__set_state(BeamlineStateEnum.SampleAlignment) @@ -484,7 +499,7 @@ class AareDAQ: def __rotation(self, request: RotationScanRequest) -> CompletedRotationScan: if request.dtz is not None: self.__cfg.dtz = request.dtz - + self.save_screenshot_db(self.sample.db_id, f"pre_rotation{self.sample.db_id}_{self.__devs.zoom}") self.__set_state(BeamlineStateEnum.DataCollection) if request.transmission is not None: @@ -919,7 +934,7 @@ class AareDAQ: hex_string = secrets.token_hex(3) # 3 bytes = 6 hex characters print(hex_string.upper()) - self.__ml_bounding_box(sample.db_id, f"ml_{geom.omega_deg:.2f}deg") + # self.__ml_bounding_box(sample.db_id, f"ml_{geom.omega_deg:.2f}deg") if self.__auto_center(RasterGridRequest( exp_time_s=0.01, file_prefix=sample_prefix + f"_{hex_string}",