diff --git a/daq/src/aaredaq/daq.py b/daq/src/aaredaq/daq.py index 161396a2..5308e6cb 100644 --- a/daq/src/aaredaq/daq.py +++ b/daq/src/aaredaq/daq.py @@ -242,7 +242,8 @@ class AareDAQ: self.__aare.sample_mounted(target) self.__cfg.current_sample = target - self.save_screenshot_db(target.db_id, f"sample_mounted") + if target is not None and target.db_id is not None: + self.save_screenshot_db(target.db_id, f"sample_mounted") @sample.setter def sample(self, target: SampleShortInfo | None): @@ -395,7 +396,8 @@ class AareDAQ: self.__jfjoch.measure_rotation(request, status) self.__aare.create_rotation_run(self.sample, request, status) - self.save_screenshot_db(self.sample.db_id, "before_dc") + if self.sample is not None and self.sample.db_id is not None: + self.save_screenshot_db(self.sample.db_id, "before_dc") if request.screening: self.__devs.aerotech.measure_screening(request.start_omega_deg, @@ -428,7 +430,10 @@ class AareDAQ: self.__devs.aerotech.reset() result = self.__jfjoch.wait_till_done(60) self.__aare.sample_collected(self.sample) - self.save_screenshot_db(self.sample.db_id, "after_dc") + + if self.sample is not None and self.sample.db_id is not None: + self.save_screenshot_db(self.sample.db_id, "after_dc") + return CompletedRotationScan(request=copy.deepcopy(request), result=result) def measure_rotation(self, request: RotationScanRequest) -> CompletedRotationScan: @@ -735,8 +740,9 @@ class AareDAQ: self.__mount(sample) self.__set_state(BeamlineStateEnum.SampleAlignment) - print(f"Saving screenshot {sample.db_id} mount.jpeg") - self.save_screenshot_db(sample.db_id, "mount.jpeg") + if sample is not None and sample.db_id is not None: + print(f"Saving screenshot {sample.db_id} mount.jpeg") + self.save_screenshot_db(sample.db_id, "mount.jpeg") self.__set_state(BeamlineStateEnum.DataCollection) @@ -774,8 +780,9 @@ class AareDAQ: # RotationScanRequest(total_omega_deg=360, # start_omega_deg=0, # total_time_sec=18)) - print(f"Saving screenshot {sample.db_id} after_dc.jpeg") - self.save_screenshot_db(sample.db_id, "after_dc.jpeg") + if sample is not None and sample.db_id is not None: + print(f"Saving screenshot {sample.db_id} after_dc.jpeg") + self.save_screenshot_db(sample.db_id, "after_dc.jpeg") self.__set_state(BeamlineStateEnum.RobotSampleExchange) self.__cfg.state_busy = False