185 Commits
Author SHA1 Message Date
John Henry BealeandClaude Opus 5.5 a3edcf7dca rename 'event trigger' to 'labelling event' (main page and preferences)
Only the displayed label: the settings key event_trigger and the JFJ
header key trigger_event are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 10:51:50 +02:00
John Henry BealeandClaude Opus 5.5 fd47942303 fix mode 5/7 collection: TypeError from a float tmove
fel_per is a float (10.0): tmove=10.0 gave wait_pulses=twait//tmove=1.0,
used to repeat the CTA lists ('can't multiply sequence by non-int').
tmove is now written as int when fel_per is whole, and wait_pulses is
cast to int.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 10:18:27 +02:00
John Henry BealeandClaude Opus 5.5 ba58eb8be1 twait in ms (multiples of the FEL period), fixed tmove kept in the parameters
- mode 7 uses tmove/twait in ms like mode 5 (shapepath divides by fel_per,
  its 'shots' doc is wrong): tmove is fel_per for both (was 1 for mode 7)
- wait field in ms, steps of fel_per, typed values snapped to a multiple
- the panel writes the fixed tmove into the parameter text, add obj and
  update param set it too (fix_motion_param), so it shows in the object
  information; the collection still enforces it
- warning when the text has another tmove or a twait that is not a
  multiple of it; a saved text gets the fixed tmove at startup

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 08:50:28 +02:00
John Henry BealeandClaude Opus 5.5 6c898059fd chip type, motion, delay and run time on the experimental parameters page
- chip type (same selection as the Fix Target type), motion mode 4..7,
  wait in pulses (mode 5/7) and section size (mode 6/7): these edit their
  keys in the Fix Target parameter text box and follow it when typed;
  text box and chip type are kept in the settings
- tmove is fixed to one FEL pulse (fel_per ms for mode 5, 1 shot for
  mode 7): not editable, set at the collection for every object
- the collection refuses objects with a mode other than 4..7
- laser delay PV readback and the calculated laser to X-ray delay
- estimated run time of the chip from the CTA sequence lengths
  (motion_run_pulses), including the checks that would abort it
- orange warning for twait not a multiple of tmove or an invalid ssz
- ModuleFixTarget: parse_param/format_param for the parameter text

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 08:36:07 +02:00
John Henry BealeandClaude Opus 5.5 4be0f03437 record chip type, motion mode and laser delay in the JFJ header
- header_appendix: chip_type, motion_mode, motion_param, fel_per_ms,
  delay_pulses, laser_delay_ns and total_delay_ns, taken from the job
  that actually runs (Jungfrau.config), not from the GUI
- laser delay read from SLAAR03-LTIM-PDLY:DELAYNS_SLOW (ns, negative:
  laser before the X-rays); total = laser - delay_pulses * fel_per;
  trigger_delay now holds the total delay
- motion_delay_pulses(): trigger to X-ray pulses per mode, same rules as
  the CTA sequences (mode 6/7 nominal)
- remove the unused manual laser_delay from the run parameters
- fix laser_pulse_energy, which was written with the trigger delay

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 08:24:38 +02:00
John Henry BealeandClaude Opus 5.5 a2873056c3 editable DAQ fields on the main page, kept in sync with the preferences
- data storage: pgroup, protein and prefix are editable (letters, digits
  and _ only); last run and last path stay read only
- experimental parameters (was empty): incident energy, event trigger,
  triggered, unit cell a b c alpha beta gamma and space group
- every change is saved immediately (no Enter needed: the Collect button
  takes no focus, so editingFinished would not fire before a collection)
- the preferences window is a single instance; main page and preferences
  update each other, so the preferences no longer write back stale group
  values; pgroup/energy/event trigger changes force a new jungfrau object
- the fields are locked during collections and motor sequences (left tabs)
- lower case labels

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 14:10:59 +02:00
John Henry BealeandClaude Opus 5.5 bf411bb1a6 remove the 'TODO: cleanup PV names' startup warnings
The collimator and post-tube groups read the 2nd device_prefix (outdated
SARES30-ESBMX), discarded it for the hard coded SARES30-SMX and logged a
warning at every start. Keep the hard coded prefix with a comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 13:19:39 +02:00
John Henry BealeandClaude Opus 5.5 5a584fb7de keep edited BS/PV channel lists across restarts
The 'if not in keys' guards of the channel list defaults were commented
out, so both lists were reset to the built-in defaults at every start
(and logged as 'not defined'). The defaults are now only used when no
list is saved yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 13:19:38 +02:00
John Henry BealeandClaude Opus 5.5 c260c60888 edit the BS and PV channel lists in a separate dialog
The channel lists were one very long line in the preferences tree. They
are now buttons ("edit beam-sync channels (N)...") opening a dialog with
one channel per line; OK saves the list (empty lines and duplicates
removed, space separated pastes work) and forces a new jungfrau object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 13:11:57 +02:00
John Henry BealeandClaude Opus 5.5 f811cf286e store absolute post sample tube out positions
The out position was one x and one y delta added to the upstream and
downstream in positions, and "use current position as out" computed the
deltas from the upstream motors only, so a downstream out position could
not be stored.

- preferences: out X/Y upstream and downstream (absolute) replace the out
  deltas; "use current position as out" stores all five axes
- existing settings: the absolute out positions are created once from
  in + delta
- the deltas are still written (upstream out - in) for older SwissMX
  versions sharing the settings file
- move_post_tube uses the absolute out positions (falls back to in+delta)

The collimator already stores absolute out positions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 13:05:51 +02:00
John Henry BealeandClaude Opus 5.5 5358424aa4 show beam position, energy and unit cell with full precision in preferences
pyqtgraph's 'decimals' is the number of significant figures: beam_x/beam_y
(decimals 2) showed 1613.25 as 1.6e+03, and energy/unit cell (decimals 3)
showed 12.398 as 12.4 and 109.47 as 109. Editing such a field stored the
rounded value. Use 6 significant figures (2-3 decimal places).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 12:57:13 +02:00
John Henry BealeandClaude Opus 5.5 017195e575 fix fast stage homing PV, add coarse Y homing to the Advanced menu
- Home Fast Stages wrote 'enable plc 1' to SAR-EXPMX1:ASYN.AOUT, which
  does not exist: write to SAR-EXPMX:asyn1.AOUT instead
- new Home Coarse Y: 'enable plc 2' (PLC_HomingCY in MX1_home.cfg)
- both ask for confirmation (default No), report a failed write and do
  nothing with simulated motors

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 12:52:09 +02:00
John Henry BealeandClaude Opus 5.5 e64f57bc31 remove unused GUI tabs and the x-ray eye group
- swissmx.ui: remove the Grid, Prelocated, Helical and EMBL method tabs,
  the Sample Selection tab with its empty centre page, and their stale
  tab stops; Experiment (Fix Target) and Setup remain
- remove the X-ray Eye motor group (SARES30-SMX:MCS14/15) from the right
  panel
- remove the dead code of these tasks: collection branches calling
  missing methods, the unreachable tail of cb_mouse_click and the task
  constants

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 12:47:09 +02:00
John Henry BealeandClaude Opus 5.5 2d9bbdac9d replace runtime print statements with logging
- all print calls outside the __main__ test blocks are now log calls:
  info for run information (CTA configuration summary on one line, run
  number, CTA start pid), warning/error for aborts and failures, debug for
  dumps (object/transform info, autofocus measurements, logger tree)
- psi_device: remove the import-time logging.basicConfig(level=DEBUG) and
  print('past logging'); the standalone test configures logging itself
- startup import timings are logged at info level
- ctadaq added to the -l log level list

Prints from PBTools/PBSwissMX, slic and the JFJ client are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:56:49 +02:00
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 d547f4f8f6 confirm before collecting when devices are not in data collection position
On Collect (after the task and target checks) the collimator, post sample
tube and detector are compared with their configured in positions and the
backlight with out (tolerance 0.1). If anything is out of position a
dialog lists every device and asks the operator to confirm (default No).
The check result and the operator's choice are logged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 09:44:46 +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 eab83c0fae fix mixed sim modes, camera parameter parsing and silent Collect
- pv_monitor_add skips simulated motor widgets one by one instead of
  asserting sim&0x10 (mixed modes such as --sim 0x0ef crashed at startup)
- preferences: roi/binning numbers written as decimals (8.0) are parsed as
  one number and rounded; a roi without 4 or binning without 2 values is
  not saved (8.0 used to become 8,0 and corrupt the camera roi)
- camera.set_param refuses a roi/binning with the wrong number of values
- Collect warns when there is nothing to scan or the task is not fix target

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 08:34:13 +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 ec1c7c659a fix simulated illumination and camera so --sim 0x1ff starts again
- illumination: send_command() and status() return early in simulated
  mode (regression from 960b48f, which tried to connect with no hostname)
- camera: sim_gen(mode=1) falls back to generated images (mode 0) when
  simCamImg/*.png is missing instead of raising IndexError

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 12:43:21 +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
John Henry Beale 02d6ebf74d cleaned yp mode:7 cta seq. Now runs on large chip pre-dev-merge-2026-10-16 2026-08-25 12:50:52 +02:00
John Henry Beale 04fc647c65 updated mode:7 cta sequence 2026-08-25 11:37:08 +02:00
John Henry Beale 7ef02b99c0 changed names of Data Storage labels to say, Last Run and Last Path 2026-08-24 13:26:12 +02:00
John Henry Beale b785ea43c0 added move to home button 2026-08-24 13:21:39 +02:00
John Henry Beale bc4e2b6001 corrected epics limits to be correctly passed to gui 2026-08-24 13:17:31 +02:00
John Henry Beale 8dfd022d73 only alpha numerical characters to protein and prefix fields - removes wrong data path bug 2026-08-24 12:26:26 +02:00
John Henry Beale 678b5990ea added new field to Data Storage - Data path of last run 2026-08-24 12:22:56 +02:00
John Henry Beale 5b4f7f3f2a made data storage fields active and display real values 2026-08-24 12:13:13 +02:00
John Henry Beale ed41dcf49e added YAG button to gui and YAG reference positions to preferences 2026-08-24 11:50:33 +02:00
John Henry Beale 644c23ac50 added new detector postion 'safe' so the detector tube clear position can be set and watched for. This is done with a new function 2026-08-24 11:18:09 +02:00
John Henry Beale 64d9ccacc7 add coarse-y to preferences 2026-08-24 11:05:09 +02:00
John Henry Beale ff646a9ef5 changed the sleep time after shutter opening back to 1.1s 2026-07-01 09:36:49 +02:00
John Henry Beale 1fea2ae4be fixed data collection progress bar 2026-06-15 14:45:24 +02:00
John Henry Beale 9ee99a12ea trying to prevent EPICS callback threads updating QT widgets directly. 2026-06-15 09:02:49 +02:00
John Henry Beale bfcaf5e7a9 attempting to increase gui stability by changing callbacks on threads 2026-06-15 08:52:17 +02:00
John Henry Beale fbe9611dfd update mode 6 start logic. Now allows x sizes of greater 2, but must be positive and even. 2026-06-15 08:23:38 +02:00
John Henry Beale 1552e86034 more updates to enable correct BS syncing 2026-06-12 09:47:12 +02:00
John Henry Beale 9009258667 new logic for entry into modes 6 and 7. x and y limits of the modes 2026-06-12 08:40:06 +02:00
John Henry Beale e5f96e8cb4 new BS logic for modes 6 and 7 2026-06-12 08:39:33 +02:00
John Henry Beale 1170855557 proposed change to mode 6 and 7 so that BS data stays in-sync 2026-06-12 08:15:43 +02:00
John Henry Beale 1a22e8300a saving to file bug fixed 2026-06-12 07:50:51 +02:00
John Henry Beale 1406dd6f9b fixed BS data via slic for modes 4 and 5 2026-06-11 15:55:47 +02:00
John Henry Beale 006b337d8c fixed OSError unsupported dile type bug when saving chip as .json 2026-06-11 15:14:24 +02:00
John Henry Beale c3a92ff242 unsure of changes - sort after beamtime 2026-05-21 07:40:29 +02:00
John Henry Beale 4af6b49190 lots of changes - many quick fixes made suring beamtime. many things to sort after the beamtime 2026-05-21 07:39:33 +02:00
John Henry Beale f95fe49647 first functioning mode 7 for full column blocks 2026-05-18 10:38:08 +02:00
John Henry Beale fc5799b8ef added detector and backlight safety to the move postube position in button 2026-05-15 15:19:21 +02:00