georges_core.sequences package

Submodules

georges_core.sequences.betablock module

TODO

class georges_core.sequences.betablock.BetaBlockType[source]

Bases: type

TODO

class georges_core.sequences.betablock.BetaBlock(BETA11: ~pint.Quantity = <Quantity(1.0, 'meter')>, ALPHA11: float = 0.0, GAMMA11: float | None = None, BETA22: ~pint.Quantity = <Quantity(1.0, 'meter')>, ALPHA22: float = 0.0, GAMMA22: float | None = None, BETA12: float = <Quantity(0.0, 'meter')>, BETA21: float = <Quantity(0.0, 'meter')>, ALPHA12: float = 0.0, ALPHA21: float = 0.0, DISP1: ~pint.Quantity = <Quantity(0.0, 'meter')>, DISP2: float = 0.0, DISP3: ~pint.Quantity = <Quantity(0.0, 'meter')>, DISP4: float = 0.0, EMIT1: ~pint.Quantity = <Quantity(1e-09, 'meter * radian')>, EMIT2: ~pint.Quantity = <Quantity(1e-09, 'meter * radian')>, EMIT3: float = 1e-09, MU1: float = 0.0, MU2: float = 0.0, NU1: float = 0.0, NU2: float = 0.0, CMU1: float = 1.0, CMU2: float = 1.0, DY: float = 0.0, DX: float = 0.0, DYP: float = 0.0, DXP: float = 0.0, DZ: float = 0.0, DZP: float = 0.0, U: float = 0.0, R: ~numpy.ndarray = array([[1., 0., 0., 0.],        [0., 1., 0., 0.],        [0., 0., 1., 0.],        [0., 0., 0., 1.]]))[source]

Bases: object

TODO

BETA11: Quantity = <Quantity(1.0, 'meter')>
ALPHA11: float = 0.0
GAMMA11: float | None = None
BETA22: Quantity = <Quantity(1.0, 'meter')>
ALPHA22: float = 0.0
GAMMA22: float | None = None
BETA12: float = <Quantity(0.0, 'meter')>
BETA21: float = <Quantity(0.0, 'meter')>
ALPHA12: float = 0.0
ALPHA21: float = 0.0
DISP1: Quantity = <Quantity(0.0, 'meter')>
DISP2: float = 0.0
DISP3: Quantity = <Quantity(0.0, 'meter')>
DISP4: float = 0.0
EMIT1: Quantity = <Quantity(1e-09, 'meter * radian')>
EMIT2: Quantity = <Quantity(1e-09, 'meter * radian')>
EMIT3: float = 1e-09
MU1: float = 0.0
MU2: float = 0.0
NU1: float = 0.0
NU2: float = 0.0
CMU1: float = 1.0
CMU2: float = 1.0
DY: float = 0.0
DX: float = 0.0
DYP: float = 0.0
DXP: float = 0.0
DZ: float = 0.0
DZP: float = 0.0
U: float = 0.0
R: ndarray = array([[1., 0., 0., 0.],        [0., 1., 0., 0.],        [0., 0., 1., 0.],        [0., 0., 0., 1.]])
to_df() Series[source]
property df: Series

georges_core.sequences.elements module

TODO

class georges_core.sequences.elements.ElementClass(name: str, bases: type | Tuple[type] | None = None, dct: Dict[str, Any] | None = None, **kwargs)[source]

Bases: ABCMeta

TODO

class georges_core.sequences.elements.Element(name: str | None = None, **kwargs: Any)[source]

Bases: UserDict

TODO

parameters = {}
metaclass

alias of ElementClass

__getattr__(k: str) Any[source]

Provides attribute-like access to the dictionary elements.

classmethod make_subclass(name: str, bases: type | Tuple[type] | None = None, dct: Dict[str, Any] | None = None, **kwargs: Any) Type[ElementClass][source]
Parameters:
  • name

  • bases

  • dct

  • **kwargs

Returns:

classmethod subclass(name: str, bases: type | Tuple[type] | None = None, dct: Dict[str, Any] | None = None, **kwargs: Any) Type[ElementClass]
Parameters:
  • name

  • bases

  • dct

  • **kwargs

Returns:

