at.latticetools.matching#
Matching of lattice parameters.
The matching acts on a VariableList to statisfy the constraints
expressed in an ObservableList.
Examples of use of such classes are available in:
Examples of matching are given in Matching.
Functions
|
Observable matching. |
|
Match constraints by varying variables. |
- match(variables, constraints, *, method=None, verbose=2, max_nfev=1000, optim_kw=None, **eval_kw)[source]#
Observable matching.
Minimisation is performed by the
least_squares()function.- Parameters:
variables (VariableList) – Variable parameters
constraints (ObservableList) – Constraints to fulfill
method (str | None) – Minimisation algorithm (see
least_squares()). IfNone, use ‘lm’ for unbounded problems, ‘trf’ otherwise,verbose (int) – Level of verbosity,
max_nfev (int) – Maximum number of function evaluation,
optim_kw (dict | None) – Dictionary of optimiser keyword arguments sent to
least_squares(),
- Keyword Arguments:
**eval_kw – Evaluation keywords provided to the
ObservableList.evaluate()method. For instance “ring” (for lattice-dependent observables), “dp”, “dct”, “orbit”, “twiss_in”, “r_in”… Default values are taken from the ObservableList.- Returns:
Matching result – solution for the variable values.
- Raises:
RuntimeError – If optimisation fails
- ring_match(ring, variables, constraints, *, copy=False, method=None, verbose=2, max_nfev=1000, **kwargs)[source]#
Match constraints by varying variables.
Minimisation is performed by the
least_squares()function.- Parameters:
ring (Lattice) – Lattice description
variables (VariableList) – Variable parameters
constraints (ObservableList) – Constraints to fulfill
copy (bool) – If
True, return a modified copy of ring, otherwise perform the match in-linemethod (str | None) – Minimisation algorithm (see
least_squares()). IfNone, use ‘lm’ for unbounded problems, ‘trf’ otherwise,verbose (int) – Level of verbosity,
max_nfev (int) – Maximum number of function evaluation,
- Keyword Arguments:
dp (float | None) – Momentum deviation. Default taken from the ObservableList,
dct (float | None) – Path lengthening. Default taken from the ObservableList,
df (float | None) – Deviation from the nominal RF frequency. Default taken from the ObservableList,
orbit (Orbit | None) – Initial orbit. Avoids looking for the closed orbit if it is already known. Used for
MatrixObservableandLocalOpticsObservable. Default taken from the ObservableList,twiss_in – Initial conditions for transfer line optics See
get_optics(). Used forLocalOpticsObservable. Default taken from the ObservableList,r_in (Orbit | None) – Initial trajectory, used for
TrajectoryObservable. Default taken from the ObservableList,**kwargs – The other keyword arguments sent to,
least_squares().
- Returns:
Modified Lattice if copy=True, None otherwise
- Raises:
TypeError – If copy=True and ElementVariable is present
RuntimeError – If optimisation fails
Examples
See Matching