at.latticetools.emit_observables#

Classes

LocalEmittanceObservable(refpts, param, *[, ...])

Observe emittance-related parameters.

class LocalEmittanceObservable(refpts, param, *, plane=Ellipsis, axis=Ellipsis, name=None, summary=False, label=None, **eval_kw)[source]#

Bases: ElementObservable

Observe emittance-related parameters.

Parameters:
Keyword Arguments:
  • summary – Set to True if the user-defined evaluation function returns a single item (see below)

  • postfun – Post-processing function. It can be any numpy ufunc or a function name in {“real”, “imag”, “abs”, “angle”, “log”, “exp”, “sqrt”}.

  • statfun – Statistics post-processing function. it can be a numpy function or a function name in {“mean”, “std”, “var”, “min”, “max”}. Example: statfun=numpy.mean.

  • target – Target value for a constraint. If None (default), the residual will always be zero.

  • weight – Weight factor: the residual is ((value-target)/weight)**2

  • bounds – Tuple of lower and upper bounds. The parameter is constrained in the interval [target+low_bound target+up_bound]

Evaluation keywords

These values must be provided to the evaluate() method. Default values may be given at instantiation.

  • ring: Lattice description,

  • dp: Momentum deviation. Defaults to None,

  • dct: Path lengthening. Defaults to None,

  • df: Deviation from the nominal RF frequency. Defaults to None,

  • orbit: Initial orbit. Avoids looking for the closed orbit if it is already known,

Shape of the value

If the requested attribute has shape shp, then value has shape (nrefs,) + shp with nrefs number of reference points: a nrefs dimension is prepended to the shape of the attribute, even if nrefs == 1. The target, weight and bounds inputs must be broadcastable to the shape of value. For instance, a target with shape shp will automatically broadcast and apply to all reference points.

Emittance parameter names

In addition to ohmi_envelope() parameter names, LocalEmittanceObservable adds the sigma parameter:

r66

(6, 6) equilibrium envelope matrix \(\Sigma\)

r44

(4, 4) betatron emittance matrix (dp = 0)

m66

(6, 6) transfer matrix from the start of the ring

orbit6

(6,) closed orbit

emitXY

(2,) betatron emittance projected on xxp and yyp

emitXYZ

(3,) 6x6 emittance projected on xxp, yyp, ldp

sigma6

(6,) standard deviation of the beam (square root

of the diagonal terms of r66)

sigma4

(6,) standard deviation of the monochromatic beam (square root

of the diagonal terms of r44)

User-defined evaluation function

The observable value is computed as:

value = fun(emit, **eval_kw)

  • emit is the output of ohmi_envelope(), evaluated at the refpts of the observable,

  • eval_kw are the keyword arguments provided to the observable constructor, to the constructor of the enclosing ObservableList and to the evaluate() method,

  • value is the value of the Observable and must have one line per refpoint. Alternatively, it may be a single line, but then the summary keyword must be set to True,

Examples

>>> obs = LocalEmittanceObservable(at.Monitor, "sigma6")

Observe the beam standard deviation in all 6 axes at Monitor locations

>>> obs = LocalEmittanceObservable(
...     at.Quadrupole, "sigma6", axis="x", statfun=np.max
... )

Observe the maximum horizontal beam size in Quadrupoles