DAQ: sample setter now clears manual sample. removed sample_clear. Manual sample must still be unmounted by hand.
This commit is contained in:
@@ -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
@@ -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)
|
||||
|
||||
@@ -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)):
|
||||
|
||||
@@ -5,7 +5,7 @@ from enum import Enum
|
||||
from PySide6.QtCore import QObject, Signal, Slot, QPointF
|
||||
from PySide6.QtGui import QPainter, QPen, QColor, QBrush
|
||||
from PySide6.QtCore import Qt, QRect
|
||||
from typing import List, Optional, Tuple
|
||||
from typing import List, Tuple
|
||||
|
||||
from aaredaqlib.coordinate import Coordinate, SmargonCoordinate
|
||||
from aaredaqlib.models import DAQStatusModel
|
||||
|
||||
@@ -336,10 +336,6 @@ class DAQWorker(QObject):
|
||||
def sample_manual(self, s: SampleShortInfo):
|
||||
self.generic_post(f"sample/manual", s.model_dump_json())
|
||||
|
||||
@Slot()
|
||||
def sample_clear(self):
|
||||
self.generic_post("sample/clear")
|
||||
|
||||
@Slot()
|
||||
def cancel(self):
|
||||
self.generic_post("scan/cancel")
|
||||
|
||||
@@ -25,7 +25,6 @@ from PySide6.QtWidgets import (
|
||||
from aaredaqlib.models import DAQStatusModel, AutofocusSettings, SampleCameraSettings, BeamlineStateEnum
|
||||
from aaregui.models.bookmark import SmargonBookmarkList
|
||||
from aaredaqlib.coordinate import Coordinate, SmargonCoordinate
|
||||
from aaredaqlib.raster_grid import RasterGridRequest
|
||||
from aaredaqlib.sample_geometry import SampleGeometryModel
|
||||
from aaregui.scan_logic.raster_grid_manager import RasterGridManager
|
||||
|
||||
@@ -290,7 +289,7 @@ class SampleCameraImageLabel(QGraphicsView):
|
||||
ratio = 0.1
|
||||
|
||||
if ratio >= 1.0:
|
||||
# Don't enable scaling when gain in ratio is < 5% (to avoid back-and-forth
|
||||
# Don't enable scaling when gain in ratio is < 5% (to avoid back-and-forth)
|
||||
self.setTransform(QTransform())
|
||||
else:
|
||||
matrix = QTransform()
|
||||
|
||||
Reference in New Issue
Block a user