accelmo.fitting.setup¶
The model a fit runs on: backend model, BPM ranges and starting knobs.
- accelmo.fitting.setup.normalise_true_strengths(true_strengths)[source]¶
Normalise true strengths to a dictionary format.
- Parameters:
true_strengths (
Path|dict[str,float] |None) – Can be None, a Path to a file, or a dict- Return type:
dict[str,float]- Returns:
Dictionary of true strengths (empty if None was provided)
- Parameters:
true_strengths (Path | dict[str, float] | None)
- class accelmo.fitting.setup.MachineSetup(accelerator, sequence_config, *, output_config=None, cycle_marker=None, anchor_mode=None, anchor_markers=(), initial_knob_strengths=None, true_strengths=None, debug=False, machine_state=None, b2_errors=None)[source]¶
Bases:
objectEverything a fitter knows about the machine before any worker starts.
Builds the fitter-side backend model, reads its BPMs (
all_bpmsand the observedbpms_in_range), and resolves the starting knobs. Every value is in optimisation space: adeltapin the user’s knobs becomespt.Attributes set here and read by the fitters:
knob_namesThe optimised knobs, in model order.
initial_knobsThe starting value of every knob in
knob_names.initial_model_valuesFixed values (strengths and
pt) frominitial_knob_strengthsthat are not optimised here but still have to be set in every model.true_strengthsThe known answer, restricted to
knob_names; the initial knobs when none is given.
- Parameters:
accelerator (Accelerator)
sequence_config (SequenceConfig)
output_config (OutputConfig | None)
cycle_marker (str | None)
anchor_mode (str | None)
anchor_markers (Sequence[str])
initial_knob_strengths (dict[str, float] | None)
true_strengths (Path | dict[str, float] | None)
debug (bool)
machine_state (Path | Mapping[str, float] | None)
b2_errors (Path | None)
- property worker_start_knobs: dict[str, float]¶
the fixed values, then the initial knobs.
- Type:
Every value a worker model starts from
- make_run_log(name, *, resume=False)[source]¶
A run log under
output_config.run_log_root, orNonewhen disabled.With
resume, the newest unfinished run of thisnamethat has recorded some history is continued; a new one is made when there is none.- Return type:
RunLog|None- Parameters:
name (str)
resume (bool)