Flomni commissioning 5 #256

Merged
holler merged 30 commits from flomni_commissioning_5 into main 2026-07-12 07:28:11 +02:00
30 Commits
Author SHA1 Message Date
holler 8bb33d4f5b Merge branch 'main' into flomni_commissioning_5
CI for csaxs_bec / test (push) Successful in 1m31s
CI for csaxs_bec / test (pull_request) Successful in 1m32s
2026-07-11 23:34:16 +02:00
x12sa a1e4be771b reset manual shift and auto set fovx after xray align
CI for csaxs_bec / test (push) Successful in 1m30s
CI for csaxs_bec / test (pull_request) Successful in 1m32s
2026-07-10 09:17:20 +02:00
x12sa 7a556ecbc4 comment on 0 z shift added
CI for csaxs_bec / test (push) Successful in 1m33s
2026-07-09 15:38:05 +02:00
x12sa dad70a9cc1 feat(flomni): include measurement ID in end-of-tomo scilog summary 2026-07-09 15:33:34 +02:00
x12sa fc31888356 refactor(flomni): consolidate global-var params into _GlobalVarParam descriptor
CI for csaxs_bec / test (push) Successful in 2m4s
Replace 11 identical global-var-backed getter/setter property pairs with a
single _GlobalVarParam descriptor. Behavior is unchanged: same keys, defaults,
and None-handling; stitch_x/stitch_y retain int enforcement via the descriptor's
type_ guard (typeguard.check_type). Net -57 lines with no functional change.
2026-07-09 14:06:38 +02:00
x12sa 0b5666084a fix(flomni): warn on invalid beamline states before manual xray-eye frame; fix sample-remove slot handling
CI for csaxs_bec / test (push) Successful in 1m35s
xrayeye_update_frame() now checks all configured beamline states and, if any
are not valid, warns the user (the frame may be empty when the beam is down)
and asks before taking a frame. The automated alignment path is unaffected.

ftransfer_sample_change(): clarify the remove-only prompt to "sample currently
in the sample stage", and include tray slot 20 in the empty-slot scan
(range(1, 20) -> range(1, 21)) in both the remove and mount branches, matching
check_position_is_valid's 0-20 range.
2026-07-09 12:54:14 +02:00
x12sa 68a213b52f docs fix 2026-07-09 12:52:26 +02:00
x12sa bcaa66d5cc print green bold 2026-07-09 12:36:19 +02:00
x12sa 5db55cf763 print fov bold 2026-07-09 12:35:56 +02:00
x12sa 247b4125c6 better timing printout end of tomogram 2026-07-09 12:33:29 +02:00
x12sa d3b2c10ba2 scilog command changed 2026-07-09 10:11:11 +02:00
x12sa 191e889cdd feat(flomni): log projection timing from direct tomo_scan_projection calls
CI for csaxs_bec / test (push) Successful in 2m24s
2026-07-09 09:25:49 +02:00
x12sa dbedeb371d feat(flomni): skip feye_out in tomo_alignment_scan when scan-ready
CI for csaxs_bec / test (push) Successful in 1m30s
When the eye is already out, optics in, and feedback running, skip the
eye-out/optics-in transition to avoid an interferometer reset. Enables
repeated alignment scans and interleaving alignment into a tomogram
without leaving the current measurement position.
2026-07-08 13:11:56 +02:00
x12sa ec21916d58 fix(flomni): skip feedback reset in ffzp_in when FZP already in
feedback_disable/enable_with_reset cycle re-zeros the interferometers
and moves off the current sample position. Only run it when the FZP
actually needs to move; add force_feedback_reset kwarg and _ffzp_is_in
helper.
2026-07-08 13:11:24 +02:00
x12sa 2bfba84512 feat(flomni): live ROI size readout and camera-sourced pixel calibration
CI for csaxs_bec / test (push) Successful in 1m31s
X-Ray Eye alignment GUI + script now share a single, device-configured
pixel calibration and the GUI shows live ROI dimensions.

GUI (x_ray_eye.py):
- Add read-only "ROI size" field below the message box, showing the active
  ROI's x/y extent, updated live via each ROI's sigRegionChanged. Rectangles
  report width/height; circular ROIs read raw state["size"] so an ellipse
  state would be reflected (currently aspect-locked upstream).
- Add "Calibration" field showing microns/pixel, or "uncalibrated (pixels)"
  when the camera parameter is absent.
