georges.manzoni package#
Subpackages#
- georges.manzoni.elements package
- Submodules
- georges.manzoni.elements.cavities module
- georges.manzoni.elements.collimators module
- georges.manzoni.elements.electrostatic module
- georges.manzoni.elements.elements module
ManzoniException
ManzoniAttributeException
ElementType
Element
ManzoniElement
ManzoniElement.INTEGRATOR
ManzoniElement.propagate()
ManzoniElement.check_aperture()
ManzoniElement.freeze()
ManzoniElement.unfreeze()
ManzoniElement.frozen
ManzoniElement.unfrozen
ManzoniElement.integrator
ManzoniElement.parameters
ManzoniElement.PARAMETERS
ManzoniElement.aperture
ManzoniElement.clear_cache()
ManzoniElement.cache
- georges.manzoni.elements.magnets module
- georges.manzoni.elements.scatterers module
- Module contents
- georges.manzoni.maps package
- Submodules
- georges.manzoni.maps.mad8_combined_dipole module
- georges.manzoni.maps.mad8_drift module
- georges.manzoni.maps.mad8_quadrupole module
- georges.manzoni.maps.madx_combined_dipole module
- georges.manzoni.maps.madx_thick module
- georges.manzoni.maps.transport_combined_dipole module
- georges.manzoni.maps.transport_combined_dipole_ex module
- georges.manzoni.maps.transport_drift module
- georges.manzoni.maps.transport_fringe_in module
- georges.manzoni.maps.transport_fringe_in_ex module
- georges.manzoni.maps.transport_fringe_out module
- georges.manzoni.maps.transport_fringe_out_ex module
- georges.manzoni.maps.transport_multipole module
- georges.manzoni.maps.transport_multipole_ex module
- georges.manzoni.maps.transport_quadrupole module
- georges.manzoni.maps.transport_quadrupole_ex module
- georges.manzoni.maps.transport_sextupole module
- georges.manzoni.maps.transport_sextupole_ex module
- Module contents
Submodules#
georges.manzoni.apertures module#
The file apertures.py is for the collimator elements and contains the implementation of the selection of the particle according to the type of collimator (circular, elliptical, rectangular or phase-space).
- georges.manzoni.apertures.circular_aperture_check(b1, kargs: ndarray)[source]#
The aperture is circular and defined by its radius.
- Parameters:
b1 – The beam before the collimator
kargs – Radius of the aperture.
- Returns:
The collimated beam
- georges.manzoni.apertures.elliptical_aperture_check(b1, kargs: ndarray)[source]#
The aperture is elliptical and defined by the semi-axes of the elliptical aperture.
- Parameters:
b1 – The beam before the collimator
kargs – Semi-axes of the aperture.
- Returns:
The collimated beam
- georges.manzoni.apertures.rectangular_aperture_check(b1, kargs: ndarray)[source]#
The aperture is rectangular and defined by its horizontal and vertical half apertures.
- Parameters:
b1 – The beam before the collimator
kargs – horizontal and vertical half apertures
- Returns:
The collimated beam
- georges.manzoni.apertures.phase_space_aperture_check(b1, kargs: ndarray)[source]#
The phase space aperture allows the user to cut either the position or the momentum of the beam.
- Parameters:
b1 – The beam before the collimator
kargs – Radius of the aperture in each coordinates system (position and momentum).
- Returns:
The collimated beam
georges.manzoni.beam module#
The file Beam.py contains the implementation of the class beam for the tracking with Manzoni. A beam definition requires distribution and kinematics to allow the generation of the initial particles for tracking.
- class georges.manzoni.beam.Beam(kinematics: Kinematics, distribution: ndarray)[source]#
Bases:
object
- classmethod compute_pt(dpp: ndarray, beta: float, first_order: bool = False) ndarray [source]#
- Parameters:
dpp –
beta – the relativistic beta
first_order – approximate p_t from dpp at first order (valid only for beta close to 1)
Returns:
- classmethod compute_dpp(pt: ndarray, beta: float, first_order: bool = False) ndarray [source]#
- Parameters:
pt –
beta – the relativistic beta
first_order – approximate dpp from p_t at first order (valid only for beta close to 1)
Returns:
- property kinematics: Kinematics#
- property distribution: ndarray#
georges.manzoni.core module#
The beam propagation from one element to another in the beamline is implemented in the file core.py. The track function contains the loop over the different elements, with optionally the check of the apertures to select the particles that survive the tracking at the end of each element, and the use of “observers” if defined by the user, to save the data during the tracking. The file core.py also contains a Twiss function, which allows the calculation of the matrix elements of all the elements along a given beamline for the Twiss functions calculation based on the 11 particles method. The user must be aware that this function also needs the georges_core module to work properly, as the Twiss computation is done in the end in the georges_core library, using the matrix elements calculated in georges.
- georges.manzoni.core.track(beamline: _Input, beam: _Beam, observers: List[_Observer | None] = None, check_apertures_exit: bool = False, check_apertures_entry: bool = False)[source]#
- Parameters:
beamline –
beam –
observers –
check_apertures_exit –
check_apertures_entry –
Returns:
- georges.manzoni.core.twiss(beamline: _Input, kinematics: _Kinematics, reference_particle: _np.ndarray = None, offsets=None, twiss_parametrization: bool = True, twiss_init: _BetaBlock = None, with_phase_unrolling: bool = True) _pd.DataFrame [source]#
- Parameters:
beamline –
kinematics –
reference_particle –
offsets –
twiss_parametrization –
twiss_init –
with_phase_unrolling –
Returns:
georges.manzoni.input module#
The file input.py contains the main class that needs instantiated to build a Manzoni input. It requires at least a beamline Sequence and a Beam instance to allow the tracking. Once instantiated, the Input class has a track function, which is just a wrapper on the track function of the file core.py, and can be directly called to perform the tracking through the beamline. There are also a couple of useful functions to freeze, unfreeze, set or get the parameters of a given element of the sequence. Finally, the “adjust_energy” function is important to calculate all the initial kinetic energies of all the scatterers and degraders of the beamline, starting from the initial kinetic energy of the beam. It is necessary to correct the particles’ propagation through these elements during the tracking.
- class georges.manzoni.input.Input(sequence: List[ManzoniElement] | None = None, beam: Beam | None = None, mapper: Dict[str, int] | None = None)[source]#
Bases:
object
- property sequence#
- property beam#
- property df#
- freeze()[source]#
Freezes all elements in the input sequence.
- Returns:
self to allow method chaining
- unfreeze()[source]#
Unfreezes all elements in the input sequence.
- Returns:
self to allow method chaining
- track(beam: Beam, observers: List[Observer] | Observer | None = None, check_apertures: bool = True) List[Observer] | Observer [source]#
- Parameters:
beam –
observers –
check_apertures –
- Returns:
the Observer object containing the tracking results.
- twiss(kinematics: Kinematics, reference_particle: ndarray | None = None, offsets=None, twiss_parametrization: bool = True, twiss_init: BetaBlock | None = None) DataFrame [source]#
- Parameters:
kinematics –
reference_particle –
offsets –
twiss_parametrization –
twiss_init –
- Returns:
The dataframe with the Twiss functions at each element.
- set_integrator(integrator: ~georges.manzoni.integrators.Integrator = <class 'georges.manzoni.integrators.MadXIntegrator'>)[source]#
- classmethod insert_thin_element(sequence: Input | None = None, position: int = 0, thin_element: ManzoniElement | None = None) Input [source]#
Insert a thin element (e.g fringes) in the sequence.
- Parameters:
sequence – the manzoni sequence
position – index of the position to insert in the sequence
thin_element – element to insert
- Returns:
A new instance of manzoni.Input
georges.manzoni.integrators module#
The file integrators.py contains the definition of all the integrator types, with a propagate function that is a wrapper to the propagate function of each of the different elements in the beamline. Each integrator has a dictionary with the different elements it can be used with, so that if this integrator is selected, the propagate function of the element will be called via the propagate function of the integrator to allow the tracking.
- class georges.manzoni.integrators.MadXIntegrator[source]#
Bases:
Integrator
- METHODS = {'CIRCULARCOLLIMATOR': CPUDispatcher(<function track_madx_drift>), 'DIPEDGE': CPUDispatcher(<function track_madx_dipedge>), 'DRIFT': CPUDispatcher(<function track_madx_drift>), 'DUMP': CPUDispatcher(<function track_madx_drift>), 'ELLIPTICALCOLLIMATOR': CPUDispatcher(<function track_madx_drift>), 'GAP': CPUDispatcher(<function track_madx_drift>), 'HKICKER': CPUDispatcher(<function track_madx_kicker>), 'KICKER': CPUDispatcher(<function track_madx_kicker>), 'QUADRUPOLE': CPUDispatcher(<function track_madx_quadrupole>), 'RBEND': CPUDispatcher(<function track_madx_bend>), 'RECTANGULARCOLLIMATOR': CPUDispatcher(<function track_madx_drift>), 'SBEND': CPUDispatcher(<function track_madx_bend>), 'SROTATION': CPUDispatcher(<function track_madx_srotation>), 'VKICKER': CPUDispatcher(<function track_madx_kicker>)}#
- class georges.manzoni.integrators.MadXParaxialDriftIntegrator[source]#
Bases:
MadXIntegrator
- METHODS = {'CIRCULARCOLLIMATOR': CPUDispatcher(<function track_madx_drift_paraxial>), 'DIPEDGE': CPUDispatcher(<function track_madx_dipedge>), 'DRIFT': CPUDispatcher(<function track_madx_drift_paraxial>), 'DUMP': CPUDispatcher(<function track_madx_drift_paraxial>), 'ELLIPTICALCOLLIMATOR': CPUDispatcher(<function track_madx_drift_paraxial>), 'HKICKER': CPUDispatcher(<function track_madx_kicker>), 'KICKER': CPUDispatcher(<function track_madx_kicker>), 'QUADRUPOLE': CPUDispatcher(<function track_madx_quadrupole>), 'RBEND': CPUDispatcher(<function track_madx_bend>), 'RECTANGULARCOLLIMATOR': CPUDispatcher(<function track_madx_drift_paraxial>), 'SBEND': CPUDispatcher(<function track_madx_bend>), 'SROTATION': CPUDispatcher(<function track_madx_srotation>), 'VKICKER': CPUDispatcher(<function track_madx_kicker>)}#
- class georges.manzoni.integrators.Mad8Integrator[source]#
Bases:
Integrator
- class georges.manzoni.integrators.Mad8FirstOrderTaylorIntegrator[source]#
Bases:
Mad8Integrator
- MATRICES = {'BEND': CPUDispatcher(<function compute_mad_combined_dipole_matrix>), 'DRIFT': CPUDispatcher(<function compute_mad_drift_matrix>), 'QUADRUPOLE': CPUDispatcher(<function compute_mad_quadrupole_matrix>), 'SBEND': CPUDispatcher(<function compute_mad_combined_dipole_matrix>)}#
- class georges.manzoni.integrators.Mad8SecondOrderTaylorIntegrator[source]#
Bases:
Mad8FirstOrderTaylorIntegrator
- TENSORS = {'BEND': CPUDispatcher(<function compute_mad_combined_dipole_tensor>), 'DRIFT': CPUDispatcher(<function compute_mad_drift_tensor>), 'QUADRUPOLE': CPUDispatcher(<function compute_mad_quadrupole_tensor>), 'SBEND': CPUDispatcher(<function compute_mad_combined_dipole_tensor>)}#
- class georges.manzoni.integrators.TransportIntegrator[source]#
Bases:
Integrator
- class georges.manzoni.integrators.TransportFirstOrderTaylorIntegrator[source]#
Bases:
TransportIntegrator
- MATRICES = {'BEND': CPUDispatcher(<function compute_transport_combined_dipole_matrix>), 'FRINGEIN': CPUDispatcher(<function compute_transport_fringe_in_matrix>), 'FRINGEOUT': CPUDispatcher(<function compute_transport_fringe_out_matrix>), 'MULTIPOLE': CPUDispatcher(<function compute_transport_multipole_matrix>), 'QUADRUPOLE': CPUDispatcher(<function compute_transport_quadrupole_matrix>), 'SBEND': CPUDispatcher(<function compute_transport_combined_dipole_matrix>), 'SEXTUPOLE': CPUDispatcher(<function compute_transport_sextupole_matrix>)}#
- class georges.manzoni.integrators.TransportFirstOrderTaylorIntegratorExact[source]#
Bases:
TransportIntegrator
- MATRICES = {'BEND': CPUDispatcher(<function compute_transport_combined_dipole_ex_matrix>), 'FRINGEIN': CPUDispatcher(<function compute_transport_fringe_in_ex_matrix>), 'FRINGEOUT': CPUDispatcher(<function compute_transport_fringe_out_ex_matrix>), 'MULTIPOLE': CPUDispatcher(<function compute_transport_multipole_ex_matrix>), 'QUADRUPOLE': CPUDispatcher(<function compute_transport_quadrupole_ex_matrix>), 'SBEND': CPUDispatcher(<function compute_transport_combined_dipole_ex_matrix>), 'SEXTUPOLE': CPUDispatcher(<function compute_transport_sextupole_ex_matrix>)}#
- class georges.manzoni.integrators.TransportSecondOrderTaylorIntegrator[source]#
Bases:
TransportFirstOrderTaylorIntegrator
- TENSORS = {'BEND': CPUDispatcher(<function compute_transport_combined_dipole_tensor>), 'FRINGEIN': CPUDispatcher(<function compute_transport_fringe_in_tensor>), 'FRINGEOUT': CPUDispatcher(<function compute_transport_fringe_out_tensor>), 'MULTIPOLE': CPUDispatcher(<function compute_transport_multipole_tensor>), 'QUADRUPOLE': CPUDispatcher(<function compute_transport_quadrupole_tensor>), 'SBEND': CPUDispatcher(<function compute_transport_combined_dipole_tensor>), 'SEXTUPOLE': CPUDispatcher(<function compute_transport_sextupole_tensor>)}#
- class georges.manzoni.integrators.TransportSecondOrderTaylorIntegratorExact[source]#
Bases:
TransportFirstOrderTaylorIntegratorExact
- TENSORS = {'BEND': CPUDispatcher(<function compute_transport_combined_dipole_ex_tensor>), 'FRINGEIN': CPUDispatcher(<function compute_transport_fringe_in_ex_tensor>), 'FRINGEOUT': CPUDispatcher(<function compute_transport_fringe_out_ex_tensor>), 'MULTIPOLE': CPUDispatcher(<function compute_transport_multipole_ex_tensor>), 'QUADRUPOLE': CPUDispatcher(<function compute_transport_quadrupole_ex_tensor>), 'SBEND': CPUDispatcher(<function compute_transport_combined_dipole_ex_tensor>), 'SEXTUPOLE': CPUDispatcher(<function compute_transport_sextupole_ex_tensor>)}#
- class georges.manzoni.integrators.PTCIntegrator[source]#
Bases:
Integrator
georges.manzoni.kernels module#
The file kernels.py contains the loops that are the core of the particles propagation based on their coordinates. Different batches are available, to allow a matrix (order 1) propagation, a tensor (order 2) propagation or a matrix followed by a tensor (orders 1+2) propagations.
- georges.manzoni.kernels.batched_vector_matrix(b1: ndarray, b2: ndarray, matrix: ndarray)[source]#
- Parameters:
b1 – a numpy array containing all the particles
b2 – explicit destination for the result
matrix – the transfer matrix as a numpy array
- Returns:
the destination (result) array
- georges.manzoni.kernels.batched_vector_tensor(b1: ndarray, b2: ndarray, tensor: ndarray)[source]#
- Parameters:
b1 –
b2 –
tensor –
Returns:
georges.manzoni.observers module#
- class georges.manzoni.observers.BeamObserver(elements: List[str] | None = None, with_input_beams: bool = False)[source]#
Bases:
Observer
Return the beam distribution at the exit of an element. Optionnaly, return the beam at the entrance of the element.
- class georges.manzoni.observers.SuperObserver(elements: List[str] | None = None)[source]#
Bases:
Observer
- class georges.manzoni.observers.MeanObserver(elements: List[str] | None = None)[source]#
Bases:
Observer
Compute the mean values of the beam coordinates.
- class georges.manzoni.observers.SigmaObserver(elements: List[str] | None = None)[source]#
Bases:
Observer
Compute the standard deviation of the beam coordinates.
- class georges.manzoni.observers.LossesObserver(elements: List[str] | None = None)[source]#
Bases:
Observer
Compute the losses and the transmission in an element.
- class georges.manzoni.observers.SymmetryObserver(elements: List[str] | None = None)[source]#
Bases:
Observer
Compute the symmetry of the beam.