From 6233924f1298575a7b6faf31f2e10ba1c1d542a8 Mon Sep 17 00:00:00 2001 From: Alexis GAMELIN <alexis.gamelin@synchrotron-soleil.fr> Date: Wed, 31 Jul 2024 09:11:00 +0200 Subject: [PATCH] Add lattice check to get_chroma. Fix docstrings --- mbtrack2/tracking/synchrotron.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mbtrack2/tracking/synchrotron.py b/mbtrack2/tracking/synchrotron.py index b410934..41458ef 100644 --- a/mbtrack2/tracking/synchrotron.py +++ b/mbtrack2/tracking/synchrotron.py @@ -109,6 +109,9 @@ class Synchrotron: get_adts() Compute and add Amplitude-Dependent Tune Shifts (ADTS) sextupolar componenet from AT lattice. + get_chroma() + Compute chromaticity (linear and nonlinear) from AT lattice and + update the property. get_mcf_order() Compute momentum compaction factor up to 3rd order from AT lattice. get_longitudinal_twiss(V) @@ -389,9 +392,12 @@ class Synchrotron: def get_chroma(self, order=4, dpm=0.02, n_points=100): """ - Compute and add chromaticity (linear and nonlinear) from AT lattice and update the property. + Compute chromaticity (linear and nonlinear) from AT lattice and update the property. """ import at + if self.optics.use_local_values: + raise ValueError("Value needs to be provided manualy as no AT" + + " lattice file is loaded.") fit, dpa, tune = at.physics.nonlinear.chromaticity(self.optics.lattice, method='linopt', dpm=dpm, @@ -424,7 +430,7 @@ class Synchrotron: """ import at if self.optics.use_local_values: - raise ValueError("ADTS needs to be provided manualy as no AT" + + raise ValueError("Value needs to be provided manualy as no AT" + " lattice file is loaded.") deltamin = -1e-4 deltamax = 1e-4 -- GitLab