Accelerators¶
pymadng_utils.accelerators contains the machine descriptors consumed by the MAD-facing interfaces.
Overview¶
Acceleratordefines the minimum contract needed by MAD helpers: sequence file, sequence name, beam parameters, BPM pattern, and tune metadata.LHC,PSBandFCCprovide concrete machine descriptors used by the tests and model-creation workflows.Accelerators can optionally expose perturbation-family metadata and startup-error hooks for interfaces that support those workflows.
Package exports¶
Accelerator, LHC, PSB, FCC and the mass and energy constants are re-exported here from the submodules below,
which hold their canonical documentation.
Accelerator descriptors used by MAD-facing helpers.
Base descriptor¶
Minimal accelerator definitions for MAD-facing helpers.
- class pymadng_utils.accelerators.base.Accelerator(sequence_file, kinetic_energy, bpm_pattern='BPM', particle='proton', **kwargs)[source]¶
Bases:
ABCMachine descriptor consumed by the MAD-NG interfaces.
Holds the sequence path, MAD sequence name, beam energy, BPM pattern, tune knobs and integer tunes, and the AC-dipole element name.
- Parameters:
- RBARC = False¶
MAD-X
rbarcoption used when loading the sequence (rbend length is the straight chord if True).
- NOCHARGE = False¶
Set MAD-NG’s
option.nochargebefore the beam is created.
- seq_dir = 1¶
-1 runs the loaded sequence backwards.
- Type:
MAD-NG
sequence.dir
- abstract property seq_name: str¶
Return the sequence name for this accelerator.
- Returns:
Sequence name to use in MAD
- kicker_marker_name(kicker_name)[source]¶
Return the measured initial-condition marker name for kicker tracking.
- kicker_cycle_marker_name(kicker_name)[source]¶
Return the unobserved centre marker used to cycle kicker-mode tracking.
- apply_accelerator_specific_errors(mad_iface)[source]¶
Apply machine-specific startup errors to a loaded MAD sequence.
- Parameters:
mad_iface (Any)
- Return type:
None
LHC descriptor¶
LHC-specific accelerator implementation.
- class pymadng_utils.accelerators.lhc.LHC(beam, sequence_file, kinetic_energy=6800.0, bpm_pattern='^BPM.*$', particle='proton', tune_knobs_suffix='_op', seq_dir=None, **kwargs)[source]¶
Bases:
AcceleratorLarge Hadron Collider accelerator configuration.
Holds the beam number, sequence direction, BPM pattern, operational tune knobs (
dqx_b<beam><suffix>) and the integer tunes (62, 60).Initialise LHC accelerator for a specific beam.
- Parameters:
beam (int) – Beam number (1 or 2)
sequence_file (Path | str) – Path to sequence file
kinetic_energy (float) – Particle kinetic energy in GeV (default 6800 GeV for LHC)
bpm_pattern (str) – Pattern for selecting BPMs
particle (str) – Type of particle (default “proton”)
tune_knobs_suffix (str) – Suffix of the MAD-X tune knobs
dqx_b<beam>/dqy_b<beam>seq_dir (int | None) – MAD-NG sequence direction. Required for beam 2: -1 for the MAD-X beam-2 sequence (listed in beam-1 order), 1 for the beam-4 tracking sequence (also named
lhcb2). Defaults to 1 for beam 1.
- Raises:
ValueError – If an invalid beam number is provided
- BPM_PATTERN = '^BPM.*$'¶
PSB descriptor¶
PSB-specific accelerator implementation.
- class pymadng_utils.accelerators.psb.PSB(sequence_file, ring=None, kinetic_energy=0.16, bpm_pattern=None, particle='proton', **kwargs)[source]¶
Bases:
AcceleratorProton Synchrotron Booster accelerator configuration.
- Parameters:
- BPM_PATTERN_TEMPLATE = '^BR{ring}%.BPM.*{ring}$'¶
- SEXTUPOLE_PATTERN = '^BR%d+%.XNO.*'¶
FCC-ee descriptor¶
FCC-ee accelerator implementation (LCC lattice, single ring).
- pymadng_utils.accelerators.fcc.FCC_ENERGY_GEV = {'h': 120.0, 't': 182.5, 'w': 80.0, 'z': 45.6}¶
Total beam energy per FCC-ee mode, GeV.
- pymadng_utils.accelerators.fcc.FCC_Z_TUNE_INTEGERS = (166, 162)¶
Integer tunes of the LCC_107 Z lattice (166.16, 162.20).
- class pymadng_utils.accelerators.fcc.FCC(sequence_file, kinetic_energy=None, bpm_pattern='^BPM_.*$', particle='electron', mode='z', **kwargs)[source]¶
Bases:
AcceleratorFCC-ee (LCC optics) accelerator configuration.
The LCC lattices are a single ring (
fccee_p_ring) with lower-case element names: BPMsbpm_<quad>, quadrupolesq*, and paired correctorshcor_<quad>/vcor_<quad>(MAD-Xkickerwithhkick/vkick). MAD-NG upper-cases element names when loading the madx, so the Lua patterns here are upper case (MAD-X variables stay lower case).Initialise the FCC-ee accelerator.
- Parameters:
sequence_file (Path | str) – Path to the MAD-X sequence file (e.g.
fccee_z.madx)kinetic_energy (float | None) – Particle kinetic energy in GeV (default: the mode’s beam energy minus the particle mass)
bpm_pattern (str) – Pattern for selecting BPMs
particle (str) – Type of particle (default “electron”; MAD-NG runs with
nochargeas the madx ignores the charge)mode (str) – FCC-ee running mode, one of
z,w,h,t
- Raises:
ValueError – If an unknown mode is given
- SEQUENCE_NAME = 'fccee_p_ring'¶
- BPM_PATTERN = '^BPM_.*$'¶
- CORRECTOR_PATTERN = '^[HV]COR_'¶
- QUAD_REL_STD = 0.005¶
Relative k1 calibration error used for the FCC-ee LOCO studies.
- RBARC = True¶
The LCC madx is written for MAD-X’s default rbarc=true (rbend l is the chord).
- NOCHARGE = True¶
Ignore the beam charge like MAD-X does (otherwise an electron flips every magnet strength).