Skip to content

Add bmad model#2

Merged
pluflou merged 11 commits into
mainfrom
bmad
Apr 8, 2026
Merged

Add bmad model#2
pluflou merged 11 commits into
mainfrom
bmad

Conversation

@pluflou

@pluflou pluflou commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces significant updates to support multiple beamline models in the LUME Live Stream Monitor, adds user-facing model selection, and improves the safety and flexibility of model input handling. The changes touch both the deployment configuration and the Python codebase, enabling users to choose between different simulation models and ensuring the UI and backend logic support this flexibility.

Key changes include:

Multi-model support and UI enhancements

  • Added a model_selector dropdown to the UI, allowing users to select between available models (cu_hxr_staged and cu_hxr_bmad), and updated all relevant dashboard and control cells to use the selected model. Also added a model info popup for user guidance. [1] [2] [3] [4] [5] [6]
  • Refactored the main image source class from StagedModelImageSource to ModelImageSource, now parameterized by model name, and updated its instantiation throughout the codebase. [1] [2] [3]

Model definitions and metadata

  • Defined a new MODELS dictionary mapping model names to their constructors, and a MODEL_INFO dictionary providing descriptions for each model, to drive both backend selection and UI display.

Deployment and configuration updates

  • Updated deployment and workflow files to use the new bmad tag for images and branches instead of the previous pool tag, ensuring that the correct model versions are deployed and built. [1] [2]

Safety and flexibility improvements

  • Improved slider and input handling by filtering out non-writable variables and handling edge cases for slider ranges, preventing errors when model input ranges are invalid or unavailable. [1] [2] [3] [4]
  • Updated logic in ModelImageSource to ensure only appropriate scalars are extracted depending on the selected model, and removed unused or redundant methods. [1] [2] [3] [4]

These changes collectively make the live monitor more robust, user-friendly, and adaptable to future model additions.

pluflou added 11 commits April 5, 2026 19:58
- beam_monitor.py: make lattice_path optional in _create_cu_hxr_bmad_model
  (the arg is unused; MODELS dict calls factories with no args); add
  ModelImageSource alias for StagedModelImageSource
- live_stream_monitor.py (local + k8s): import MODELS/MODEL_INFO; add a
  model_selector cell that creates model_dropdown; update header to be a
  full-width hstack with the title on the left and the model dropdown +
  ℹ️ hover-tooltip on the right; source_setup now passes model_dropdown.value
  to ModelImageSource so changing the dropdown recreates the source; both
  live_controls and interactive_controls filter OTR2 from screen options when
  cu_hxr_bmad is selected (bmad model starts at OTR2, no OTR2 output)
…theticLiveImageSource

- live_stream_monitor.py (local + k8s):
  - Restore OTR2 in screen dropdowns (both tabs)
  - Fix tooltip: use mo.Html() instead of mo.md() so the title attribute
    is not stripped; use 
 line separator and escape HTML special chars
    in the description text so the attribute value is valid
  - Add QUAD:IN20:631, QUAD:IN20:651, XCOR:IN20:641, YCOR:IN20:642 to
    slider_labels (already in MANUAL_INPUT_PVS, sliders now have explicit
    label entries)
  - Guard zero-range sliders (XCOR/YCOR min=max=0): fall back to -0.1…0.1
    so mo.ui.slider does not receive start==stop
- beam_monitor.py: delete unused SyntheticLiveImageSource class and its
  companion default_manual_input_values helper
@pluflou
pluflou merged commit 5146972 into main Apr 8, 2026
3 checks passed
pluflou added a commit that referenced this pull request Apr 20, 2026
Merge pull request #2 from slaclab/bmad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant