Getting startedΒΆ

The following is a complete code example, with example file paths, to run LOCO for a given lattice and measurement.

from accinv.jacobian import AnalyticalJacobianMethod
from accinv.loco import Loco, OrmMeasurement
from accinv.model import Madx

model = Madx(path='path/to/script.madx')
loco = Loco(
    model_and_jacobian_method=(model, AnalyticalJacobianMethod),
    quadrupoles=[...],  # names of quadrupoles
    hbpms=[...],        # names of horizontal BPMs
    hsteerers=[...],    # names of horizontal steerers
    vbpms=[...],        # names of vertical BPMs
    vsteerers=[...],    # names of vertical steerers
    orm_measurement=OrmMeasurement(
      orm=np.load('path/to/measured_orm.npy'),
      uncertainty=np.load('path/to/orm_uncertainty.npy'),
  ),
)
result = loco.run()