- Resolve mm/pixel from dev.cam_xeye.user_parameter["pixel_calibration"];
  fall back to raw pixels (scale 1.0, unit "px") if unavailable.
- Enlarge the message field from 60 to 90 px height.

Alignment script (x_ray_eye_align.py):
- Replace the hard-coded PIXEL_CALIBRATION constant with a pixel_calibration
  property reading the same cam_xeye user parameter; fall back to
  PIXEL_CALIBRATION_DEFAULT if unavailable.
- Fold the recurring factor of 2 into the calibration: xval_x_* come straight
  from raw ROI pixels on submit, so the true scale is 0.05/113 mm/pixel.
  Default is now 0.05/113 and the three /2 factors (FZP center x, height
  centering, FOV) are removed. Computed physical values are unchanged.

Device config (cam_xeye_pixel_calibration.yaml):
- Add pixel_calibration userParameter (0.05/113 mm per raw ROI pixel) to
  cam_xeye. Merge the userParameter block into the existing device entry.
2026-07-08 12:51:49 +02:00
x12sa 4071520f90 feat(flomni): comment-first scilog_last_scans, comment-only mode, no logo
CI for csaxs_bec / test (push) Successful in 1m32s
scilog_last_scans now puts the user comment at the top of the entry and
drops the flOMNI logo attachment. number_of_scans accepts 0 to send a
comment-only entry. When fewer projection records exist than requested
(e.g. non-ptycho scans, which write no timing record), the available ones
are used and a note reports how many of the requested count were found.
2026-07-08 12:05:04 +02:00
x12sa b638f4d982 feat(flomni): offer tomo-param reset on account change at session start
At BEC session start, compare bec.active_account against the new global
var defaults_applied_for_account. On a genuine account change, interactively
offer to reset all tomo scan parameters to their defaults for the new
experiment; a client restart within the same account is a silent no-op.
Add _set_default_tomo_params() writing all 20 scan parameters via the
property setters.
2026-07-08 11:55:03 +02:00
x12sa 401312fcbb fix/recon folder name from global var was not set when changed in gui
CI for csaxs_bec / test (push) Successful in 1m31s
2026-07-08 11:51:29 +02:00
x12sa f48d180376 added ES shutter to ES config 2026-07-08 11:50:57 +02:00
x12sa 803ea77dc4 config update 2026-07-08 11:04:18 +02:00
x12sa d838966bb3 replace yesno with gui yesno 2026-07-08 11:04:09 +02:00
x12sa 0cc11e6bfb - ConsoleButtonsWidget ABORT: SIGINT to the client (only if the parent
CI for csaxs_bec / test (push) Successful in 1m28s
process looks like a BEC client), plus a delayed (500 ms) backup
  stop_devices request, defaulting to stop-all so the widget doubles as
  a generic emergency stop when opened standalone from the launcher menu
