ocelot
ocelot copied to clipboard
ocelot.adaptors.elegant_lattice_converter -- remove initialization from elegant2ocelot and put to init()
do initialisation for the elegant converter like so:
def init(self): self.init_convert_matrix()
then missing elements could be added:
from ocelot.adaptors.elegant_lattice_converter import * conv = ElegantLatticeConverter() conv.elegant_matrix['KQUAD'] = {'type': Quadrupole, 'params': {'L':'l', 'K1':'k1', "K2": "k2", 'TILT': 'tilt'}} conv.elegant_matrix['KSEXT'] = {'type': Sextupole, 'params': {'L':'l', 'K2':'k2'}} conv.elegant_matrix['KOCT'] = {'type': Octupole, 'params': {'L':'l', 'K3':'k3'}}
conv.elegant_matrix['CSBEND'] = {'type': SBend,'params':{'L': 'l', 'ANGLE': 'angle', "K1": "k1", "K2": "k2", "FINT": "fint",'E1': 'e1', 'E2': 'e2', "HGAP": ["gap", "2"], 'TILT': 'tilt'}}
read_cell = conv.elegant2ocelot('p4-cell.lte') lattice = MagneticLattice(read_cell)
Submit a pull request with proposed changes
just move self.init_convert_matrix()
to init() no need for pull request for this