From 6415db0e2db6b216897867c94ab78cc0cb74a3ca Mon Sep 17 00:00:00 2001 From: x12sa Date: Tue, 15 Sep 2026 15:02:57 +0200 Subject: [PATCH] config(flomni): switch panda config back to Mode A, record Mode B success Mode B (omny_panda_continuous) confirmed working end-to-end against real PandA hardware on 2026-09-15: correct per-channel raw values, masked gate_detector_active, and frame_counter-based completion all verified. Switching back to Mode A (omny_panda) for A/B comparison testing. Both device entries now stay uncommented in ptycho_flomni.yaml, toggled via enabled: true/false, rather than commenting/uncommenting blocks -- confirmed a disabled device is an inert placeholder that BEC's device server never connects to. Speed testing Mode B beyond the initial 100 Hz is still TODO. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01TsfqLcPWspjJ6vedMyCxco --- csaxs_bec/device_configs/ptycho_flomni.yaml | 88 +++++++++---------- .../developer/panda_box_free_running_setup.md | 35 +++++--- 2 files changed, 69 insertions(+), 54 deletions(-) diff --git a/csaxs_bec/device_configs/ptycho_flomni.yaml b/csaxs_bec/device_configs/ptycho_flomni.yaml index 70eeca28..f840e47e 100644 --- a/csaxs_bec/device_configs/ptycho_flomni.yaml +++ b/csaxs_bec/device_configs/ptycho_flomni.yaml @@ -646,49 +646,48 @@ calculated_signal: ############################################################ #################### OMNY Pandabox ######################### ############################################################ -# Mode A (legacy per-gate aggregate acquisition). The PandA layout has to match the -# selected mode (see docs/developer/panda_box_free_running_setup.md, "Open question") - -# it currently has the Mode B layout loaded (see omny_panda_continuous below), so this -# block is kept commented as the reference/restore point for Mode A rather than enabled -# alongside it. To go back to Mode A: disable/remove omny_panda_continuous below, restore -# the PandA layout for per-gate aggregate capture, and uncomment this block. -# omny_panda: -# readoutPriority: async -# deviceClass: csaxs_bec.devices.panda_box.panda_box_omny.PandaBoxOMNY -# deviceConfig: -# host: omny-panda.psi.ch -# signal_alias: -# FMC_IN.VAL1.Min: cap_voltage_fzp_y_min -# FMC_IN.VAL1.Max: cap_voltage_fzp_y_max -# FMC_IN.VAL1.Mean: cap_voltage_fzp_y_mean -# FMC_IN.VAL2.Min: cap_voltage_fzp_x_min -# FMC_IN.VAL2.Max: cap_voltage_fzp_x_max -# FMC_IN.VAL2.Mean: cap_voltage_fzp_x_mean -# INENC1.VAL.Max: interf_st_fzp_y_max -# INENC1.VAL.Mean: interf_st_fzp_y_mean -# INENC1.VAL.Min: interf_st_fzp_y_min -# INENC2.VAL.Max: interf_st_fzp_x_max -# INENC2.VAL.Mean: interf_st_fzp_x_mean -# INENC2.VAL.Min: interf_st_fzp_x_min -# INENC3.VAL.Max: interf_st_rotz_max -# INENC3.VAL.Mean: interf_st_rotz_mean -# INENC3.VAL.Min: interf_st_rotz_min -# INENC4.VAL.Max: interf_st_rotx_max -# INENC4.VAL.Mean: interf_st_rotx_mean -# INENC4.VAL.Min: interf_st_rotx_min -# PCAP.GATE_DURATION.Value: pcap_gate_duration_value -# enabled: true -# readOnly: false -# softwareTrigger: false -# deviceTags: -# - ptycho_flomni +# Mode A (legacy per-gate aggregate acquisition) and Mode B (continuous free-running +# raw-sample acquisition, see docs/developer/panda_box_free_running_setup.md) need different +# PandA hardware layouts and can't run simultaneously (see that doc's "Open question"), so +# only one of the two devices below should have enabled: true at a time, matching whichever +# layout is currently loaded on the PandA. A disabled device is an inert placeholder - BEC's +# device server never opens a connection to it (device_server/devices/devicemanager.py) - so +# both stay uncommented for easy switching instead of commenting/uncommenting blocks. +# +# Currently: Mode A enabled, Mode B disabled (switched back 2026-09-15 for A/B comparison +# testing after confirming Mode B works end-to-end; Mode B speed testing beyond 100 Hz is +# still TODO). +omny_panda: + readoutPriority: async + deviceClass: csaxs_bec.devices.panda_box.panda_box_omny.PandaBoxOMNY + deviceConfig: + host: omny-panda.psi.ch + signal_alias: + FMC_IN.VAL1.Min: cap_voltage_fzp_y_min + FMC_IN.VAL1.Max: cap_voltage_fzp_y_max + FMC_IN.VAL1.Mean: cap_voltage_fzp_y_mean + FMC_IN.VAL2.Min: cap_voltage_fzp_x_min + FMC_IN.VAL2.Max: cap_voltage_fzp_x_max + FMC_IN.VAL2.Mean: cap_voltage_fzp_x_mean + INENC1.VAL.Max: interf_st_fzp_y_max + INENC1.VAL.Mean: interf_st_fzp_y_mean + INENC1.VAL.Min: interf_st_fzp_y_min + INENC2.VAL.Max: interf_st_fzp_x_max + INENC2.VAL.Mean: interf_st_fzp_x_mean + INENC2.VAL.Min: interf_st_fzp_x_min + INENC3.VAL.Max: interf_st_rotz_max + INENC3.VAL.Mean: interf_st_rotz_mean + INENC3.VAL.Min: interf_st_rotz_min + INENC4.VAL.Max: interf_st_rotx_max + INENC4.VAL.Mean: interf_st_rotx_mean + INENC4.VAL.Min: interf_st_rotx_min + PCAP.GATE_DURATION.Value: pcap_gate_duration_value + enabled: true + readOnly: false + softwareTrigger: false + deviceTags: + - ptycho_flomni -# Mode B (continuous free-running raw-sample acquisition), see -# docs/developer/panda_box_free_running_setup.md. Requires the matching PandA layout to be -# loaded (TTLIN1 = detector trigger -> COUNTER1 falling-edge count = frame_counter and -# PCAP.BITS0 bit 0 = gate bit; CLOCK1 driving PCAP.gate/trig continuously; all six -# analog/encoder channels on raw Value capture) - confirmed against the omny-panda hardware -# 2026-09-15, currently running at 100 Hz for initial testing. omny_panda_continuous: readoutPriority: async deviceClass: csaxs_bec.devices.panda_box.panda_box_omny.PandaBoxOMNY @@ -707,10 +706,11 @@ omny_panda_continuous: # omny-panda hardware, see docs/developer/panda_box_free_running_setup.md. PCAP.BITS0 # is a shared 32-bit word; PandaBoxOMNY masks it to bit 0 (TTLIN1.VAL) before # publishing gate_detector_active. COUNTER1 counts TTLIN1's falling edge, i.e. one - # increment per completed exposure; it also doubles as the on_complete signal. + # increment per completed exposure; it also doubles as the on_complete signal. Confirmed + # working end-to-end 2026-09-15; speed testing beyond the initial 100 Hz is still TODO. PCAP.BITS0.Value: gate_detector_active COUNTER1.OUT.Value: frame_counter - enabled: true + enabled: false readOnly: false softwareTrigger: false deviceTags: diff --git a/docs/developer/panda_box_free_running_setup.md b/docs/developer/panda_box_free_running_setup.md index 533b0853..defb17ad 100644 --- a/docs/developer/panda_box_free_running_setup.md +++ b/docs/developer/panda_box_free_running_setup.md @@ -1,11 +1,11 @@ # PandABox (`omny_panda`) burst acquisition: two operation modes -> **Status: software implemented, Mode B layout wired and under initial -> testing on real PandA hardware (2026-09-15, omny-panda.psi.ch).** The block -> assignments below reflect what is actually loaded on the OMNY PandA design -> as of that date. The target free-running rate is still being ramped up -> (started at 100 Hz for initial testing); update the rate row once a final -> operating rate is settled. +> **Status: Mode B confirmed working end-to-end against real PandA hardware +> (2026-09-15, omny-panda.psi.ch)** — correct per-channel raw values, masked +> `gate_detector_active`, and `frame_counter`-based completion all verified. +> Config switched back to Mode A afterward for A/B comparison testing (see +> "Switching between modes" below); re-enable `omny_panda_continuous` to test +> Mode B again. Remaining TODO: speed testing beyond the initial 100 Hz. ## Context @@ -124,8 +124,9 @@ and record the exact save/load commands used here. ## Signal alias mapping The physical PandA block feeding each BEC signal name, kept here and in -`csaxs_bec/device_configs/ptycho_flomni.yaml` (`omny_panda.deviceConfig.signal_alias`) -in sync as a single source of truth: +`csaxs_bec/device_configs/ptycho_flomni.yaml` (`omny_panda.deviceConfig.signal_alias` for +Mode A, `omny_panda_continuous.deviceConfig.signal_alias` for Mode B) in sync as a single +source of truth: | PandA block | Mode | BEC signal name | |---|---|---| @@ -135,14 +136,28 @@ in sync as a single source of truth: | `INENC2.VAL.Min`/`.Max`/`.Mean` | A | `interf_st_fzp_x_min`/`_max`/`_mean` | | `INENC3.VAL.Min`/`.Max`/`.Mean` | A | `interf_st_rotz_min`/`_max`/`_mean` | | `INENC4.VAL.Min`/`.Max`/`.Mean` | A | `interf_st_rotx_min`/`_max`/`_mean` | -| `PCAP.GATE_DURATION.Value` | A | `pcap_gate_duration_value` | +| `PCAP.GATE_DURATION.Value` | A, B | `pcap_gate_duration_value` | +| `FMC_IN.VAL1/VAL2.Value`, `INENC1`-`4.VAL.Value` | B | `cap_voltage_fzp_y`/`_x`, `interf_st_fzp_y`/`_x`/`_rotz`/`_rotx` | | `PCAP.BITS0.Value` (bit 0 = `TTLIN1.VAL`, confirmed 2026-09-15; masked in software, see above) | B | `gate_detector_active` | -| `COUNTER1.OUT.Value` (confirmed 2026-09-15, free-running off `TTLIN1.VAL`) | B | `frame_counter` | +| `COUNTER1.OUT.Value` (confirmed 2026-09-15, triggered off `TTLIN1.VAL`'s falling edge) | B | `frame_counter` | The BEC-side data schema produced by Mode B (what ends up in the HDF5 async dataset) is documented separately in `docs/developer/panda_box_free_running_data_schema.md`. +## Switching between modes + +`omny_panda` (Mode A) and `omny_panda_continuous` (Mode B) are both defined in +`ptycho_flomni.yaml` at all times; exactly one should have `enabled: true`, matching +whichever layout is currently loaded on the PandA (see "Open question" below for why they +can't both be enabled at once). A disabled device is an inert placeholder — BEC's device +server never opens a connection to it (`bec_server/device_server/devices/devicemanager.py`, +`connect_device` is only called when `enabled`) — so switching is just flipping the +`enabled` flag on both entries and reloading the device config; no need to comment/uncomment +blocks. Confirmed end-to-end 2026-09-15: Mode B tested working (correct per-channel values, +masked `gate_detector_active`, `frame_counter`-based completion), then switched back to +Mode A for A/B comparison testing. + ## Open question, now partially resolved Can both modes coexist under a single static PandA layout — i.e. is mode