DAQ: Automated scan (WIP)
This commit is contained in:
+26
-54
@@ -1,5 +1,6 @@
|
||||
import copy
|
||||
import time
|
||||
from datetime import datetime
|
||||
from math import ceil
|
||||
from typing import List, Tuple
|
||||
|
||||
@@ -776,65 +777,36 @@ class AareDAQ:
|
||||
|
||||
def measure(self, sample: SampleShortInfo) -> float:
|
||||
start = time.perf_counter()
|
||||
if sample.location is not None:
|
||||
sample_name = "{}{}S{:02d}_{}".format(
|
||||
sample.location.segment,
|
||||
sample.location.pos,
|
||||
sample.pin,
|
||||
sample.sample_name
|
||||
)
|
||||
else:
|
||||
sample_name = sample.sample_name
|
||||
|
||||
formatted_date = datetime.now().strftime('%Y%m%d')
|
||||
sample_prefix = "{}/{}/{:02d}/{}_auto".format(
|
||||
formatted_date,
|
||||
sample.puck_name,
|
||||
sample.pin,
|
||||
sample.sample_name
|
||||
)
|
||||
|
||||
try:
|
||||
self.__cfg.try_set_busy(timeout=360)
|
||||
|
||||
geom = self.sample_geometry
|
||||
self.__mount(sample)
|
||||
|
||||
self.__set_state(BeamlineStateEnum.SampleAlignment)
|
||||
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.__auto_center(RasterGridRequest(
|
||||
exp_time_s=0.01,
|
||||
file_prefix=sample_prefix,
|
||||
smargon= SmargonCoordinate(),
|
||||
n_x=1,
|
||||
n_y=1,
|
||||
grid_size_mm=Coordinate(x=geom.beam_size_mm.x * 0.8, y=geom.beam_size_mm.y * 0.8),
|
||||
omega_deg=0
|
||||
))
|
||||
|
||||
self.__set_state(BeamlineStateEnum.DataCollection)
|
||||
|
||||
self.__devs.aerotech.move(0, wait=True)
|
||||
|
||||
self.__ml_bounding_box(sample.db_id, f"bb_raster_0")
|
||||
|
||||
self.__raster(
|
||||
RasterGridRequest(
|
||||
n_x=25,
|
||||
n_y=15,
|
||||
grid_size_mm=Coordinate(x=0.02, y=0.02),
|
||||
smargon=SmargonCoordinate(),
|
||||
omega_deg=0,
|
||||
exp_time_s=0.01,
|
||||
)
|
||||
)
|
||||
|
||||
self.__devs.aerotech.move(90, wait=True)
|
||||
|
||||
self.__ml_bounding_box(sample.db_id, f"bb_raster_90")
|
||||
|
||||
self.__raster(
|
||||
RasterGridRequest(
|
||||
n_x=25,
|
||||
n_y=10,
|
||||
grid_size_mm=Coordinate(x=0.02, y=0.02),
|
||||
smargon=SmargonCoordinate(),
|
||||
omega_deg=90,
|
||||
exp_time_s=0.01,
|
||||
)
|
||||
)
|
||||
|
||||
#self.__rotation(
|
||||
# RotationScanRequest(total_omega_deg=360,
|
||||
# start_omega_deg=0,
|
||||
# total_time_sec=18))
|
||||
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.__rotation( RotationScanRequest(start_omega_deg=0,
|
||||
file_prefix=sample_prefix,
|
||||
exp_time_s=0.01,
|
||||
incr_omega_deg=0.2,
|
||||
steps=1800,))
|
||||
self.__cfg.state_busy = False
|
||||
except Exception:
|
||||
self.__cfg.state_busy = False
|
||||
|
||||
Reference in New Issue
Block a user