Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 1.55 KB

TUTORIALS.rst

File metadata and controls

45 lines (35 loc) · 1.55 KB

Tutorials

1. Dependencies

The use of this package becomes only useful in combination with the package latticeadaptor, as this allows to convert the table generated by this package into lattice files that can be understood by the standard simulation tools MADX, ELEGANT and TRACY

2. Example: FODO

>>> from latticeconstructor.core import LatticeBuilderLine
>>> lblfodo = LatticeBuilderLine()
>>> lblfodo.add_def(
    {
        "QF": {"family" : "KQUAD", "L": 0.342, "K1":  0.4900, "N_KICKS": 16},
        "QD": {"family" : "KQUAD", "L": 0.668, "K1": -0.4999, "N_KICKS": 16},
        "D":  {"family" : "DRIF" , "L": 3.5805},
        "W1": {"family" : "WATCH", "L": 0, "filename":"\"%s-%03ld.w1\"","mode": "coordinates"}
    }
)
>>> lblfodo.add_element(["W1","QF","D","QD","D","QF"])
>>> lblfodo.table

    family      L       filename        mode            name    K1          N_KICKS pos
0   MARKER      0.0000      "%s-%03ld.w1"   coordinates W1      NaN         NaN     0.00000
1   QUADRUPOLE  0.3420      NaN             NaN         QF      0.4900      16.0    0.17100
2   DRIFT       3.5805      NaN             NaN         D       NaN         NaN     2.13225
3   QUADRUPOLE  0.6680      NaN             NaN         QD      -0.4999     16.0    4.25650
4   DRIFT       3.5805      NaN             NaN         D       NaN         NaN     6.38075
5   QUADRUPOLE  0.3420      NaN             NaN         QF      0.4900      16.0    8.34200

3. Adding definitions

4. test 5.