diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py index 3b11f13..949031a 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py @@ -424,18 +424,18 @@ class FlomniSampleTransferMixin: def show_signal_strength_interferometer(self): dev.rtx.controller.show_signal_strength_interferometer() - def rt_feedback_disable(self): + def feedback_disable(self): self.device_manager.devices.rtx.controller.feedback_disable() - def rt_feedback_enable_with_reset(self): + def feedback_enable_with_reset(self): self.device_manager.devices.rtx.controller.feedback_enable_with_reset() self.rt_feedback_status() - def rt_feedback_enable_without_reset(self): + def feedback_enable_without_reset(self): self.device_manager.devices.rtx.controller.feedback_enable_without_reset() self.rt_feedback_status() - def rt_feedback_status(self): + def feedback_status(self): feedback_status = self.device_manager.devices.rtx.controller.feedback_is_running() if feedback_status == True: print("The rt feedback is \x1b[92mrunning\x1b[0m.") @@ -455,7 +455,7 @@ class FlomniSampleTransferMixin: umv(dev.fsamroy, 0) - self.rt_feedback_disable() + self.feedback_disable() self.ensure_fheater_up() @@ -1142,7 +1142,7 @@ class Flomni( fsamx_in = self._get_user_param_safe(dev.fsamx, "in") if np.isclose(fsamx_in, dev.fsamx.readback.get(), 0.5): print("Stopping alignment. Returning to fsamx in position.") - self.rt_feedback_disable() + self.feedback_disable() umv(dev.fsamx, fsamx_in) raise exc diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/x_ray_eye_align.py b/csaxs_bec/bec_ipython_client/plugins/flomni/x_ray_eye_align.py index 4ad60fc..fc7b954 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/x_ray_eye_align.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/x_ray_eye_align.py @@ -100,7 +100,7 @@ class XrayEyeAlign: self.flomni.laser_tracker_on() - self.flomni.rt_feedback_enable_with_reset() + self.flomni.feedback_enable_with_reset() # disable movement buttons self.movement_buttons_enabled = False @@ -109,7 +109,7 @@ class XrayEyeAlign: epics_put("XOMNYI-XEYE-SAMPLENAME:0.DESC", sample_name) # this makes sure we are in a defined state - self.flomni.rt_feedback_disable() + self.flomni.feedback_disable() epics_put("XOMNYI-XEYE-PIXELSIZE:0", self.PIXEL_CALIBRATION) @@ -143,13 +143,13 @@ class XrayEyeAlign: self.movement_buttons_enabled = False epics_put("XOMNYI-XEYE-SUBMIT:0", -1) # disable submit button - self.flomni.rt_feedback_disable() + self.flomni.feedback_disable() fsamx_in = self.flomni._get_user_param_safe("fsamx", "in") umv(dev.fsamx, fsamx_in) self.flomni.foptics_out() - self.flomni.rt_feedback_disable() + self.flomni.feedback_disable() umv(dev.fsamx, fsamx_in - 0.25) self.update_frame() @@ -160,7 +160,7 @@ class XrayEyeAlign: umv(dev.fsamx, fsamx_in) time.sleep(0.5) - self.flomni.rt_feedback_enable_with_reset() + self.flomni.feedback_enable_with_reset() self.update_frame() self.send_message("Adjust sample height and submit center") @@ -205,11 +205,11 @@ class XrayEyeAlign: # allow movements, store movements to calculate center _xrayeyalignmvy = epics_get("XOMNYI-XEYE-MVY:0") if _xrayeyalignmvy != 0: - self.flomni.rt_feedback_disable() + self.flomni.feedback_disable() umvr(dev.fsamy, _xrayeyalignmvy / 1000) time.sleep(2) epics_put("XOMNYI-XEYE-MVY:0", 0) - self.flomni.rt_feedback_enable_with_reset() + self.flomni.feedback_enable_with_reset() self.update_frame() time.sleep(0.2) diff --git a/csaxs_bec/bec_ipython_client/plugins/omny/omny.py b/csaxs_bec/bec_ipython_client/plugins/omny/omny.py index 3676cf1..16bb1db 100644 --- a/csaxs_bec/bec_ipython_client/plugins/omny/omny.py +++ b/csaxs_bec/bec_ipython_client/plugins/omny/omny.py @@ -552,11 +552,11 @@ class OMNY( try: self.align.align() except KeyboardInterrupt as exc: - fsamx_in = self._get_user_param_safe(dev.fsamx, "in") - if np.isclose(fsamx_in, dev.fsamx.readback.get(), 0.5): - self.OMNYTools.printgreen("Stopping alignment. Returning to fsamx in position.") - self.rt_feedback_disable() - umv(dev.fsamx, fsamx_in) + osamx_in = self._get_user_param_safe(dev.osamx, "in") + if np.isclose(osamx_in, dev.osamx.readback.get(), 0.5): + self.OMNYTools.printgreen("Stopping alignment. Returning to osamx in position.") + self.feedback_disable() + umv(dev.osamx, osamx_in) raise exc def xrayeye_update_frame(self): @@ -565,10 +565,10 @@ class OMNY( def xrayeye_alignment_start(self): self.start_x_ray_eye_alignment() - def drive_axis_to_limit(self, device, direction): - axis_id = device._config["deviceConfig"].get("axis_Id") - axis_id_numeric = self.axis_id_to_numeric(axis_id) - device.controller.drive_axis_to_limit(axis_id_numeric, direction) + # def drive_axis_to_limit(self, device, direction): + # axis_id = device._config["deviceConfig"].get("axis_Id") + # axis_id_numeric = self.axis_id_to_numeric(axis_id) + # device.controller.drive_axis_to_limit(axis_id_numeric, direction) def axis_id_to_numeric(self, axis_id) -> int: return ord(axis_id.lower()) - 97 @@ -692,7 +692,7 @@ class OMNY( @tomo_type.setter def tomo_type(self, val: float): if val == 1: - # equally spaced tomography with 8 sub tomograms + # equally spaced tomography with 2 sub tomograms self.client.set_global_var("tomo_type", val) elif val == 2: # golden ratio tomography (sorted bunches) @@ -853,7 +853,7 @@ class OMNY( successful = False error_caught = False if 0 <= angle < 180.05: - print(f"Starting flOMNI scan for angle {angle}") + print(f"Starting OMNY scan for angle {angle}") while not successful: self._start_beam_check() try: @@ -879,7 +879,7 @@ class OMNY( print("Alignment scan finished. Please run SPEC_ptycho_align and load the new fit.") - umv(dev.fsamroy, 0) + umv(dev.osamroy, 0) def _write_subtomo_to_scilog(self, subtomo_number): dev = builtins.__dict__.get("dev") @@ -900,36 +900,13 @@ class OMNY( subtomo_number (int): The sub tomogram number. start_angle (float, optional): The start angle of the scan. Defaults to None. """ - # dev = builtins.__dict__.get("dev") - # bec = builtins.__dict__.get("bec") - # if self.tomo_id > 0: - # tags = ["BEC_subtomo", self.sample_name, f"tomo_id_{self.tomo_id}"] - # else: - # tags = ["BEC_subtomo", self.sample_name] - # self.write_to_scilog( - # f"Starting subtomo: {subtomo_number}. First scan number: {bec.queue.next_scan_number}.", - # tags, - # ) - self._write_subtomo_to_scilog(subtomo_number) if start_angle is None: if subtomo_number == 1: start_angle = 0 elif subtomo_number == 2: - start_angle = self.tomo_angle_stepsize / 8.0 * 4 - elif subtomo_number == 3: - start_angle = self.tomo_angle_stepsize / 8.0 * 2 - elif subtomo_number == 4: - start_angle = self.tomo_angle_stepsize / 8.0 * 6 - elif subtomo_number == 5: - start_angle = self.tomo_angle_stepsize / 8.0 * 1 - elif subtomo_number == 6: - start_angle = self.tomo_angle_stepsize / 8.0 * 5 - elif subtomo_number == 7: - start_angle = self.tomo_angle_stepsize / 8.0 * 3 - elif subtomo_number == 8: - start_angle = self.tomo_angle_stepsize / 8.0 * 7 + start_angle = self.tomo_angle_stepsize / 2.0 # _tomo_shift_angles (potential global variable) _tomo_shift_angles = 0 @@ -940,7 +917,7 @@ class OMNY( num=int(180 / self.tomo_angle_stepsize) + 1, endpoint=True, ) - # reverse even sub-tomograms + # reverse even sub-tomogram if not (subtomo_number % 2): angles = np.flip(angles) for angle in angles: @@ -950,7 +927,7 @@ class OMNY( self.progress["projection"] = (subtomo_number - 1) * self.progress[ "subtomo_total_projections" ] + self.progress["subtomo_projection"] - self.progress["total_projections"] = 180 / self.tomo_angle_stepsize * 8 + self.progress["total_projections"] = 180 / self.tomo_angle_stepsize * 2 self.progress["angle"] = angle self._tomo_scan_at_angle(angle, subtomo_number) @@ -958,7 +935,7 @@ class OMNY( successful = False error_caught = False if 0 <= angle < 180.05: - print(f"Starting flOMNI scan for angle {angle} in subtomo {subtomo_number}") + print(f"Starting OMNY scan for angle {angle} in subtomo {subtomo_number}") self._print_progress() while not successful: self._start_beam_check() @@ -1011,7 +988,7 @@ class OMNY( str(datetime.date.today()), bec.active_account.decode(), bec.queue.next_scan_number, - "flomni", + "OMNY", "test additional info", "BEC", ) @@ -1021,9 +998,9 @@ class OMNY( with scans.dataset_id_on_hold: if self.tomo_type == 1: - # 8 equally spaced sub-tomograms + # 2 equally spaced sub-tomograms self.progress["tomo_type"] = "Equally spaced sub-tomograms" - for ii in range(subtomo_start, 9): + for ii in range(subtomo_start, 3): self.sub_tomo_scan(ii, start_angle=start_angle) start_angle = None @@ -1073,6 +1050,7 @@ class OMNY( f"Golden ratio tomography stopped automatically after the requested {self.golden_max_number_of_projections} projections" ) break + elif self.tomo_type == 3: # Equally spaced tomography, golden ratio starting angle previous_subtomo_number = -1 @@ -1144,9 +1122,9 @@ class OMNY( return tomo_number def _at_each_angle(self, angle: float) -> None: - if "flomni_at_each_angle" in builtins.__dict__: + if "omny_at_each_angle" in builtins.__dict__: # pylint: disable=undefined-variable - flomni_at_each_angle(self, angle) + omny_at_each_angle(self, angle) return self.tomo_scan_projection(angle) @@ -1253,18 +1231,18 @@ class OMNY( cenx = sum_offset_x + stitch_x * (self.fovx - self.tomo_stitch_overlap) ceny = sum_offset_y + stitch_y * (self.fovy - self.tomo_stitch_overlap) logger.info( - f"scans.flomni_fermat_scan(fovx={self.fovx}, fovy={self.fovy}," + f"scans.omny_fermat_scan(fovx={self.fovx}, fovy={self.fovy}," f" step={self.tomo_shellstep}, cenx={cenx}, ceny={ceny}," f" zshift={sum_offset_z}, angle={angle}," f" exp_time={self.tomo_countingtime}, corridor_size={corridor_size})" ) log_message = ( - f"{str(datetime.datetime.now())}: flomni scan projection at angle {angle}, scan" + f"{str(datetime.datetime.now())}: omny scan projection at angle {angle}, scan" f" number {bec.queue.next_scan_number}.\n" ) self.write_to_spec_log(log_message) # self.write_to_scilog(log_message, ["BEC_scans", self.sample_name]) - scans.flomni_fermat_scan( + scans.omny_fermat_scan( fovx=self.fovx, fovy=self.fovy, step=self.tomo_shellstep, @@ -1288,8 +1266,8 @@ class OMNY( print(f" _manual_shift_y = {self.manual_shift_y}") print("") if self.tomo_type == 1: - print("\x1b[1mTomo type 1:\x1b[0m 8 equally spaced sub-tomograms") - print(f"Total number of projections: {180/self.tomo_angle_stepsize*8}") + print("\x1b[1mTomo type 1:\x1b[0m 2 equally spaced sub-tomograms") + print(f"Total number of projections: {180/self.tomo_angle_stepsize*2}") print(f"Angular step within sub-tomogram: {self.tomo_angle_stepsize} degrees") if self.tomo_type == 2: print("\x1b[1mTomo type 2:\x1b[0m Golden ratio tomography") @@ -1332,17 +1310,17 @@ class OMNY( ) print("Tomography type:") - print(" 1: 8 equally spaced sub-tomograms") + print(" 1: 2 equally spaced sub-tomograms") print(" 2: Golden ratio tomography") print(" 3: Equally spaced tomography, golden ratio starting angle") self.tomo_type = self._get_val("Tomography type", self.tomo_type, int) if self.tomo_type == 1: tomo_numberofprojections = self._get_val( - "Total number of projections", 180 / self.tomo_angle_stepsize * 8, int + "Total number of projections", 180 / self.tomo_angle_stepsize * 2, int ) print(f"The angular step will be {180/tomo_numberofprojections}") - self.tomo_angle_stepsize = 180 / tomo_numberofprojections * 8 + self.tomo_angle_stepsize = 180 / tomo_numberofprojections * 2 print(f"The angular step in a subtomogram it will be {self.tomo_angle_stepsize}") if self.tomo_type == 2: @@ -1399,7 +1377,7 @@ class OMNY( print("failed to enable rt") def write_pdf_report(self): - """create and write the pdf report with the current flomni settings""" + """create and write the pdf report with the current OMNY settings""" dev = builtins.__dict__.get("dev") # header = "" header = ( @@ -1435,6 +1413,7 @@ class OMNY( f"{'Stitching:':<{padding}}{stitching:>{padding}}\n", f"{'Number of individual sub-tomograms:':<{padding}}{8:>{padding}}\n", f"{'Angular step within sub-tomogram:':<{padding}}{self.tomo_angle_stepsize:>{padding}.2f}\n", + "Add current temperature and pressure status" ] content = "".join(content) user_target = os.path.expanduser(f"~/Data10/documentation/tomo_scan_ID_{self.tomo_id}.pdf") diff --git a/csaxs_bec/device_configs/omny_config.yaml b/csaxs_bec/device_configs/omny_config.yaml index 1141b39..5a4de93 100644 --- a/csaxs_bec/device_configs/omny_config.yaml +++ b/csaxs_bec/device_configs/omny_config.yaml @@ -283,7 +283,7 @@ osamx: readOnly: false readoutPriority: baseline userParameter: - in: 0 + in: -0.1 osamz: description: Sample Z deviceClass: csaxs_bec.devices.omny.galil.ogalil_ophyd.OMNYGalilMotor