Conversion of a sequence

Georges-core can convert different output files into an object of type sequence. As an example, the user can provide an output file from: * MAD-X * MAD-NG * TRANSPORT * BDSIM * CSV File (SURVEY)

import os
import georges_core
from georges_core.units import ureg as _ureg

Load a Twiss file

From MAD-X

madx_line = georges_core.sequences.TwissSequence(path=path, filename="twiss_madx.tfs", with_units=True, with_beam=True, nparticles=100)

From MAD-NG

As the particle is not (yet) written in the header os the Twiss file, you must define the particle name and its kinematics for MAD-G Twiss file. Moreover, you have to specify the lines to skip when you read the Twiss file.

kin = georges_core.Kinematics(140 * _ureg.MeV)
mad_line = georges_core.sequences.TwissSequence(
path=path, filename="twiss_madng.tfs", with_units=True, lines=34, with_beam=False, kinematics=kin)

Load a Transport file

2 flavors are available:
  • TransportInputIBAFlavor: from Transport file generated by IBA

  • TransportInputOriginalFlavor: original Transport file

transport_line = georges_core.sequences.TransportSequence(path=path, filename="calc.bml", flavor=georges_core.codes_io.transport.TransportInputIBAFlavor)

Load a CSV file (survey file)

A survey file is a .csv file containing the elements’ information as the NAME or the TYPE of the element. The user can provide a survey in a global reference frame (X, Y, Z) or in a Frenet-Serret (S, L)

survey_line = georges_core.sequences.SurveySequence(path=path, filename="survey.csv", kinematics=kin)
survey_line.expand();  # This must be done before track !

Load a BDSIM output file

bdsim_line = georges_core.sequences.BDSIMSequence(path=path, filename="bdsim_output.root")
beam = bdsim_line.metadata.data["BEAM_DISTRIBUTION"]

Note

Pybdsim must be installed to use this feature.