ocelot.adaptors.elegant_lattice_converter

Elegant <–> Ocelot lattice converter

Module Contents

Classes

ElegantLatticeConverter

Main Elegant <–> Ocelot lattice converter class

class ocelot.adaptors.elegant_lattice_converter.ElegantLatticeConverter

Main Elegant <–> Ocelot lattice converter class

init_convert_matrix(self)

Init Elegant -> Ocelot convertion matrix in case of dict has list, e.g. ‘VOLT’:[‘v’,’1.0e-9’] it uses for translation different units e.g. eV to GeV in case, dict has list with len=3, e.g. ‘R11’: [‘r’, 0, 0] it uses as indices e.g. r[0, 0]

fix_convert_matrix(self)

Init and fix Ocelot -> Elegant convertion matrix

calc_rpn(self, expression, constants={}, info='')

Calculation of the expression written in reversed polish notation

convert_val(self, str, constants, info)

Convert string input value to float or change input string value by value from constants array

elegant2ocelot(self, file_name)

:filename - input Elegant lattice filename

replace_s_multiplications(self, line)

Replace single multiplication of elements

replace_multiplications(self, line)

Replace multiplication with brackets of elements

replace_cells(self, cell, elements_dict)

Replace cells by elements

ocelot2elegant(self, lattice, file_name='lattice.lte')

:lattice - Ocelot lattice objectl :filename - output Elegant lattice filename