6 Commits
Author SHA1 Message Date
John Henry BealeandClaude Opus 5.5 efe18d4204 start paired post-tube axes together, fix GUI unlock after motor sequences
- move_together(): post-tube in/out and the tandem arrows check all targets
  first (nudge cap, soft limits), then send the moves back to back to the
  VAL fields (us X, ds X, us Y, ds Y) without reads in between; either all
  axes move or none (a refused tandem axis could tilt the tube)
- set_collecting(False) re-enables all groups: after a motor sequence the
  collimator and post-tube groups stayed greyed out
- log the end of a motor sequence and the GUI unlock

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:14:49 +02:00
John Henry BealeandClaude Opus 5.5 e05ebeb76b run blocking motor sequences in the worker thread, wait for the backlight
Detector, collimator, post-tube in/out, move home/yag, the backlight button
and the sample exchange/alignment/data collection transitions blocked the
GUI thread for up to ~20s per move.

- MoveWorker (same thread as the collection worker, so sequences and
  collections can not overlap) runs (label, callable) steps with a progress
  dialog; all controls are locked meanwhile (no nudges, zoom stays usable)
- move functions raise MoveError instead of showing dialogs; the GUI shows
  the message when the sequence ends
- abort stops all motors (motor record STOP, backlight) and ends the
  sequence; position checks (assert_tweaker_positions abort=) stop waiting
- safety: backlight moves wait and check the position before the next step
  (post-tube in used to start while the backlight was still moving out)
- tandem nudges stay non blocking in the GUI thread; collimator still moves
  X then Y
- sample alignment: backlight in now also checks the detector is clear of
  the post-tube path (as the backlight button does)

Tested in simulation and at the beamline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 09:20:51 +02:00
John Henry BealeandClaude Opus 5.5 14b3300ec6 stop the CTA and cancel JFJ on abort, keep data up to the abort
Before, an abort stopped motion and shutter only: the CTA sequence (detector,
x-ray shutter, laser triggers), the BS/PV retrieval and JFJ kept running to
the planned end of the run.

- CTAAcquisition.abort(stop_pid): stops the CTA sequence; the retrieval loop
  ends early and retrieves the following blocks cut at the abort pulse id
  (the retrieval lags the pulses by about one block) until a block is empty
- Jungfrau.stop_triggers(): reads the current pulse id and aborts the CTA
  acquisition (or stops a plain SFAcquisition task)
- Jungfrau.cancel(): JFJ cancel_post, then wait (max 60s each) for the data
  retrieval to finish and JFJ to be idle
- worker: request_abort closes the shutter first (Shutter.close caput
  sequence), then stops the CTA immediately; cleanup stops the CTA again,
  recovers the motion, then cancels JFJ and waits
- Shutter reads sync_flag from the preferences at each open/close instead
  of once at startup

Tested at the beamline (run 72): BS/PV data and JF images end at the abort
pulse id, motion recovered, JFJ idle afterwards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 08:27:13 +02:00
John Henry BealeandClaude Opus 5.5 64f2a4da72 recover the Deltatau after an aborted or failed data collection
The old abort only sent &1a;Gather.Enable=0, which left triggerSync running
and Coord[1].DesTimeBase at 0 (or under triggerSync control). The fast
stages then needed an IOC restart.

_recover_motion() now runs after an abort or any error while the motion
program is active:
- abort the motion program and stop gathering
- stop triggerSync (Ctrl-C, close the shell channel, killall)
- then restore Coord[1].DesTimeBase=Sys.ServoPeriod, TimeBaseSlew=1E-4
  and reset Coord[1].Q[0]=0 (a stale -2 lets the next wait_armed() return
  before the stage is at the start position)
- log the PowerBrick state before and after

Tested at the beamline (sync_mode 2, sync_flag 3): after a mid-scan abort
the fast stages move without an IOC restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 07:48:11 +02:00
John Henry BealeandClaude Opus 5.5 976776d267 allow collimator/post-tube nudges during data collection, lock everything else
- progress dialog is non modal; during a collection set_collecting() greys
  out the left tabs, toolbar, menu, fast stage and x-ray eye groups,
  backlight/lights/exposure and the collimator/post-tube in/out buttons
- collimator and post-tube motors stay usable, limited to a total move of
  NUDGE_MAX_STEP (0.5 mm) from their position at the start of the
  collection (MotorTweak/SimMotorTweak.set_max_step)
- zoom stays usable during a collection
- mouse clicks on the camera view are ignored during a collection
- daq_worker added to the -l log level list
- debug coordinate log is skipped when points/pts_trf are not in the
  scan parameters (grid modes) instead of raising KeyError

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 14:22:43 +02:00
John Henry BealeandClaude Opus 5.5 c2c3ef82fd run data collection in a worker thread with a direct abort path
- new daq_worker.py: CollectionWorker runs in its own QThread and owns the
  Deltatau/Jungfrau objects; progress, run info, gather plots and results
  are sent to the GUI thread with signals
- abort closes the shutter immediately and stops the motion program
  (&1a;Gather.Enable=0) at the next check
- shutter is closed in a finally block if the collection fails
- removes the processEvents()/sleep polling loop from the GUI thread
- quitting is blocked while a collection is running
- fix: debug coord log no longer overwrites the gather upload filename

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 12:39:44 +02:00