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:
weights
Classes
|
Handles a list of Observables to be evaluated together. |
- class ObservableList(obsiter=(), *, method=<function linopt6>, orbit=None, twiss_in=None, r_in=None, **kwargs)[source]#
Bases:
listHandles a list of Observables to be evaluated together.
ObservableListsupports alllistmethods, like appending, insertion or concatenation with the “+” operator.- Parameters:
obsiter (Iterable[Observable]) – Iterable of
Observables- 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 forLocalOpticsObservablemethod (Callable) – Method for linear optics. Used for
LocalOpticsObservable. Default:linopt6r_in (Orbit) – Initial trajectory, used for
TrajectoryObservable, Default: zeros(6)
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, *, dp=None, dct=None, df=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 forLocalOpticsObservablemethod (Callable) – Method for linear optics. Used for
LocalOpticsObservable. Default:linopt6r_in (Orbit) – Initial trajectory, used for
TrajectoryObservable, Default: zeros(6)
- 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[float]]#
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
- property flat_weighted_values: ndarray[tuple[Any, ...], dtype[float]]#
1-D array of Observable weigthed values
- needs_optics = {Need.GLOBALOPTICS, Need.LOCALOPTICS}#
- needs_orbit = {Need.EMITTANCE, Need.GLOBALOPTICS, Need.LOCALOPTICS, Need.MATRIX, Need.ORBIT}#
- needs_ring = {Need.EMITTANCE, Need.GEOMETRY, Need.GLOBALOPTICS, Need.LOCALOPTICS, Need.MATRIX, Need.ORBIT, Need.RING, Need.TRAJECTORY}#