Fixes/lamni #326

Merged
holler merged 13 commits from fixes/lamni into main 2026-09-29 13:07:47 +02:00
Member
No description provided.
holler added 11 commits 2026-09-29 12:50:17 +02:00
fix(lamni): scan defaults, sim feedback interlock, fttrz draft
CI for csaxs_bec / test (push) Successful in 2m57s
21168d5086
- lamni/omny fermat scan: default exp_time 0.1, drop unused readout_time
  (devices already fall back to their own configured readout time)
- sim_lamni: refuse the sd scan start and abort a running scan while the
  interferometer feedback loop is off; add tests
- simulated_lamni.yaml: lsamrot sim_velocity 48 (4x hw)
- lamni_optics_mixin / ptycho_lamni.yaml: commented-out draft for moving the
  fttrz flight tube in leye_out/leye_in, pending commissioned positions

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gUjUT2xCNpnBQkThn3CqP
- LamNI.lamni_move_to_scan_center(shift_x, shift_y, angle): thin client
  wrapper around scans.lamni_move_to_scan_center with the same parameters
  and docstring
- user docs: describe how the per-projection shift is computed (base shift,
  x-ray eye fit, manual shift, correction tables) in the fine alignment
  section, and add a section on checking the x-ray eye correction with the
  eye still in

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gUjUT2xCNpnBQkThn3CqP
- fall back to the last completed scan number when _current_scan_list is
  missing or stale (direct calls outside tomo_scan_projection)
- re-read ptycho_reconstruct_foldername on every write so changes from
  another client session are picked up
- add tests

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gUjUT2xCNpnBQkThn3CqP
PDFWriter does not create directories, so tomo_scan() failed with
FileNotFoundError when ~/data/raw/documentation did not exist. Also add an omny
TODO for porting the remaining ~/Data10 paths and the same folder fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gUjUT2xCNpnBQkThn3CqP
- shared TomoQueueMixin.tomo_parameters() opens OMNY_TomoParams in its own
  window (lamni_tomo_params / flomni_tomo_params); repeat calls do not open
  a second one; a missing or failing GUI raises the setup's error and points
  to tomo_parameters_cli() instead of silently falling back
- rename the prompt-based versions to tomo_parameters_cli()
- docs: describe both, and use the CLI in the queue examples that rely on
  the command blocking until the values are entered
- add tests with a fake GUI

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gUjUT2xCNpnBQkThn3CqP
_subtomo_angle_plan() used an explicit start_angle as the origin of a new
360-degree sweep. Resuming subtomo 2 at 85 deg generated 435..85; the >360
artifacts were silently skipped by _tomo_scan_at_angle's range gate, so the
resume began at 355 deg, re-measured done angles, never reached the rest and
reported wrong progress indices.

start_angle is now the literal resume point on the sub-tomogram's own grid:
the plan returns the remaining tail of the normal sweep plus a subtomo_offset
used for progress numbering (mirrors Flomni). Off-grid angles raise ValueError.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
fix(lamni): fully reset tomo progress when a new tomo scan starts
CI for csaxs_bec / test (push) Successful in 2m55s
ae646c7fea
tomo_scan() only reset the timing/ETA fields, so after a finished scan the
progress GUI kept showing the old subtomo, angle and projection == total
(rings at 100 %) while the initial 0-degree reference shot ran, with an ETA
computed from the old projection count against the new start time.

New _reset_progress_for_new_scan() resets every field (incl. the right
totals for the tomo type) in one global-var update and refreshes the GUI.
Resumes are unaffected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merge origin/fixes/lamni into worktree-lamni-resume-fix
CI for csaxs_bec / test (push) Successful in 3m4s
b141764f06
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Found by auditing LamNI against the battle-tested flomni:

- _tomo_scan_at_angle swallowed TimeoutError alarms: the projection was never
  retried, its failed scan numbers were logged as a success and it never
  reached reconstruction. Now the queue is reset and the alarm re-raised so
  @scan_repeat re-acquires it. The special-angle list is consumed only after
  success (a retry must still see it) and num_repeats is always defined.
- tomo_alignment_scan had the same swallow; it now retries (bounded) and
  rewrites ptychotomoalign_scannum.txt with the scan numbers actually acquired.
- leye_out() opened the fast shutter instead of closing it (regression from
  4967474 'removed fsh commands').
- Progress GUI: an endless golden-ratio scan (golden_max_number_of_projections
  == 0) divided by zero on the first projection, and any GUI/RPC failure
  propagated into the scan (retried 10x by @scan_repeat, then aborted). Now
  guarded and wrapped like flomni's dea43ed.
- raise_window() disabled as in flomni (it can hide the GUI window).
- write_to_scilog and the PDF report entry used the removed bec.logbook API;
  they now use bec.messaging.scilog like flomni, never raise, and include the
  at-each-angle hook source in the end-of-scan/timing entries.
- extra_tomo: num_repeats unbound for non-special angles.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- tomo_scan_projection() now adds the projection to the reconstruction queue
  itself (like flomni), so custom at_each_angle hooks and direct calls are
  reconstructed; _at_each_angle()/MagLamNI no longer do it (no double entry).
  tomo_alignment_scan() opts out (_reconstruct=False) to keep its previous
  behaviour -- flomni's alignment projections are queued, LamNI's never were.
- write_pdf_report(): branch on tomo_type (a golden-ratio scan reported a stale
  type-1 count and a hardcoded '8 sub-tomograms'), e-account from
  bec.active_account, tolerate a missing detector_distance.
- tomo_parameters_cli(): range guards (stitch 0-50, frames 1-100, >= 8
  projections, type-3 >= 1, golden max 0-1e6, bunch size 20-100).
- Webpage: projection count for tomo type 1 used flomni's 180-degree
  sub-tomograms (half the real count); TOMO_TYPES gets a base_angle. Also show
  the piezo range, manual shift and 0-degree reference rows.
- Tomo-params GUI: manual shift is mm end to end (label/range said um, +-1000);
  golden bunch size floor 20 for LamNI (setter/CLI already required it, so a
  smaller GUI value broke tomo_queue_execute). flomni fields untouched.
- lfzp_info() and the queue 'move Energy' entry used the legacy 'mokev' device
  (only in device_configs/legacy); now ccm_energy.
- Special-angle UnboundLocalError fixed in flomni too (list consumed only after
  a successful projection, so retries still see the special angle).
- Tomo type 3: exact integer sub-tomogram numbering (float truncation mislabelled
  the boundary projection for ~35 values of n < 400).
- XrayEyeAlign.align(): always reset the GUI (DAP forwarding, crosshair) on any
  failure; xrayeye_update_frame() warns when beamline states are invalid.
- Stale text / debug print; gap doc updated with the current status.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
feat(lamni): move slits and filters in leye_in/leye_out like flomni's feye
CI for csaxs_bec / test (push) Failing after 3m3s
CI for csaxs_bec / test (pull_request) Failing after 2m56s
9ff6ecbe53
leye_in() now widens sl1xs/sl1ys by 0.3mm and narrows the exposure-box
filters to 5% transmission before moving the eye in, and leye_out()
restores the pre-eye slit size and fully opens the filters again, with
a manual-override prompt if the slits were hand-adjusted while the eye
was in. Mirrors flomni's feye_in()/feye_out() intent (which has this
logic only as dead/commented-out code); LamNI now takes an optional
csaxs reference so it can call csaxs.fil_trans() like Flomni does.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
bec_bl_push-gitea added 1 commit 2026-09-29 12:56:10 +02:00
fix(tests): give leye_out shutter test a csaxs and client stub
CI for csaxs_bec / test (push) Successful in 3m3s
CI for csaxs_bec / test (pull_request) Successful in 3m5s
dbf8fbea58
leye_out() now reads self.csaxs and self.client (slit/filter handling), which
the bare LamNIOpticsMixin subclass in the test did not define.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
holler added 1 commit 2026-09-29 12:59:25 +02:00
Merge branch 'main' into fixes/lamni
CI for csaxs_bec / test (push) Successful in 3m1s
CI for csaxs_bec / test (pull_request) Successful in 3m4s
04119b9cfa
holler merged commit 7cb553414a into main 2026-09-29 13:07:47 +02:00
holler deleted branch fixes/lamni 2026-09-29 13:07:47 +02:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bec/csaxs_bec#326