From 9b6fbb5445dbe5c106784f3edd31f50b28688c6e Mon Sep 17 00:00:00 2001
From: Gamelin Alexis <alexis.gamelin@synchrotron-soleil.fr>
Date: Mon, 6 Feb 2023 17:03:54 +0100
Subject: [PATCH] [Fix] ImpedanceModel

Fix ImpedanceModel.power_loss_spectrum that needs a double sided impedance spectrum.
Fix docstrings.
---
 mbtrack2/impedance/impedance_model.py | 5 +----
 mbtrack2/impedance/wakefield.py       | 2 +-
 mbtrack2/utilities/read_impedance.py  | 4 ++--
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/mbtrack2/impedance/impedance_model.py b/mbtrack2/impedance/impedance_model.py
index 4fc1352..f97d625 100644
--- a/mbtrack2/impedance/impedance_model.py
+++ b/mbtrack2/impedance/impedance_model.py
@@ -445,6 +445,7 @@ class ImpedanceModel():
             
         if fmin >= 0:
             fmin = -1*fmax
+            double_sided_impedance(impedance)
             
         frequency = np.linspace(fmin, fmax, int(n_points))
         if max_overlap is False:
@@ -455,10 +456,6 @@ class ImpedanceModel():
         pmax = np.floor(fmax/self.ring.f0)
         pmin = np.floor(fmin/self.ring.f0)
         
-        if pmin >= 0:
-            double_sided_impedance(impedance)
-            pmin = -1*pmax
-        
         p = np.arange(pmin+1,pmax)    
         pf0 = p*self.ring.f0
         ReZ = np.real(impedance(pf0))
diff --git a/mbtrack2/impedance/wakefield.py b/mbtrack2/impedance/wakefield.py
index 5b6f92a..52807e6 100644
--- a/mbtrack2/impedance/wakefield.py
+++ b/mbtrack2/impedance/wakefield.py
@@ -873,7 +873,7 @@ class WakeField:
         Returns
         -------
         wake_sum : WakeField
-            WakeField with summed components..
+            WakeField with summed components.
 
         """
         if len(wakefields) == 1:
diff --git a/mbtrack2/utilities/read_impedance.py b/mbtrack2/utilities/read_impedance.py
index 9d0ac30..fa70cd1 100644
--- a/mbtrack2/utilities/read_impedance.py
+++ b/mbtrack2/utilities/read_impedance.py
@@ -93,8 +93,8 @@ def read_IW2D_folder(folder, suffix, select="WZ"):
     
     Parameters
     ----------
-    file : str
-        Path to the file to read.
+    folder : str
+        Path to the folder to read.
     suffix : str
         End of the name of each files. For example, in "Zlong_test.dat" the
         suffix should be "_test.dat".
-- 
GitLab