From 2f07c3e2513461c7896202ff5235a9190ddcf763 Mon Sep 17 00:00:00 2001 From: x01dc Date: Mon, 27 Jul 2026 14:48:53 +0200 Subject: [PATCH] docs+fix(LamNI): trim obsolete xrayeye doc section, drop archival text file - Remove the manual fit-parameter reload docs: fit params already load automatically, and the fallback path pointed at the retired ~/Data10/specES1 layout. - Fix stale slits/slit0wh references (slits takes no argument; the gap monitor is now slit1). - Stop writing the plain-text xrayeye_alignmentvalues archive in write_output() -- it was only for external fitting scripts and now collides with xrayeye_alignmentvalues being a directory used for the per-run HDF5 archives. --- .../plugins/LamNI/x_ray_eye_align.py | 37 +++++++++---------- docs/user/ptychography/lamni.md | 10 +---- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/csaxs_bec/bec_ipython_client/plugins/LamNI/x_ray_eye_align.py b/csaxs_bec/bec_ipython_client/plugins/LamNI/x_ray_eye_align.py index 2b633de..7d87b3b 100644 --- a/csaxs_bec/bec_ipython_client/plugins/LamNI/x_ray_eye_align.py +++ b/csaxs_bec/bec_ipython_client/plugins/LamNI/x_ray_eye_align.py @@ -561,26 +561,25 @@ class XrayEyeAlign: row 1: x offsets [um] row 2: y offsets [um] - Also writes a timestamped HDF5 file alongside the archival text file, - containing the full raw record of the alignment run: alignment_values - (FZP centre + all 8 angle clicks, in mm), alignment_images (one frame - per update_frame() call), roi_pixel_data (raw pixel coords/size at - each submit), and this same fit array as alignment_fit. + Writes a timestamped HDF5 file containing the full raw record of the + alignment run: alignment_values (FZP centre + all 8 angle clicks, in + mm), alignment_images (one frame per update_frame() call), + roi_pixel_data (raw pixel coords/size at each submit), and this same + fit array as alignment_fit. """ - # Archival text file (backward compatible with any external scripts) - file = os.path.expanduser("~/data/raw/logs/xrayeye_alignmentvalues") - os.makedirs(os.path.dirname(file), exist_ok=True) - with open(file, "w") as f: - f.write("angle\thorizontal\tvertical\n") - for k in range(2, 10): - angle_deg = LAMNI_ALIGNMENT_ANGLES[k - 2] - x_off = (self.alignment_values[0][0] - self.alignment_values[k][0]) * 1000 - y_off = (self.alignment_values[k][1] - self.alignment_values[0][1]) * 1000 - f.write(f"{angle_deg}\t{x_off:.4f}\t{y_off:.4f}\n") - print( - f" Angle {angle_deg:3d} deg: " - f"x_offset={x_off:.2f} um, y_offset={y_off:.2f} um" - ) + # NOTE: this used to also write a plain-text archival file at + # ~/data/raw/logs/xrayeye_alignmentvalues for external fitting + # scripts. That's no longer needed, and xrayeye_alignmentvalues is + # now a directory (holding the timestamped HDF5 files below), so + # writing a flat file at that same path would clash with it. + for k in range(2, 10): + angle_deg = LAMNI_ALIGNMENT_ANGLES[k - 2] + x_off = (self.alignment_values[0][0] - self.alignment_values[k][0]) * 1000 + y_off = (self.alignment_values[k][1] - self.alignment_values[0][1]) * 1000 + print( + f" Angle {angle_deg:3d} deg: " + f"x_offset={x_off:.2f} um, y_offset={y_off:.2f} um" + ) angles = np.array(LAMNI_ALIGNMENT_ANGLES, dtype=float) x_offsets = np.array( diff --git a/docs/user/ptychography/lamni.md b/docs/user/ptychography/lamni.md index 569c935..3fd1292 100644 --- a/docs/user/ptychography/lamni.md +++ b/docs/user/ptychography/lamni.md @@ -61,12 +61,6 @@ This opens the X-ray eye widget automatically. The procedure collects the sample With LamNI it can be difficult to relocate the sample between rotations. To keep the shutter open throughout, pass: `lamni.xrayeye_alignment_start(keep_shutter_open=True)` -To manually reload the fit parameters after the procedure has completed: -`lamni.read_xray_eye_correction_from_gui()` -**Note:** this reads from the live GUI widget via the `omny_xray_gui` device. It only works as long as the XRayEye GUI window remains open. If the window has been closed, reload from the archived text files instead: -`lamni.read_xray_eye_correction()` -(these files are written to `~/Data10/specES1/internal/xrayeye_alignmentvalues` at the end of every alignment run) - The correction is applied at each projection angle via `lamni.lamni_compute_additional_correction_xeye_mu(angle)` which is called automatically inside `lamni.tomo_scan_projection()`. @@ -75,9 +69,9 @@ To capture a single fresh frame without running the full alignment: `lamni.xrayeye_update_frame()` or with the shutter left open: `lamni.xrayeye_update_frame(keep_shutter_open=True)` -* If slits were opened during alignment, close the slits: `slits 1` to around 0.3 +* If slits were opened during alignment, close the slits: `slits` to around 0.3 * `lamni.leye_out()` remove the X-ray eye and move the flight tube in -* *possibly check slit0wh, idgap* +* *possibly check slit1, idgap* #### Fine alignment