Twiss module

This module allows to calculate the different parameters of Twiss as well as the dispersion based on a propagation matrix. It is possible either to compute the periodic Twiss function of a lattice or to compute the propagation of an initial BetaBlock. The standard uncoupled Twiss parametrization (including off-momentum effects, aka. dispersion) is the default option. Additional formalisms for the parametrization of fully coupled transfer matrices are also available (Parzen, Lebedev and Bogacz). More details about the coupled parametrizations can be found in this paper

Herebelow, there is some examples on how to use the Twiss module.

import os
import pandas as pd
import georges_core
from georges_core.units import ureg as _ureg
from georges_core.sequences import BetaBlock
from georges_core.twiss import Twiss
twiss_init = BetaBlock(BETA11 = 1*_ureg.m,
                       BETA22 = 2*_ureg.m)

tw = Twiss(twiss_init=twiss_init, with_phase_unrolling=False)
# Load a transfer matrix which can computed with MAD-X or Zgoubidoo.
results_twiss = tw(matrix=matrix)

You can now have acces to the Twiss functions along the line as well as the dispersion:

print(results_twiss)
                 R11       R12  R13  R14  R15       R16       R21       R22  \
NAME                                                                          
RING$START  0.653840  3.064809    0    0    0  0.419714 -0.080063  1.154138   
MQF1        0.212111  3.205167    0    0    0  0.473953 -0.206385  1.595868   
D1          0.108918  3.948641    0    0    0  0.670108 -0.206385  1.699060   
MQD         1.185141  4.107119    0    0    0  0.759262 -0.063755  0.622838   
D2          1.172390  3.997208    0    0    0  0.798868 -0.063755  0.635589   
BD          1.090919  3.077186    0    0    0  0.283823 -0.070761  0.717059   
D3          1.076767  3.005244    0    0    0  0.340444 -0.070761  0.731212   
MQF2        0.661847  3.015579    0    0    0  0.386506 -0.080063  1.146132   
D4          0.653840  3.064809    0    0    0  0.419714 -0.080063  1.154138   
RING$END    0.653840  3.064809    0    0    0  0.419714 -0.080063  1.154138   

            R23  R24  ...   GAMMA11   GAMMA22       MU1       MU2  DET1  DET2  \
NAME                  ...                                                       
RING$START    0    0  ...  1.338446  0.231914  1.360609  1.042639   1.0   1.0   
MQF1          0    0  ...  2.589389  0.083334  1.504715  0.852012   1.0   1.0   
D1            0    0  ...  2.929401  0.101987  1.543220  0.776828   1.0   1.0   
MQD           0    0  ...  0.391991  0.606416  1.289870  1.102309   1.0   1.0   
D2            0    0  ...  0.408037  0.617991  1.285496  1.116647   1.0   1.0   
BD            0    0  ...  0.519181  0.739811  1.230102  1.256677   1.0   1.0   
D3            0    0  ...  0.539678  0.752600  1.226750  1.269476   1.0   1.0   
MQF2          0    0  ...  1.320029  0.228644  1.354746  1.046370   1.0   1.0   
D4            0    0  ...  1.338446  0.231914  1.360609  1.042639   1.0   1.0   
RING$END      0    0  ...  1.338446  0.231914  1.360609  1.042639   1.0   1.0   

               DISP1     DISP2  DISP3  DISP4  
NAME                                          
RING$START  0.419714  0.332089    0.0    0.0  
MQF1        0.473953  0.392310    0.0    0.0  
D1          0.670108  0.392310    0.0    0.0  
MQD         0.759262  0.198032    0.0    0.0  
D2          0.798868  0.198032    0.0    0.0  
BD          0.283823  0.283103    0.0    0.0  
D3          0.340444  0.283103    0.0    0.0  
MQF2        0.386506  0.332089    0.0    0.0  
D4          0.419714  0.332089    0.0    0.0  
RING$END    0.419714  0.332089    0.0    0.0  

[10 rows x 50 columns]