class Bend(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of BendClass

parameters = {'KEYWORD': 'BEND'}
class Cavity(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of CavityClass

parameters = {'KEYWORD': 'CAVITY'}
class CircularCollimator(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of CircularCollimatorClass

parameters = {'KEYWORD': 'CIRCULARCOLLIMATOR'}
class Decapole(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of DecapoleClass

parameters = {'KEYWORD': 'DECAPOLE'}
class Degrader(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of DegraderClass

parameters = {'KEYWORD': 'DEGRADER'}
class Dipole(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of DipoleClass

parameters = {'KEYWORD': 'DIPOLE'}
class Drift(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of DriftClass

parameters = {'KEYWORD': 'DRIFT'}
class EllipticalCollimator(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of EllipticalCollimatorClass

parameters = {'KEYWORD': 'ELLIPTICALCOLLIMATOR'}
class Face(name: str | None = None, **kwargs: Any)

Bases: Element

E1 = <Quantity(0.0, 'degree')>
L = <Quantity(0.0, 'meter')>
metaclass

alias of FaceClass

parameters = {'E1': <Quantity(0.0, 'degree')>, 'KEYWORD': 'FACE', 'L': <Quantity(0.0, 'meter')>}
class Fringein(name: str | None = None, **kwargs: Any)

Bases: Element

TILT = <Quantity(0.0, 'radian')>
metaclass

alias of FringeinClass

parameters = {'KEYWORD': 'FRINGEIN', 'TILT': <Quantity(0.0, 'radian')>}
class Fringeout(name: str | None = None, **kwargs: Any)

Bases: Element

TILT = <Quantity(0.0, 'radian')>
metaclass

alias of FringeoutClass

parameters = {'KEYWORD': 'FRINGEOUT', 'TILT': <Quantity(0.0, 'radian')>}
class HKicker(name: str | None = None, **kwargs: Any)

Bases: Element

KICK = <Quantity(0.0, 'radian')>
L = <Quantity(0.0, 'meter')>
TILT = <Quantity(0.0, 'radian')>
metaclass

alias of HKickerClass

parameters = {'KEYWORD': 'HKICKER', 'KICK': <Quantity(0.0, 'radian')>, 'L': <Quantity(0.0, 'meter')>, 'TILT': <Quantity(0.0, 'radian')>}
class Instrument(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of InstrumentClass

parameters = {'KEYWORD': 'INSTRUMENT'}
class Marker(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of MarkerClass

parameters = {'KEYWORD': 'MARKER'}
class Multipole(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of MultipoleClass

parameters = {'KEYWORD': 'MULTIPOLE'}
class Octupole(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of OctupoleClass

parameters = {'KEYWORD': 'OCTUPOLE'}
class Quadrupole(name: str | None = None, **kwargs: Any)

Bases: Element

E1 = <Quantity(0.0, 'radian')>
E2 = <Quantity(0.0, 'radian')>
K1 = <Quantity(0.0, '1 / meter ** 2')>
K1L = <Quantity(0.0, '1 / meter')>
TILT = <Quantity(0.0, 'radian')>
metaclass

alias of QuadrupoleClass

parameters = {'E1': <Quantity(0.0, 'radian')>, 'E2': <Quantity(0.0, 'radian')>, 'K1': <Quantity(0.0, '1 / meter ** 2')>, 'K1L': <Quantity(0.0, '1 / meter')>, 'KEYWORD': 'QUADRUPOLE', 'TILT': <Quantity(0.0, 'radian')>}
class RBend(name: str | None = None, **kwargs: Any)

Bases: Element

TILT = <Quantity(0.0, 'radian')>
metaclass

alias of RBendClass

parameters = {'KEYWORD': 'RBEND', 'TILT': <Quantity(0.0, 'radian')>}
class RectangularCollimator(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of RectangularCollimatorClass

parameters = {'KEYWORD': 'RECTANGULARCOLLIMATOR'}
class SBend(name: str | None = None, **kwargs: Any)

Bases: Element

ANGLE = <Quantity(0.0, 'radian')>
E1 = <Quantity(0.0, 'radian')>
E2 = <Quantity(0.0, 'radian')>
TILT = <Quantity(0.0, 'radian')>
metaclass

alias of SBendClass

parameters = {'ANGLE': <Quantity(0.0, 'radian')>, 'E1': <Quantity(0.0, 'radian')>, 'E2': <Quantity(0.0, 'radian')>, 'KEYWORD': 'SBEND', 'TILT': <Quantity(0.0, 'radian')>}
class SRotation(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of SRotationClass

parameters = {'KEYWORD': 'SROTATION'}
class Scatterer(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of ScattererClass

parameters = {'KEYWORD': 'SCATTERER'}
class Sextupole(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of SextupoleClass

parameters = {'KEYWORD': 'SEXTUPOLE'}
class Solenoid(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of SolenoidClass

parameters = {'KEYWORD': 'SOLENOID'}
class Steerer(name: str | None = None, **kwargs: Any)

Bases: Element

metaclass

alias of SteererClass

parameters = {'KEYWORD': 'STEERER'}
class VKicker(name: str | None = None, **kwargs: Any)

Bases: Element

KICK = <Quantity(0.0, 'radian')>
L = <Quantity(0.0, 'meter')>
TILT = <Quantity(0.0, 'radian')>
metaclass

alias of VKickerClass

parameters = {'KEYWORD': 'VKICKER', 'KICK': <Quantity(0.0, 'radian')>, 'L': <Quantity(0.0, 'meter')>, 'TILT': <Quantity(0.0, 'radian')>}

georges_core.sequences.sequence module

High-level interface for Zgoubi or Manzoni using sequences.

exception georges_core.sequences.sequence.SequenceException(m: str = '')[source]

Bases: Exception

Exception raised for errors when using zgoubidoo.Sequence

class georges_core.sequences.sequence.SequenceMetadata(data: _pd.Series = None, kinematics: Optional[_Kinematics] = None, particle: _ParticuleType = <class 'georges_core.particles.Proton'>, n_particles: int = 1, betablock: Optional[_BetaBlock] = None)[source]

Bases: object

TODO

data: _pd.Series = None
kinematics: _Kinematics | None = None
particle

alias of Proton

n_particles: int = 1
betablock: _BetaBlock | None = None
class georges_core.sequences.sequence.Sequence(name: str = '', data: Any | None = None, metadata: SequenceMetadata | None = None, element_keys: Mapping[str, str] | None = None)[source]

Bases: object

Sequence.

Parameters:
  • name – the name of the physics

  • data

  • metadata

  • element_keys

property name: str

Provides the name of the sequence.

property metadata: SequenceMetadata

Provides the metadata associated with the sequence.

property kinematics: Kinematics | None

Provides the kinematics data associated with the sequence metadata.

property particle: _ParticuleType

Provides the particle type associated with the sequence metadata.

property betablock: BetaBlock | None

Provide the BetaBlock associated with the sequence.

set_parameters(element: str, parameters: Dict[str, Dict[str, float]]) None[source]
set_position(elements: str, value: Quantity) None[source]

Set a new position of the center for an element. The parameter at_entry and at_exit are re-computed. :param elements: :param value:

Returns:

get_parameters(element: str, parameters: List[str]) Dict[str, Any][source]
get_value(elements: List[str]) Any[source]
to_df(df: DataFrame | None = None, strip_units: bool = False) DataFrame[source]

TODO

property df: DataFrame

TODO

apply(func: Any, axis: int = 0) Any[source]
Parameters:
  • func

  • axis

Returns:

static from_madx_twiss(filename: str = 'twiss.outx', path: str = '.', kinematics: Kinematics | None = None, lines: int | None = None, with_units: bool = True, from_element: str | None | int = None, to_element: str | None | int = None, element_keys: Mapping[str, str] | None = None) Sequence[source]

TODO

Parameters:
  • element_keys

  • lines

  • kinematics – Kinematics of the line

  • with_units

  • filename – name of the Twiss table file

  • path – path to the Twiss table file

  • from_element

  • to_element

Returns:

Examples

TODO

static from_transport(filename: str = 'transport.txt', path: str = '.') TransportSequence[source]

TODO

Parameters:
  • filename

  • path

Returns:

static from_survey(filename: str = 'survey.csv', path: str = '.', kinematics: Kinematics | None = None, **kwargs: Any) SurveySequence[source]

TODO

Returns:

static from_bdsim(filename: str = 'output.root', path: str = '.') BDSIMSequence[source]

TODO

Returns:

class georges_core.sequences.sequence.PlacementSequence(name: str = '', data: List[Tuple[Element, Quantity, Quantity, Quantity]] | None = None, metadata: SequenceMetadata | None = None, reference_placement: str = 'ENTRY', element_keys: Mapping[str, str] | None = None)[source]

Bases: Sequence

Placement Sequence.

Parameters:
  • name – the name of the physics

  • data – the list of commands composing the physics

  • metadata

  • reference_placement

  • element_keys

property expanded: bool
property betablock: BetaBlock | None

Provide the BetaBlock associated with the sequence.

add(element_or_sequence: Element | Sequence) None[source]
Parameters:

element_or_sequence

Returns:

place(element_or_sequence: Element | Sequence, at: Quantity | None = None, at_entry: Quantity | None = None, at_center: Quantity | None = None, at_exit: Quantity | None = None, after: str | None = None, before: str | None = None) PlacementSequence[source]
Parameters:
  • element_or_sequence

  • at

  • at_center

  • at_entry

  • at_exit

  • after

  • before

Returns:

place_after_last(element_or_sequence: Element | Sequence, at: Quantity | None = None, at_entry: Quantity | None = None, at_center: Quantity | None = None, at_exit: Quantity | None = None) PlacementSequence[source]
Parameters:
  • element_or_sequence

  • at

  • at_center

  • at_entry

  • at_exit

Returns:

place_before_first(element_or_sequence: Element | Sequence, at: Quantity | None = None, at_entry: Quantity | None = None, at_center: Quantity | None = None, at_exit: Quantity | None = None) PlacementSequence[source]
Parameters:
  • element_or_sequence

  • at

  • at_center

  • at_entry

  • at_exit

Returns:

expand(drift_element: ~georges_core.sequences.elements.ElementClass = <class 'abc.Drift'>) PlacementSequence[source]

TODO Use namedtuples

Parameters:

drift_element

Returns:

reverse() PlacementSequence[source]

Returns:

sort(reverse: bool = False) PlacementSequence[source]
Parameters:

reverse

Returns:

join(other: Any) None[source]
to_df(df: DataFrame | None = None, strip_units: bool = False) DataFrame[source]
Parameters:
  • df

  • strip_units

Returns:

property df: DataFrame
Parameters:
  • df

  • strip_units

Returns:

class georges_core.sequences.sequence.TwissSequence(filename: str = 'twiss.outx', path: str = '.', *, kinematics: Kinematics | None = None, lines: int | None = None, with_units: bool = True, from_element: str | None | int = None, to_element: str | None | int = None, with_beam: bool = False, nparticles: int = 1, refer: str = 'center', element_keys: Mapping[str, str] | None = None)[source]

Bases: Sequence

TODO

Parameters:
  • filename – the name of the Twiss table

  • path – path to the Twiss table

  • lines – number of lines in the header (default: 47)

  • kinematics – kinematics of the particle. Must be specified for MAD-NG

  • with_units – Set units to columns

  • from_element – Name of the first element

  • to_element – Name of the last element

  • with_beam – Generate a Gaussian beam from Twiss parameters

  • nparticles – Number of particles in the beam (default 1)

  • refer – corresponding placement in MAD-X (entry, center, exit)

  • element_keys

static get_beta_block(twiss_headers: DataFrame, twiss_table: DataFrame) BetaBlock[source]

Returns: BetaBlock at the entrance of the line

to_df(df: DataFrame | None = None, strip_units: bool = False) DataFrame[source]

TODO

class georges_core.sequences.sequence.SurveySequence(filename: str, path: str = '.', from_element: str | None | int = None, to_element: str | None | int = None, kinematics: Kinematics | None = None, metadata: SequenceMetadata | None = None)[source]

Bases: PlacementSequence

Parameters:
  • filename – Name of the file, must be a csv.

  • path – Path to the file

  • kinematics – Kinematics of the particle

  • metadata – metadata of the sequence

to_df(df: DataFrame | None = None, strip_units: bool = False) DataFrame[source]
Parameters:
  • df

  • strip_units

Returns:

property df: DataFrame
Parameters:
  • df

  • strip_units

Returns:

class georges_core.sequences.sequence.TransportSequence(filename: str, path: str = '.', flavor: Type[TransportInputOriginalFlavor] = <class 'georges_core.codes_io.transport.TransportInputOriginalFlavor'>)[source]

Bases: Sequence

TODO

Parameters:
  • filename – the name of the physics

  • path

  • flavor

class TransportInputFlavor

Bases: object

class TransportInputOriginalFlavor

Bases: TransportInputFlavor

static process_element(ele: DataFrame, brho: Quantity, at_entry: float) DataFrame[source]
static process_face_angle(line: List[Any]) List[Any][source]
to_df(df: DataFrame | None = None, strip_units: bool = False) DataFrame[source]

TODO

property df: DataFrame

TODO

class georges_core.sequences.sequence.BDSIMSequence(filename: str = 'output.root', path: str = '.', from_element: str | None | int = None, to_element: str | None | int = None)[source]

Bases: Sequence

Parameters:
  • filename – the name of the physics

  • path

  • from_element

  • to_element

static set_units(model: DataFrame | None = None) None[source]
to_df(df: DataFrame | None = None, strip_units: bool = False) DataFrame[source]

TODO

Module contents

TODO