From 56886d933501329318fc19790e1a9aa98890ce75 Mon Sep 17 00:00:00 2001
From: Alexis Gamelin <alexis.gamelin@synchrotron-soleil.fr>
Date: Mon, 15 Jul 2024 11:27:15 +0200
Subject: [PATCH] [Fix] Docstrings for get_longitudinal_twiss

Add an explaination how to get non zero longitudinal cs_invariant
---
 mbtrack2/tracking/particles.py   |  3 +++
 mbtrack2/tracking/synchrotron.py | 13 +++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/mbtrack2/tracking/particles.py b/mbtrack2/tracking/particles.py
index 5b973d1..395de32 100644
--- a/mbtrack2/tracking/particles.py
+++ b/mbtrack2/tracking/particles.py
@@ -299,6 +299,9 @@ class Bunch:
         """
         Return the average Courant-Snyder invariant of each plane.
 
+        To get non-zero longitudinal Courant-Snyder invariant, the longitudinal
+        Twiss parameters need to be computed using the ring.get_longitudinal_twiss
+        method.
         """
         Jx = ((self.ring.optics.local_gamma[0] * self["x"]**2) +
               (2 * self.ring.optics.local_alpha[0] * self["x"]) * self["xp"] +
diff --git a/mbtrack2/tracking/synchrotron.py b/mbtrack2/tracking/synchrotron.py
index c357198..e9df8ff 100644
--- a/mbtrack2/tracking/synchrotron.py
+++ b/mbtrack2/tracking/synchrotron.py
@@ -459,17 +459,18 @@ class Synchrotron:
             Harmonics of the cavities to consider.
             Default is None.
         add : bool, optional
-            If True, 
-            
+            If True, add the computed longitudinal Twiss parameters as class
+            arguements.
+
         Usage
         -----
-        - If a single voltage value is given, assume a single RF system set at 
+        - If a single voltage value is given, assume a single RF system set at
         the synchronous phase.
-        - If a single pair of voltage/phase value is given, assume a single RF 
+        - If a single pair of voltage/phase value is given, assume a single RF
         system at this setting.
-        - Otherwise, compute the synchrotron tune for a multi-harmonic RF 
+        - Otherwise, compute the synchrotron tune for a multi-harmonic RF
         system.
-            
+
         Returns
         -------
         tuneS : float
-- 
GitLab