2026-07-07 21:56:58 +02:00
x12sa 936fc294a0 feat(flomni): make sample transfer abortable via Ctrl+C and GUI abort button
The gripper routines (#GRGET/#GRPUT) run autonomously on the Galil
(thread 3); Ctrl+C previously only killed the BEC-side polling loop
while the controller kept executing, including ongoing motion.

- add FlomniSampleTransferMixin.ftransfer_abort(): dev.ftransy.stop()
  (stop_devices endpoint -> device server -> XQ#STOP), wait for thread 3
  to halt, then put the controller back in posmode; deliberately no
  ensure_gripper_up() - recovery after an abort is manual
- wrap the mntprgs polling loops in ftransfer_get_sample/put_sample in
  try/except KeyboardInterrupt -> ftransfer_abort()
- answering "No" at a confirmation point now also hard-aborts the
  controller routine instead of leaving it parked in #CONFIRL
- ConsoleButtonsWidget ABORT: keep SIGINT to the client, plus a delayed
  (500 ms) backup stop_devices request so the hardware stops even if
  the client is hung; delay ensures the controlled client-side abort
  wins the race against #STOP clearing mntprgs
2026-07-07 21:44:57 +02:00
x12sa 6be7e7f369 feat(bec_widgets): grey out Yes/No in ConsoleButtonsWidget when no message
CI for csaxs_bec / test (push) Successful in 1m32s
Yes/No start disabled and are enabled only while a message is set; ABORT
stays always enabled. Clear visual cue that there's nothing to confirm.
2026-07-07 21:13:52 +02:00
x12sa 276124e8fd minor fix gui confirm
CI for csaxs_bec / test (push) Successful in 1m40s
2026-07-07 15:44:09 +02:00
x12sa c2b5426752 feat(flomni): add GUI confirm/abort console for sample transfer
CI for csaxs_bec / test (push) Successful in 1m30s
Add a small ConsoleButtonsWidget (Yes/No/Abort + message label) as a
GUI alternative to console yesno() prompts during sample transfer,
docked below the live camera view.

- bec_widgets: new ConsoleButtonsWidget (csaxs_bec/bec_widgets/widgets/
  console_buttons/). Yes/No write to a response property polled by the
  caller; Abort sends a real SIGINT to the BEC client process (captured
  via os.getppid() at construction), stopping any blocking call
  (including an in-progress motor move) exactly like a console Ctrl+C.

- omny_general_tools: add OMNYTools.gui_yesno(), a GUI-backed
  alternative to yesno() with the same message/default/autoconfirm
  semantics, polling the widget's response instead of blocking on
  input(). Not yet used as a general yesno() replacement.

- gui_tools: flomnigui_show_cameras() now also opens the console widget
  docked below the two camera views (set_layout_ratios for relative
  sizing, since dock_area.new() has no pixel width/height kwarg).
  flomnigui_show_gui() now passes an explicit window geometry, right-
  aligned on a 2560x1440 screen.

- flomni: add ftransfer_confirm_dialog(), which uses the GUI console
  when available (falling back to the plain CLI yesno() otherwise) and
  wire it into ftransfer_confirm()'s per-step "All OK? Continue?"
  prompt during sample transfer. Other yesno() call sites (stage-in
  flight-tube check, gripper-move stage-out check) intentionally left
  on the CLI for now.

Known issue: requested window height in flomnigui_show_gui() is not
taking effect as expected at startup; needs follow-up.
2026-07-07 14:55:08 +02:00
x12sa fea16a74fa reverse numbering
CI for csaxs_bec / test (push) Successful in 1m31s
2026-07-07 13:17:03 +02:00
x12sa 9126b8d64d feat(flomni): add remove-only sample change via ftransfer_sample_change(-1)
CI for csaxs_bec / test (push) Successful in 1m33s
Passing -1 stows the sample currently in the sample stage into a free
tray slot without mounting a replacement, matching the old control
system's sample_change(-1) behavior. Existing swap-path logic is
unchanged.
2026-07-07 13:11:37 +02:00
x12sa 036b3b1bd2 feat(flomni): acquire empty frames at start of tomo_scan
CI for csaxs_bec / test (push) Successful in 1m31s
Add collect_empty_frames(), which acquires 10 flat-field frames at
angle 0 with fsamx shifted out of the beam by fovx/2 (opposite the
normal alignment x-offset). Called once at the start of a new
tomo_scan() (not on resume). Frames are excluded from the ptycho
reconstruction queue and logged to tomography_scannumbers.txt with
subtomo_number=0.
2026-07-07 12:32:13 +02:00
x12sa 87d275f569 flomni: add laser_parameters CLI and laser_tweak tool
CI for csaxs_bec / test (push) Successful in 1m31s
Expose the ConstEmitter runtime constants through the high-level flomni
interface, alongside the existing laser_tracker_* methods, and add an
interactive tweak tool for the two tracking target positions.

New methods on FlomniSampleTransferMixin (thin wrappers delegating to
dev.rtx.controller, same pattern as laser_tracker_show_all):
  laser_parameters_show_all()
  laser_parameters_set_targety(val)
  laser_parameters_set_targetz(val)
  laser_parameters_set_intensity_threshold_laser(val)
  laser_parameters_set_psd_intensity_threshold_tracking_low(val)

laser_tweak(): interactive 2D raw-terminal loop for the two tracking targets,
modeled on OMNYTools.tweak_cursor.
  left/right : target y -/+   (fixed 0.01 step, absolute set of current +/- step)
  up/down    : target z +/-
  s          : return both targets to their launch positions
  q          : quit (terminal state restored in finally)
On launch and after every change it prints the current y/z targets and the
fzp x interferometer signal (read_ssi_interferometer channel 1), so the signal
response can be watched while tweaking.

termios/tty/fcntl/sys are imported locally in laser_tweak to avoid touching
module-level imports. Additive change; no existing behaviour modified. Requires
the ConstEmitter emitter_* methods on RtFlomniController.
2026-07-07 11:36:57 +02:00