at.latticetools.observablelist#
Grouping of Observable objects for fast evaluation.
ObservableList(lattice, …)This container based on
listis in charge of optics computations and provides each individualObservablewith its specific data.
ObservableList provides the evaluate()
method and the following properties:
Classes
|
Handles a list of Observables to be evaluated together. |
- class ObservableList(obsiter=(), ring=None, **kwargs)[source]#
Bases:
listHandles a list of Observables to be evaluated together.
ObservableListsupports all thelistmethods, like appending, insertion or concatenation with the “+” operator.- Parameters:
obsiter (Iterable[Observable]) – Iterable of
Observablesring (Lattice | None) – Default lattice. It will be used if ring is not provided to the
evaluate()function.
The following keyword arguments define the default values to be used when not given to the
evaluate()method- Keyword Arguments:
orbit (Orbit) – Initial orbit. Avoids looking for the closed orbit if it is already known. Used for
MatrixObservableandLocalOpticsObservabletwiss_in – Initial conditions for transfer line optics. See
get_optics(). Used forLocalOpticsObservabler_in (Orbit) – Initial trajectory, used for
TrajectoryObservable, Default: zeros(6)df (float) – Deviation from the nominal RF frequency. Defaults to
Nonemethod (Callable) – Method for linear optics. Used for
LocalOpticsObservable. Default:linopt6use_mp (bool) – Activate parallel calculation. Used for
RDTObservable, Default:Falsepool_size (int | None) – Number of processes used for parallelization. Used for
RDTObservable, Default:None**kwargs – Other keywords are passed to the evaluation functions.
Example
>>> obslist = ObservableList()
Create an empty Observable list
>>> obslist.append(OrbitObservable(at.Monitor, plane="x")) >>> obslist.append(GlobalOpticsObservable("tune")) >>> obslist.append(EmittanceObservable("emittances", plane="h"))
Add observables for horizontal closed orbit at Monitor locations, tunes and horizontal emittance
>>> obslist.evaluate(ring, initial=True)
Compute the values and mark them as the initial value
>>> obslist.values [array([-3.02189464e-09, 4.50695130e-07, 4.08205818e-07, 2.37899969e-08, -1.31783561e-08, 2.47230794e-08, 2.95310770e-08, -4.05598110e-07, -4.47398092e-07, 2.24850671e-09]), array([3.81563019e-01, 8.54376397e-01, 1.09060730e-04]), 1.320391045951568e-10]
>>> obslist.get_flat_values("tune", "emittances[h]") array([3.815630e-01, 8.543764e-01, 1.090607e-04, 1.320391e-10])
Get a flattened array of tunes and horizontal emittance
- evaluate(ring=None, *, initial=False, **kwargs)[source]#
Compute all the
Observablevalues.- Parameters:
- Keyword Arguments:
orbit (Orbit) – Initial orbit. Avoids looking for the closed orbit if it is already known. Used for
MatrixObservableandLocalOpticsObservabletwiss_in – Initial conditions for transfer line optics. See
get_optics(). Used forLocalOpticsObservabler_in (Orbit) – Initial trajectory, used for
TrajectoryObservable, Default: zeros(6)df (float) – Deviation from the nominal RF frequency. Defaults to
Nonemethod (Callable) – Method for linear optics. Used for
LocalOpticsObservable. Default:linopt6use_mp (bool) – Activate parallel calculation. Used for
RDTObservable, Default:Falsepool_size (int | None) – Number of processes used for parallelization. Used for
RDTObservable, Default:None**kwargs – Other keywords are passed to the evaluation functions.
- get_flat_deviations(*obsid, err=None, order='F')[source]#
Return a 1-D array of deviations from target values.
- get_flat_weighted_deviations(*obsid, err=None, order='F')[source]#
Return a 1-D array of weighted deviations from target values.
- get_flat_weighted_values(*obsid, err=None, order='F')[source]#
Return a 1-D array of Observable weighted values.
- get_weighted_deviations(*obsid, err=None)[source]#
Return the weighted deviations from target values.
- property flat_deviations: ndarray[tuple[Any, ...], dtype[float64]]#
1-D array of deviations from target value
- property flat_shape#
Shape of the flattened values
- property flat_weighted_deviations: ndarray[tuple[Any, ...], dtype[float]]#
1-D array of weighted deviations from target values