DAQ: sample setter now clears manual sample. removed sample_clear. Manual sample must still be unmounted by hand.

This commit is contained in:
2025-07-04 11:59:36 +02:00
parent 4324a814de
commit 6bc3ed2eae
6 changed files with 28 additions and 28 deletions
+1 -1
View File
@@ -73,7 +73,7 @@ class AareWrapper:
manual_sample = ManualSampleCreate(
pgroup=s.user,
sample_name=s.sample_name,
data_collection_parameters=s.data_collection_parameters
data_collection_parameters=s.aaredb_params
)
try:
+25 -15
View File
@@ -116,6 +116,8 @@ class AareDAQ:
@property
def sample(self) -> SampleShortInfo | None:
if self.__cfg.current_sample is not None and self.__cfg.current_sample.location is None:
return self.__cfg.current_sample
if self.__devs.tell.get_mounted_sample() is None:
return None
return self.__cfg.current_sample
@@ -181,19 +183,22 @@ class AareDAQ:
raise
def create_sample(self, target: SampleShortInfo):
curr_sample = self.__cfg.current_sample
if curr_sample is not None and curr_sample.location is not None:
raise Exception("Sample from TELL is loaded")
self.__cfg.try_set_busy(timeout=360)
self.__aare.create_manual_sample(target)
self.__cfg.current_sample = target
try:
curr_sample = self.__cfg.current_sample
if curr_sample is not None and curr_sample.location is not None:
raise Exception("Sample from TELL is loaded")
self.__aare.create_manual_sample(target)
self.__cfg.current_sample = target
self.__cfg.state_busy = False
except:
self.__cfg.state_busy = False
raise
def clear_current_sample(self):
curr_sample = self.__cfg.current_sample
if curr_sample is not None:
self.__aare.sample_unmounted(curr_sample)
self.__cfg.current_sample = None
def __mount(self, target: SampleShortInfo | None):
self.__set_state(BeamlineStateEnum.RobotSampleExchange)
@@ -241,12 +246,20 @@ class AareDAQ:
def sample(self, target: SampleShortInfo | None):
# This will set internally state to SampleExchange, but will return to SampleAlignment
# before exiting
start = time.perf_counter()
self.__cfg.try_set_busy(timeout=360)
try:
self.__mount(target)
curr_sample = self.__cfg.current_sample
curr_sample_is_manual = False
if curr_sample is not None and curr_sample.location is None:
self.__cfg.current_sample = None
curr_sample_is_manual = True
if target is not None or not curr_sample_is_manual:
self.__mount(target)
self.__cfg.state_busy = False
except Exception as e:
self.__cfg.state_busy = False
@@ -257,9 +270,6 @@ class AareDAQ:
self.__set_state(BeamlineStateEnum.SampleAlignment)
end = time.perf_counter()
self.last_time = end - start
@property
def camera_image(self) -> np.ndarray | None:
image = self.__devs.sample_cam.get_image(gray=False)
-5
View File
@@ -217,11 +217,6 @@ async def unmount(token: str = Depends(oauth2_scheme)):
daq.sample = None
return "OK"
@app.post("/sample/clear")
async def sample_clear(token: str = Depends(oauth2_scheme)):
auth.check_jwt_rw(cfg, auth.parse_token(token))
daq.clear_current_sample()
return "OK"
@app.post("/sample/manual")
async def manual(s: SampleShortInfo, token: str = Depends(oauth2_scheme)):