From 0bc3778d3f1c05c7d58f4ff796bce28b73a0d174 Mon Sep 17 00:00:00 2001 From: gac-x05la Date: Wed, 19 Feb 2025 10:18:57 +0100 Subject: [PATCH] Before redeployment --- .../device_configs/microxas_test_bed.yaml | 2 +- tomcat_bec/scans/tomcat_scans.py | 4 +- tomcat_bec/scans/tutorial_fly_scan.py | 53 ++++++++++--------- tomcat_bec/scripts/scans_fede.py | 47 ++++++++-------- 4 files changed, 57 insertions(+), 49 deletions(-) diff --git a/tomcat_bec/device_configs/microxas_test_bed.yaml b/tomcat_bec/device_configs/microxas_test_bed.yaml index 2c8a479..c62626f 100644 --- a/tomcat_bec/device_configs/microxas_test_bed.yaml +++ b/tomcat_bec/device_configs/microxas_test_bed.yaml @@ -71,7 +71,7 @@ es1_tasks: prefix: 'X02DA-ES1-SMP1:TASK:' deviceTags: - es1 - enabled: true + enabled: false onFailure: buffer readOnly: false readoutPriority: monitored diff --git a/tomcat_bec/scans/tomcat_scans.py b/tomcat_bec/scans/tomcat_scans.py index 3c830b2..e13c4de 100644 --- a/tomcat_bec/scans/tomcat_scans.py +++ b/tomcat_bec/scans/tomcat_scans.py @@ -35,7 +35,7 @@ class TomcatSnapNStep(AsyncFlyScanBase): """ scan_name = "tomcatsnapnstepscan" - scan_type = "scripted" + # scan_type = "scripted" # arg_input = {"camera" : ScanArgType.DEVICE, # "exp_time" : ScanArgType.FLOAT} # arg_bundle_size= {"bundle": len(arg_input), "min": 1, "max": None} @@ -165,7 +165,7 @@ class TomcatSimpleSequence(AsyncFlyScanBase): """ scan_name = "tomcatsimplesequencescan" - scan_type = "scripted" + # scan_type = "scripted" scan_report_hint = "table" required_kwargs = ["scan_start", "gate_high", "gate_low"] gui_config = { diff --git a/tomcat_bec/scans/tutorial_fly_scan.py b/tomcat_bec/scans/tutorial_fly_scan.py index 2672f4b..c2b0f56 100644 --- a/tomcat_bec/scans/tutorial_fly_scan.py +++ b/tomcat_bec/scans/tutorial_fly_scan.py @@ -104,7 +104,6 @@ class AcquireWhite(Acquire): self.sample_angle_out = sample_angle_out self.motor_sample = motor - self.scan_motors = ["eyex", self.motor_sample, "es1_roty"] # change to the correct shutter device self.dark_shutter_pos_out = 1 ### change with a variable self.dark_shutter_pos_in = 0 ### change with a variable @@ -209,6 +208,7 @@ class AcquireProjections(AsyncFlyScanBase): ) yield from self.stubs.trigger() + while not flyer_request.done: yield from self.stubs.read( @@ -301,10 +301,11 @@ class AcquireRefs(Acquire): show_asap=True, rid=self.metadata.get("RID"), ) - + # to set signals on a device yield from self.stubs.send_rpc_and_wait("gfdaq", "file_prefix.set", self.file_prefix_dark) - yield from self.stubs.send_rpc_and_wait("gfdaq", "num_images.set", self.num_darks) +# yield from self.stubs.send_rpc_and_wait("gfdaq", "num_images.set", self.num_darks) + darks = AcquireDark( exp_burst=self.num_darks, device_manager=self.device_manager, @@ -317,28 +318,30 @@ class AcquireRefs(Acquire): self.point_id = darks.point_id status_sample_out_angle.wait() - if self.num_flats: - self.connector.send_client_info( - f"Acquiring {self.num_flats} flat field images", - show_asap=True, - rid=self.metadata.get("RID"), - ) - flats = AcquireWhite( - exp_burst=self.num_flats, - sample_position_out=self.sample_position_out, - sample_angle_out=self.sample_angle_out, - motor=self.motor, - file_prefix=self.file_prefix_white, - device_manager=self.device_manager, - metadata=self.metadata, - instruction_handler=self.stubs._instruction_handler, - **self.caller_kwargs, - ) - flats.point_id = self.point_id - yield from flats.scan_core() - self.point_id = flats.point_id - ## TODO move sample in beam and do not wait - ## TODO move rotation to angle and do not wait + # if self.num_flats: + # self.connector.send_client_info( + # f"Acquiring {self.num_flats} flat field images", + # show_asap=True, + # rid=self.metadata.get("RID"), + # ) + # yield from self.stubs.send_rpc_and_wait("gfdaq", "file_prefix.set", self.file_prefix_white) + # yield from self.stubs.send_rpc_and_wait("gfdaq", "num_images.set", self.num_flats) + + # flats = AcquireWhite( + # exp_burst=self.num_flats, + # #sample_position_out=self.sample_position_out, + # #sample_angle_out=self.sample_angle_out, + # #motor=self.motor, + # device_manager=self.device_manager, + # metadata=self.metadata, + # instruction_handler=self.stubs._instruction_handler, + # **self.caller_kwargs, + # ) + # flats.point_id = self.point_id + # yield from flats.scan_core() + # self.point_id = flats.point_id + # ## TODO move sample in beam and do not wait + # ## TODO move rotation to angle and do not wait class TutorialFlyScanContLine(AsyncFlyScanBase): diff --git a/tomcat_bec/scripts/scans_fede.py b/tomcat_bec/scripts/scans_fede.py index 5cb4abc..d1682e6 100644 --- a/tomcat_bec/scripts/scans_fede.py +++ b/tomcat_bec/scripts/scans_fede.py @@ -276,37 +276,37 @@ class Measurement: TODO: make it work for multiple devices """ - print("Sample name: " + self.sample_name) - print("Data path: " + self.data_path) - print("Number of images: " + str(self.nimages)) - print("Number of darks: " + str(self.nimages_dark)) - print("Number of flats: " + str(self.nimages_white)) + print("Sample name (sample_name): " + self.sample_name) + print("Data path (data_path): " + self.data_path) + print("Number of images (nimages): " + str(self.nimages)) + print("Number of darks (nimages_dark): " + str(self.nimages_dark)) + print("Number of flats (nimages_flat): " + str(self.nimages_white)) if self.exposure_time == None: - print("Exposure time: " + str(self.det.cfgExposure.get())) + print("Exposure time (exposure_time): " + str(self.det.cfgExposure.get())) self.exposure_time = self.det.cfgExposure.get() else: - print("Exposure time: " + str(self.exposure_time)) + print("Exposure time (exposure_time): " + str(self.exposure_time)) if self.exposure_period == None: - print("Exposure period: " + str(self.det.cfgFramerate.get())) + print("Exposure period (exposure_period): " + str(self.det.cfgFramerate.get())) self.exposure_period = self.det.cfgFramerate.get() else: - print("Exposure period: " + str(self.exposure_period)) + print("Exposure period (exposure_period): " + str(self.exposure_period)) if self.roix == None: - print("Roix: " + str(self.det.cfgRoiX.get())) + print("Roix (roix): " + str(self.det.cfgRoiX.get())) self.roix = self.det.cfgRoiX.get() else: - print("Roix: " + str(self.roix)) + print("Roix (roix): " + str(self.roix)) if self.roiy == None: - print("Roiy: " + str(self.det.cfgRoiY.get())) + print("Roiy (roiy): " + str(self.det.cfgRoiY.get())) self.roiy = self.det.cfgRoiY.get() else: - print("Roiy: " + str(self.roiy)) - print("Start angle: " + str(self.start_angle)) - print("Angular range: " + str(self.angular_range)) - print("Sample angle out: " + str(self.sample_angle_out)) - print("Sample position in: " + str(self.sample_position_in)) - print("Sample position out: " + str(self.sample_position_out)) - print("Position readback: " + str(self.position_rb)) + print("Roiy (roiy): " + str(self.roiy)) + print("Start angle (start_angle): " + str(self.start_angle)) + print("Angular range (angular_range): " + str(self.angular_range)) + print("Sample angle out (sample_angle_out): " + str(self.sample_angle_out)) + print("Sample position in (sample_position_in): " + str(self.sample_position_in)) + print("Sample position out (sample_position_out): " + str(self.sample_position_out)) + print("Position readback (position_rb): " + str(self.position_rb)) def acquire_darks(self,nimages_dark=None, exposure_time=None, exposure_period=None, @@ -472,7 +472,7 @@ class Measurement: base_path=self.base_path,file_prefix=self.file_prefix, ddc_trigger=4, ddc_source0=1, **kwargs) - def acquire_refs(self,nimages_dark=None, nimages_white=None, sample_angle_out=None, + def acquire_refs(self, motor="eyez", nimages_dark=None, nimages_white=None, sample_angle_out=None, sample_position_in=None, sample_position_out=None, exposure_time=None, exposure_period=None, roix=None, roiy=None, acq_mode=None, **kwargs): @@ -484,6 +484,8 @@ class Measurement: Parameters ---------- + motor : DeviceBase + Motor to be moved to move the sample out of beam darks : int, optional Number of dark images to acquire (no default) nimages_whites : int, optional @@ -534,9 +536,12 @@ class Measurement: self.build_filename(acquisition_type='white') file_prefix_white = self.file_prefix + print(file_prefix_dark) + print(file_prefix_white) + ### TODO: camera reset print("Handing over to 'scans.acquire_refs") - scans.acquire_refs(num_darks=self.nimages_dark, num_flats=self.nimages_white, sample_angle_out=self.sample_angle_out, + scans.acquire_refs(motor=motor, num_darks=self.nimages_dark, num_flats=self.nimages_white, sample_angle_out=self.sample_angle_out, sample_position_in=self.sample_position_in, sample_position_out=self.sample_position_out, exp_time=self.exposure_time, exp_period=self.exposure_period, image_width=self.roix, image_height=self.roiy, acq_mode='default', file_path=self.file_path, nr_writers=2, base_path=self.base_path,