Skip to content
Snippets Groups Projects
Commit 0ed7c616 authored by Alexis GAMELIN's avatar Alexis GAMELIN
Browse files

Add loss_factor computation for WakeFunction

Change the default binning for WakePotential to 80 (better value for most cases).
parent 2f0797d2
No related branches found
No related tags found
No related merge requests found
...@@ -277,6 +277,8 @@ class WakeFunction(ComplexData): ...@@ -277,6 +277,8 @@ class WakeFunction(ComplexData):
Compute a wake function from wake potential data. Compute a wake function from wake potential data.
plot() plot()
Plot the wake function data. Plot the wake function data.
loss_factor(sigma)
Compute the loss factor or the kick factor for a Gaussian bunch.
""" """
def __init__(self, def __init__(self,
...@@ -454,6 +456,34 @@ class WakeFunction(ComplexData): ...@@ -454,6 +456,34 @@ class WakeFunction(ComplexData):
label = r"$W_{" + self.component_type + r"}$" + unit label = r"$W_{" + self.component_type + r"}$" + unit
ax.set_ylabel(label) ax.set_ylabel(label)
return ax return ax
def loss_factor(self, sigma):
"""
Compute the loss factor or the kick factor for a Gaussian bunch.
Formulas from Eq. (5.6), Eq. (5.12) and Eq. (5.17) of [1].
Parameters
----------
sigma : float
RMS bunch length in [s]
Returns
-------
kloss: float
Loss factor in [V/C] or kick factor in [V/C/m] depanding on the
impedance type.
References
----------
[1] : Zotter, Bruno W., and Semyon A. Kheifets. Impedances and wakes
in high-energy particle accelerators. World Scientific, 1998.
"""
time = self.data.index
S = 1/(2*np.sqrt(np.pi)*sigma)*np.exp(-1*time**2/(4*sigma**2))
kloss = trapz(x = time, y = self.data["real"]*S)
return kloss
class Impedance(ComplexData): class Impedance(ComplexData):
""" """
......
...@@ -70,7 +70,7 @@ class WakePotential(Element): ...@@ -70,7 +70,7 @@ class WakePotential(Element):
""" """
def __init__(self, ring, wakefield, n_bin=65): def __init__(self, ring, wakefield, n_bin=80):
self.wakefield = wakefield self.wakefield = wakefield
self.types = self.wakefield.wake_components self.types = self.wakefield.wake_components
self.n_types = len(self.wakefield.wake_components) self.n_types = len(self.wakefield.wake_components)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment