docs(omny): TODO to port always-defined tomo_alignment_fit from flomni
CI for csaxs_bec / test (push) Failing after 2m23s

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
x12sa
2026-09-21 15:03:44 +02:00
co-authored by Claude Sonnet 5
parent 5b688df428
commit e802d55112
@@ -0,0 +1,58 @@
# TODO: port "always define `tomo_alignment_fit`" to OMNY now that it's landed on Flomni
**Status: implemented on Flomni** (commit `5b688df`, branch
`fixes/flomni_beamtime_2`), not yet ported to OMNY.
## Problem (as seen on Flomni)
The `tomo_alignment_fit` global var was deleted by `reset_tomo_alignment_fit()`
(on stage-in and at the start of a new alignment) and never created at
startup. Manual offset tweaks from the client failed with an undefined
variable:
```python
fit = flomni.client.get_global_var("tomo_alignment_fit") # -> None
fit[0][2] += 5.0 # x offset, microns -> TypeError
```
## What Flomni does now (`flomni/flomni.py`)
- `reset_tomo_alignment_fit()` writes `np.zeros((2, 5)).tolist()` instead of
calling `delete_global_var`, so the var is always defined.
- New `ensure_tomo_alignment_fit()` sets the zero fit **only if**
`get_global_var("tomo_alignment_fit") is None`. It is called from
`Flomni.__init__`, so an existing fit survives a client restart.
- `get_alignment_offset()` is unchanged; with zeros it prints zero offsets
instead of the "Not applying any alignment offsets" message. Same result.
Fit layout (row 0 = x, row 1 = y):
```
# x amp, phase, offset, y amp, phase, offset, 3rd order amp, 3rd order phase
# 0 0 0 1 0 2 1 0 1 1 1 2 1 3 1 4
```
## What to do on OMNY
`omny/omny_alignment_mixin.py` still has the old behaviour:
- `reset_tomo_alignment_fit()` (~line 57) does
`self.client.delete_global_var("tomo_alignment_fit")`.
- Nothing defines the var at startup. `OMNY.__init__` is in `omny/omny.py`
(~line 557).
Steps:
1. Change `reset_tomo_alignment_fit()` to write `np.zeros((2, 5)).tolist()`.
2. Add `ensure_tomo_alignment_fit()` exactly as on Flomni.
3. Call it from `OMNY.__init__` (after `self.client` is set).
4. Check the callers: at the time of writing, nothing in `omny/` calls
`reset_tomo_alignment_fit()` apart from its definition, so decide where
OMNY should reset the fit (start of an alignment / sample transfer),
mirroring Flomni's `ftransfer_flomni_stage_in()` and
`XrayEyeAlign._align_impl()`.
5. `read_alignment_offset()` in the OMNY mixin builds the fit as `np.zeros((2, 5))`
and stores it with `set_global_var`, so it needs no change.
LamNI does not reference `tomo_alignment_fit` at all (checked by grep), so no
action there.