accelmo.monitor.source

What the machine side supplies to the monitor.

class accelmo.monitor.source.OpticsSource(*args, **kwargs)[source]

Bases: Protocol

Turns knobs into optics for one model.

The monitor builds one per distinct stage metadata (and per worker thread) and calls it from a background thread, so it may hold a live MAD process. Every method returns plain data; the monitor caches it on disk, so the same knobs are never computed twice.

references()[source]

Tables that do not depend on the knobs: the measurement, design, …

Return type:

dict[str, DataFrame]

optics(knobs)[source]

The optics of the model with knobs applied (e.g. a twiss table).

Return type:

DataFrame

Parameters:

knobs (Mapping[str, float])

summary(optics)[source]

A few numbers describing optics (e.g. RMS beta-beating), plotted against step.

Return type:

dict[str, float]

Parameters:

optics (pd.DataFrame)

class accelmo.monitor.source.MonitorSpec(make_source=None, panels=list(), version='1')[source]

Bases: object

How to monitor one kind of fit: its optics source and its panels.

make_source builds an OpticsSource from a stage’s metadata (the OutputConfig.run_metadata the fit was given). panels are (title, function) pairs shown before the generic ones. Bump version whenever the source would give different optics for the same knobs, so old cached results are not reused.

Parameters:
  • make_source (Callable[[Mapping[str, Any]], OpticsSource] | None)

  • panels (Sequence[tuple[str, Callable[[MonitorView], Model]]])

  • version (str)

make_source: Callable[[Mapping[str, Any]], OpticsSource] | None = None
panels: Sequence[tuple[str, Callable[[MonitorView], Model]]]
version: str = '1'