ocelot icon indicating copy to clipboard operation
ocelot copied to clipboard

ocelot.adaptors.elegant_lattice_converter -- remove initialization from elegant2ocelot and put to init()

Open iagapov opened this issue 4 years ago • 2 comments

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)

iagapov avatar Jul 06 '20 13:07 iagapov

Submit a pull request with proposed changes

sergey-tomin avatar Jul 07 '20 07:07 sergey-tomin

just move self.init_convert_matrix()

to init() no need for pull request for this

iagapov avatar Jul 07 '20 07:07 iagapov