accinv.jacobian module

Module containing functionality for computing the Jacobian of the ORM.

The layout of the Jacobian is based on the following convention:

  • The ORM appears along the rows (axis=0) as a column-major flattened array.

  • The columns of the Jacobian correspond to the various parameters in the same order in which those parameters have been specified.

In the following, in HH, HV, VH, VV the first letter denotes BPMs and the second letter denotes steerers; e.g. HV means horizontal BPMs and vertical steerers, i.e. the right upper block of the ORM. The ORM generally looks like:

+------+------+
|      |      |
|  HH  |  HV  |
|      |      |
+------+------+
|      |      |
|  VH  |  VV  |
|      |      |
+------+------+

Then the Jacobian looks like:

+---PARAMETERS---+
|                |
H                |
H                |
|                |
+----------------+
|                |
H                |
V                |
|                |
+----------------+
|                |
V                |
H                |
|                |
+----------------+
|                |
V                |
V                |
|                |
+----------------+
class accinv.jacobian.AnalyticalJacobianMethod(*, model: OpticsModel, hbpms: Collection[str], hsteerers: Collection[str], vbpms: Collection[str], vsteerers: Collection[str])

Bases: JacobianMethod

Computes an analytical version of the Jacobian from Twiss data.

Parameters
  • model – The optics model from which Twiss data is computed.

  • hbpms – Names of horizontal BPMs.

  • hsteerers – Names of horizontal steerers.

  • vbpms – Names of vertical BPMs.

  • vsteerers – Names of vertical steerers.

compute(parameters: Collection[NumericalParameterGroup], configuration: Optional[Collection[ParameterUpdate]] = None) tuple[<MagicMock name='mock.NDArray.__getitem__()' id='139857758038624'>, <MagicMock name='mock.NDArray.__getitem__()' id='139857758038624'>]

Compute the Jacobian for the given parameters and configuration.

Parameters
  • parameters – The parameter groups for which to compute the Jacobian. The individual parts of the Jacobian, along its columns, correspond to the order in which parameter groups are specified.

  • configuration – The lattice configuration at which to compute the Jacobian.

Returns

The tuple (jacobian, orm).

compute_analytical_jacobian_for_quadrupoles(quadrupoles: Quadrupoles, configuration: Optional[Collection[ParameterUpdate]] = None) tuple[<MagicMock name='mock.NDArray.__getitem__()' id='139857758038624'>, <MagicMock name='mock.NDArray.__getitem__()' id='139857758038624'>]

Similar to AnalyticalJacobianMethod.compute_analytical_jacobian() but for quadrupoles specifically.

class accinv.jacobian.ComputeJacobianFunction(*args, **kwargs)

Bases: Protocol

class accinv.jacobian.ComputeOrmFunction(*args, **kwargs)

Bases: Protocol

class accinv.jacobian.NumericalJacobianMethod(*, model: Model, hbpms: Collection[str], hsteerers: Collection[str], vbpms: Collection[str], vsteerers: Collection[str], compute_orm_kwargs: Mapping[str, Any])

Bases: JacobianMethod

Uses finite difference approximation (one step) to compute the Jacobian.

Parameters
  • model – The model which will be used to compute ORMs to construct the Jacobian.

  • hbpms – Names of horizontal BPMs.

  • hsteerers – Names of horizontal steerers.

  • vbpms – Names of vertical BPMs.

  • vsteerers – Names of vertical steerers.

  • compute_orm_kwargs – Keyword arguments for Model.compute_orm().

compute(parameters: Collection[NumericalParameterGroup], configuration: Optional[Collection[ParameterUpdate]] = None) tuple[<MagicMock name='mock.NDArray.__getitem__()' id='139857758038624'>, <MagicMock name='mock.NDArray.__getitem__()' id='139857758038624'>]

Compute the Jacobian for the given parameters and configuration.

Parameters
  • parameters – The parameter groups for which to compute the Jacobian. The individual parts of the Jacobian, along its columns, correspond to the order in which parameter groups are specified.

  • configuration – The lattice configuration at which to compute the Jacobian.

Returns

The tuple (jacobian, orm).