accelmo.tracking.ic_iteration¶
ACD sinusoid fits: single steps (IC or k free) and the joint fit with turn continuation.
Every step is one tracking LM fit with a different free set. The caller builds the fitter
for each step from a Step; values outside the free set stay fixed at the current
state (initial_knob_strengths) and the starts are carried by initial_starts.
- class accelmo.tracking.ic_iteration.Step(errors, fit_start_coords, knobs, starts, n_turns=None)[source]¶
Bases:
objectWhat one fit frees and where it starts.
errorsare the fitted families (Acceleratorerrors);fit_start_coordsfrees every start;n_turnslimits the tracked turns (None: all).- Parameters:
errors (Mapping[str, set[str]])
fit_start_coords (bool)
knobs (dict[str, float])
starts (np.ndarray | None)
n_turns (int | None)
- errors: Mapping[str, set[str]]¶
- fit_start_coords: bool¶
- knobs: dict[str, float]¶
- starts: ndarray | None¶
- n_turns: int | None = None¶
- class accelmo.tracking.ic_iteration.State(knobs, starts, loss, hessian=None, free_knobs=(), gains=dict(), gain_uncertainties=dict())[source]¶
Bases:
objectCurrent knobs, starts (x, px, y, py per particle;
None: measured) and chi² per weighted point.hessianis the LM Gauss-Newton matrix at the fit (free knobs, then starts).gains/gain_uncertaintiesare the BPM gains the fit returned (each fit restarts them at zero).- Parameters:
knobs (dict[str, float])
starts (np.ndarray | None)
loss (float)
hessian (np.ndarray | None)
free_knobs (tuple[str, ...])
gains (dict[str, float])
gain_uncertainties (dict[str, float])
- knobs: dict[str, float]¶
- starts: ndarray | None¶
- loss: float¶
- hessian: ndarray | None = None¶
- free_knobs: tuple[str, ...] = ()¶
- gains: dict[str, float]¶
- gain_uncertainties: dict[str, float]¶
- accelmo.tracking.ic_iteration.fit_step(make_fitter, state, errors, fit_start_coords, n_turns=None)[source]¶
One LM fit of
errors(and the starts iffit_start_coords) fromstate.- Return type:
- Parameters:
make_fitter (Callable[[Step], TrackingFitter])
state (State)
errors (Mapping[str, set[str]])
fit_start_coords (bool)
n_turns (int | None)
- accelmo.tracking.ic_iteration.joint(make_fitter, state, ic_errors, k_errors, turns=(None,))[source]¶
Joint fit of starts, kick and k, once per entry of
turns(continuation).Each entry is the window length, so the windows (starts) change between entries: later entries refit the starts from the measured ones and carry k and the kick.
- Return type:
list[State]- Parameters:
make_fitter (Callable[[Step], TrackingFitter])
state (State)
ic_errors (Mapping[str, set[str]])
k_errors (Mapping[str, set[str]])
turns (tuple[int | None, ...])
- accelmo.tracking.ic_iteration.cold_joint(make_fitter, state, ic_errors, k_errors)[source]¶
Joint fit from the initialisation with turn continuation 10 -> 30 -> 100 -> all.
- Return type:
list[State]- Parameters:
make_fitter (Callable[[Step], TrackingFitter])
state (State)
ic_errors (Mapping[str, set[str]])
k_errors (Mapping[str, set[str]])