Skip to content

Add Change, Set and Single Mode windows - #18

Merged
DavidSagan merged 1 commit into
mainfrom
change-set-single-windows
Nov 7, 2026
Merged

DavidSagan merged 1 commit into
mainfrom
change-set-single-windows

Conversation

@DavidSagan

Copy link
Copy Markdown
Member

Summary

Three new windows, each in the Tao menu, in the Main window's toolbar and in the Window menu (Ctrl+6, Ctrl+7, Ctrl+8).

Change (change command)

  • Targets: Element (element list and attribute), Variable, Particle start (coordinate and optional universe), Tune (dQa, dQb, optional mask), Z tune.
  • How: add to the value, set (@), design + (d), or percent (%).
  • Attribute list: filled from the first element matching the element list.
  • Preview and report: the command line is shown before it runs. Tao's report (old/new/design columns, merit and dMerit) appears in the window and is echoed in the console.
  • Use selected: fills in the element selected in the Lattice window or a plot. It uses the name when that name is unique; otherwise the branch>>index, because change ele QF ... would change every QF.

Set (set command)

  • Groups: a list of the parameter groups Tao reports through pipe: global, bmad_com, beam, beam_init, space_charge_com, ptc_com, opti_de_param.
  • Parameter table: the chosen group's parameters in the same table as the datum windows, two columns by default. Settable ones are editable and issue set <group> <parameter> = <value>. Arrays are shown and set space separated (e.g. d_orb).
  • Free-form line: set <subcommand> <arguments> for every other subcommand (element, tune, plot, lattice, …), with a saved history. Picking an entry fills in both fields.
  • Feedback: success or Tao's rejection is shown under the line.

Single Mode (key-bound variables)

  • Table: the variables bound to keys (key_bound, key_delta), in banks of ten as in Tao's single mode, with columns Keys, Variable, Element[attribute], Model, Saved and Delta, plus −10/−1/+1/+10 buttons.

  • Keys (while the window has focus), the same as Tao's single mode:

    Keys Action
    1…0 / q…p ±1 delta
    Shift (!…) / Q…P) ±10 deltas
    ← / → change bank
    ↑ / ↓ all deltas ×10 / ÷10
    < / > all deltas ÷2 / ×2
  • How a step is done: it sets the model value directly, as Tao's single mode does. change var would also rebuild the optimizer's derivative matrix on every key press.

  • Save / Restore saved: the values start as Tao's key_val0. The window keeps its own saved values because key_val0 can't be set from the command line.

Tao issues found (worked around here, not fixed)

  • Switches before the subcommand: change -mask Q1* tune …, change -branch … z_tune … and change -silent variable …, as written in the manual, are rejected ("Change who?"). Tao only looks for switches from the second word on. The GUI puts switches after the subcommand.
  • Space after a prefix: change ele q k1 d 0.1 and … % 10 (with a space, as in the manual) give "Expression is blank" and change nothing. The GUI writes d0.1 / %10.
  • Precision: change … %50 is computed in single precision (0.32 → 0.4799999964).
  • key_val0: it can't be set with set var.

Testing

  • 52 tests pass locally and against the conda-forge Tao used in CI. New tests/test_tools.py:
    • all four change modes on QF K1, a variable change and the tune/particle_start command lines, and Use selected giving the index for the repeated QF;
    • Set: editing n_opti_cycles, editing the d_orb array, every group loading, the free-form line, Tao's rejection, and the history;
    • Single mode: the key table from the test lattice (which now binds both quad variables to keys), buttons, real key presses for ±1/±10, an unbound key, delta scaling, save/restore and banks.
  • Offscreen screenshots of the three windows checked by hand.

🤖 Generated with Claude Code

- Change: form for "change element | variable | particle_start | tune |
  z_tune" with the add/@/d/% modes, a command preview, Tao's report shown
  in the window, and "Use selected" for the selected element.
- Set: the pipe-reported groups (global, bmad_com, beam, beam_init,
  space_charge_com, ptc_com, opti_de_param) as editable parameter
  tables, plus a free-form "set <subcommand> ..." line with history.
- Single Mode: the key-bound variables in banks of ten, stepped with
  buttons or Tao's single-mode keys; delta scaling; save/restore.

Commands are built the way the current Tao accepts them: switches after
the change subcommand, and no space after the d/% prefixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DavidSagan
DavidSagan merged commit c9f350b into main Nov 7, 2026
2 checks passed
@DavidSagan
DavidSagan deleted the change-set-single-windows branch November 7, 2026 07:12
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