mbtrack2.impedance package

Submodules

mbtrack2.impedance.csr module

Define coherent synchrotron radiation (CSR) wakefields in various models.

class mbtrack2.impedance.csr.FreeSpaceCSR(time, frequency, length, radius)[source]

Bases: WakeField

Free space steady-state coherent synchrotron radiation Wakefield element, based on [1].

Impedance is computed using Eq. (A10) of [2].

timearray of float

Time points where the wake function will be evaluated in [s].

frequencyarray of float

Frequency points where the impedance will be evaluated in [Hz].

lengthfloat

Length of the impedacen to consider in [m].

radiusfloat

Dipole radius of curvature in [m].

[1] : Faltens, A. N. D. R. I. S., & Laslett, L. J. (1973). Longitudinal coupling impedance of a stationary electron ring in a cylindrical geometry. part. Accel., 4, 151-157. [2] : Agoh, T., and K. Yokoya. “Calculation of coherent synchrotron radiation using mesh.” Physical Review Special Topics-Accelerators and Beams 7.5 (2004): 054403.

LongitudinalImpedance(frequency)[source]

Compute the free space steady-state CSR impedance. Based on Eq. (A10) of [1].

This formula is valid only if omega << (3 * gamma^3 * c) / (2 * R).

frequencyfloat array

Frequency in [Hz].

Zlcomplex array

Longitudinal impedance in [ohm].

[1] : Agoh, T., and K. Yokoya. “Calculation of coherent synchrotron radiation using mesh.” Physical Review Special Topics-Accelerators and Beams 7.5 (2004): 054403.

LongitudinalWakeFunction(time)[source]
class mbtrack2.impedance.csr.ParallelPlatesCSR(time, frequency, length, radius, distance)[source]

Bases: WakeField

Perfectly conducting parallel plates steady-state coherent synchrotron radiation Wakefield element, based on [1].

timearray of float

Time points where the wake function will be evaluated in [s].

frequencyarray of float

Frequency points where the impedance will be evaluated in [Hz].

lengthfloat

Length of the impedacen to consider in [m].

radiusfloat

Dipole radius of curvature in [m].

distancefloat

Vertical distance between the parallel plates in [m].

thresholdfloat

Shielding threshold in the parallel plates model in [Hz].

[1] : Agoh, T., and K. Yokoya. “Calculation of coherent synchrotron radiation using mesh.” Physical Review Special Topics-Accelerators and Beams 7.5 (2004): 054403.

LongitudinalImpedance(frequency, tol=1e-05)[source]

Compute the CSR impedance using the perfectly conducting parallel plates steady-state model.

Impedance is computed using Eq. (A1) of [1].

frequencyfloat array

Frequency in [Hz].

tolfloat, optinal

Desired maximum final error on sum_func.

Zlcomplex array

Longitudinal impedance in [ohm].

[1] : Agoh, T., and K. Yokoya. “Calculation of coherent synchrotron radiation using mesh.” Physical Review Special Topics-Accelerators and Beams 7.5 (2004): 054403.

LongitudinalWakeFunction(time)[source]
sum_func(p, k)[source]

Utility function for LongitudinalImpedance.

p : int k : float

sum_value : mpc

property threshold

Shielding threshold in the parallel plates model in [Hz].

mbtrack2.impedance.impedance_model module

Module where the ImpedanceModel class is defined.

class mbtrack2.impedance.impedance_model.ImpedanceModel(ring)[source]

Bases: object

Define the impedance model of the machine.

The model must be completed with successive add(…) and add_global(…) calls, then compute_sum() must be run.

The transverse impedance and wake functions are beta weighted and divided by the beta at the tracking location (ring.optics.local_beta).

ring : Synchrotron object

wakefieldslist of WakeField objects

WakeFields in the model.

positionslist of arrays

Positions corresponding the different WakeFields.

nameslist of str

Names of the WakeField objects.

sumWakeField

Sum of every WakeField in the model weigthed by beta functions.

sum_”name”WakeField

Sum of the “name” Wakefield weigthed by beta functions.

sum_namesarray

Names of attributes where the WakeFields are summed by name.

globalslist of WakeField objects

Globals WakeFields in the model.

globals_nameslist of str

Names of the global WakeFields objects.

add(wakefield, positions, name)

Add the same WakeField object at different locations to the model.

add_global(wakefield, name)

Add a “global” WakeField object which will added to the sum WakeField but not weighted by beta functions.

sum_beta(wake, beta)

Weight a WakeField object by an array of beta functions.

compute_sum_names()

Compute the weighted WakeField for each WakeField object type.

compute_sum()

Compute the sum of all weighted WakeField into self.sum.

plot_area(Z_type=”Zlong”, component=”real”, sigma=None, attr_list=None)

Plot the contributions of different kind of WakeFields.

save(file)

Save impedance model to file.

load(file)

Load impedance model from file.

add(wakefield, positions, name=None)[source]

Add the same WakeField object at different locations to the model.

wakefieldWakeField

WakeField object to add to the model.

positionsarray, float or int

Array of longitudinal positions where the elements are loacted.

namestr, optional

Name of the element type. If None, the name of the WakeField object is used. The default is None.

None.

add_global(wakefield, name=None)[source]

Add a “global” WakeField object which will added to the sum WakeField but not weighted by beta functions.

To use with “distributed” elements, for example a resistive wall wakefield computed from an effective radius (so which has already been weighted by beta functions).

wakefieldWakeField

WakeField object to add to the model.

namestr, optional

Name of the element type. If None, the name of the WakeField object is used. The default is None.

None.

compute_sum()[source]

Compute the sum of all weighted WakeField into self.sum.

compute_sum_names()[source]

Compute the weighted WakeField for each WakeField object type. The new summed WakeField object are set to into self.sum_name.

effective_impedance(m, mu, sigma, M, tuneS, xi=None, mode='Hermite')[source]

Compute the longitudinal and transverse effective impedance.

muint

coupled bunch mode number, goes from 0 to (M-1) where M is the number of bunches

mint

head-tail (or azimutal/synchrotron) mode number

sigmafloat

RMS bunch length in [s]

Mint

Number of bunches.

tuneSfloat

Synchrotron tune.

xifloat, optional

(non-normalized) chromaticity

mode: str, optional

type of the mode taken into account for the computation: -“Hermite” modes for Gaussian bunches

summaryDataFrame

Longitudinal and transverse effective impedance.

energy_loss(sigma, M, bunch_spacing, I, n_points=10000000.0)[source]

Compute the beam and bunch loss factor and energy losses for each type of element in the model assuming Gaussian bunches and constant spacing between bunches.

sigmafloat

RMS bunch length in [s].

Mint

Number of bunches in the beam.

bunch_spacingfloat

Time between two bunches in [s].

Ifloat

Total beam current in [A].

n_pointsfloat, optional

Number of points used in the frequency spectrums.

summaryDataframe

Contains the beam and bunch loss factor and energy loss for the full model and for each type of different component.

group_attributes(string_in_name, names_to_group=None, property_list=['Zlong'])[source]

Groups attributes in the ImpedanceModel based on a given string pattern. Args:

string_in_name (str): The string pattern used to match attribute names for grouping. If names_to_group is given, this is a name of a new attribute instead. names_to_group (list, optional): List of attribute names to be explicitly grouped.

If not provided, attributes matching the string pattern will be automatically grouped. Defaults to None.

property_list (list, optional): List of property names to be grouped for each attribute.

Defaults to [‘Zlong’].

Returns:

int: Returns 0 indicating the successful grouping of attributes.

Notes:
  • This method groups attributes in the ImpedanceModel class based on a given string pattern.

  • If names_to_group is not provided, it automatically selects attributes from the existing sum_names that match the given string pattern.

  • A new WakeField instance is created and assigned to the attribute named ‘string_in_name’.

  • The specified properties from the first attribute in names_to_group are appended to the new WakeField instance.

  • The values of the specified properties from the remaining attributes in names_to_group are added to the corresponding properties in the new WakeField instance.

  • The names_to_group attributes are removed from the ImpedanceModel class.

  • The new grouped attribute is added to sum_names, and the first attribute in names_to_group is removed from sum_names.

load(file)[source]

Load impedance model from file.

The same pandas version is needed on both saving and loading computer for the pickle to work.

filestr

File where the impedance model is saved.

None.

plot_area(Z_type='Zlong', component='real', sigma=None, attr_list=None, zoom=False)[source]

Plot the contributions of different kind of WakeFields.

Z_typestr, optional

Type of impedance to plot.

componentstr, optional

Component to plot, can be “real” or “imag”.

sigmafloat, optional

RMS bunch length in [s] to use for the spectral density. If equal to None, the spectral density is not plotted.

attr_listlist or array of str, optional

Attributes to plot.

zoombool

If True, add a zoomed plot on top right corner.

power_loss_spectrum(sigma, M, bunch_spacing, I, n_points=10000000.0, max_overlap=False, plot=False)[source]

Compute the power loss spectrum of the summed longitudinal impedance as in Eq. (4) of [1].

Assume Gaussian bunches and constant spacing between bunches.

sigmafloat

RMS bunch length in [s].

Mint

Number of bunches in the beam.

bunch_spacingfloat

Time between two bunches in [s].

Ifloat

Total beam current in [A].

n_pointsfloat, optional

Number of points used in the frequency spectrum.

max_overlapbool, optional

If True, the bunch spectrum (scaled to the number of bunches) is used instead of the beam spectrum to compute the maximum value of the power loss spectrum at each frequency. Should only be used to maximise the power loss at a given frequency (e.g. for HOMs) and not for the full spectrum.

plotbool, optional
If True, plots:
  • the overlap between the real part of the longitudinal impedance

and the beam spectrum. - the power loss spectrum.

pf0array

Frequency points.

power_lossarray

Power loss spectrum in [W].

[1] : L. Teofili, et al. “A Multi-Physics Approach to Simulate the RF Heating 3D Power Map Induced by the Proton Beam in a Beam Intercepting Device”, in IPAC’18, 2018, doi:10.18429/JACoW-IPAC2018-THPAK093

rename_attribute(old_name, new_name)[source]

Renames an attribute in the ImpedanceModel. Args:

old_name (str): The current name of the attribute to be renamed. new_name (str): The new name for the attribute.

Raises:

KeyError: If the old_name doesn’t exist as an attribute in the ImpedanceModel.

Notes:
  • This method renames an attribute in the ImpedanceModel class.

  • The attribute with the old_name is removed from the class’s dictionary (__dict__) using the pop() method.

  • The attribute is then added back to the class’s dictionary with the new_name using the __dict__ attribute.

  • If the old_name doesn’t exist as an attribute in the ImpedanceModel, a KeyError is raised.

save(file)[source]

Save impedance model to file.

The same pandas version is needed on both saving and loading computer for the pickle to work.

filestr

File where the impedance model is saved.

None.

sum_beta(wake, beta)[source]

Weight a WakeField object by an array of beta functions.

wakeWakeField

WakeField element object.

betaarray of shape (2, N)

Beta function at the locations of the elements.

wake_sumWakeField

WakeField object weighted by beta functions.

mbtrack2.impedance.resistive_wall module

Define resistive wall elements based on the WakeField class.

class mbtrack2.impedance.resistive_wall.CircularResistiveWall(time, frequency, length, rho, radius, exact=False, atol=1e-20)[source]

Bases: WakeField

Resistive wall WakeField element for a circular beam pipe.

Impedance from approximated formulas from Eq. (2.77) of Chao book [1]. Wake function formulas from [2].

timearray of float

Time points where the wake function will be evaluated in [s].

frequencyarray of float

Frequency points where the impedance will be evaluated in [Hz].

lengthfloat

Beam pipe length in [m].

rhofloat

Resistivity in [ohm.m].

radiusfloat

Beam pipe radius in [m].

exactbool, optional

If False, approxmiated formulas are used for the wake function computations.

atolfloat, optional

Absolute tolerance used to enforce fundamental theorem of beam loading for the exact expression of the longitudinal wake function. Default is 1e-20.

[1] : Chao, A. W. (1993). Physics of collective beam instabilities in high energy accelerators. Wiley. [2] : Skripka, Galina, et al. “Simultaneous computation of intrabunch and interbunch collective beam motions in storage rings.” Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and Associated Equipment 806 (2016): 221-230.

LongitudinalWakeFunction(time, exact=False, atol=1e-20)[source]

Compute the longitudinal wake function of a circular resistive wall using Eq. (22), or approxmiated expression Eq. (24), of [1]. The approxmiated expression is valid if the time is large compared to the characteristic time t0.

If some time value is smaller than atol, then the fundamental theorem of beam loading is applied: Wl(0) = Wl(0+)/2.

timearray of float

Time points where the wake function is evaluated in [s].

exactbool, optional

If True, the exact expression is used. The default is False.

atolfloat, optional

Absolute tolerance used to enforce fundamental theorem of beam loading for the exact expression of the longitudinal wake function. Default is 1e-20.

wlarray of float

Longitudinal wake function in [V/C].

[1] : Skripka, Galina, et al. “Simultaneous computation of intrabunch and interbunch collective beam motions in storage rings.” Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and Associated Equipment 806 (2016): 221-230.

TransverseWakeFunction(time, exact=False)[source]

Compute the transverse wake function of a circular resistive wall using Eq. (25), or approxmiated expression Eq. (26), of [1]. The approxmiated expression is valid if the time is large compared to the characteristic time t0.

Exact expression (Eq. (25) from [1]) is corrected by factor (c * t0).

timearray of float

Time points where the wake function is evaluated in [s].

exactbool, optional

If True, the exact expression is used. The default is False.

wtarray of float

Transverse wake function in [V/C].

[1] : Skripka, Galina, et al. “Simultaneous computation of intrabunch and interbunch collective beam motions in storage rings.” Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and Associated Equipment 806 (2016): 221-230.

class mbtrack2.impedance.resistive_wall.Coating(frequency, length, rho1, rho2, radius, thickness, approx=False)[source]

Bases: WakeField

LongitudinalImpedance(f, approx)[source]

Compute the longitudinal impedance of a coating using Eq. (5), or approxmiated expression Eq. (8), of [1]. The approxmiated expression is valid if the skin depth of the coating is large compared to the coating thickness.

farray of float

Frequency points where the impedance is evaluated in [Hz].

approxbool

If True, used approxmiated formula.

Zlarray

Longitudinal impedance values in [ohm].

[1] : Migliorati, M., E. Belli, and M. Zobov. “Impact of the resistive wall impedance on beam dynamics in the Future Circular e+ e− Collider.” Physical Review Accelerators and Beams 21.4 (2018): 041001.

TransverseImpedance(f, approx)[source]

Compute the transverse impedance of a coating using Eq. (6), or approxmiated expression Eq. (9), of [1]. The approxmiated expression is valid if the skin depth of the coating is large compared to the coating thickness.

farray of float

Frequency points where the impedance is evaluated in [Hz].

approxbool

If True, used approxmiated formula.

Ztarray

Transverse impedance values in [ohm].

[1] : Migliorati, M., E. Belli, and M. Zobov. “Impact of the resistive wall impedance on beam dynamics in the Future Circular e+ e− Collider.” Physical Review Accelerators and Beams 21.4 (2018): 041001.

mbtrack2.impedance.resistive_wall.skin_depth(frequency, rho, mu_r=1, epsilon_r=1)[source]

General formula for the skin depth.

frequencyarray of float

Frequency points in [Hz].

rhofloat

Resistivity in [ohm.m].

mu_rfloat, optional

Relative magnetic permeability.

epsilon_rfloat, optional

Relative electric permittivity.

deltaarray of float

Skin depth in [m].

mbtrack2.impedance.resonator module

This module defines the impedances and wake functions from the resonator model based on the WakeField class.

class mbtrack2.impedance.resonator.PureInductive(L, n_wake=1000000.0, n_imp=1000000.0, imp_freq_lim=100000000000.0, nout=None, trim=False)[source]

Bases: WakeField

Pure inductive Wakefield element which computes associated longitudinal impedance and wake function.

Lfloat

Inductance value in [Ohm/Hz].

n_wakeint or float, optional

Number of points used in the wake function.

n_impint or float, optional

Number of points used in the impedance.

imp_freq_limfloat, optional

Maximum frequency used in the impedance.

nout, trim : see Impedance.to_wakefunction

long_impedance(f)[source]
class mbtrack2.impedance.resonator.PureResistive(R, n_wake=1000000.0, n_imp=1000000.0, imp_freq_lim=100000000000.0, nout=None, trim=False)[source]

Bases: WakeField

Pure resistive Wakefield element which computes associated longitudinal impedance and wake function.

Rfloat

Resistance value in [Ohm].

n_wakeint or float, optional

Number of points used in the wake function.

n_impint or float, optional

Number of points used in the impedance.

imp_freq_limfloat, optional

Maximum frequency used in the impedance.

nout, trim : see Impedance.to_wakefunction

long_impedance(f)[source]
class mbtrack2.impedance.resonator.Resonator(time, frequency, Rs, fr, Q, plane, atol=1e-20)[source]

Bases: WakeField

long_impedance(f)[source]
long_wake_function(t, atol)[source]
transverse_impedance(f)[source]
transverse_wake_function(t)[source]

mbtrack2.impedance.tapers module

Module where taper elements are defined.

class mbtrack2.impedance.tapers.StupakovCircularTaper(frequency, radius_entrance, radius_exit, length, m_max=100, n_points=10000)[source]

Bases: WakeField

Circular taper WakeField element, using the low frequency approxmiation. Assume constant taper angle. Formulas from [1].

! Valid for low w

frequency: frequency points where the impedance will be evaluated in [Hz] radius_entrance : radius at taper entrance in [m] radius_exit : radius at taper exit in [m] length : taper length in [m]

property Z0
Z_over_n(f0)[source]
property angle
dip(frequency=None)[source]
long(frequency=None)[source]
property radius_prime
class mbtrack2.impedance.tapers.StupakovRectangularTaper(frequency, gap_entrance, gap_exit, length, width, m_max=100, n_points=10000)[source]

Bases: WakeField

Rectangular vertical taper WakeField element, using the low frequency approxmiation. Assume constant taper angle. Formulas from [1].

! Valid for low w

frequency: frequency points where the impedance will be evaluated in [Hz] gap_entrance : full vertical gap at taper entrance in [m] gap_exit: full vertical gap at taper exit in [m] length: taper length in [m] width : full horizontal width of the taper in [m]

property Z0
Z_over_n(f0)[source]
property angle
property gap_prime
long(frequency=None)[source]
quad()[source]
xdip()[source]
ydip()[source]

mbtrack2.impedance.wakefield module

This module defines general classes to describes wakefields, impedances and wake functions.

class mbtrack2.impedance.wakefield.ComplexData(variable=array([- 1.e+15, 1.e+15]), function=array([0, 0]))[source]

Bases: object

Define a general data structure for a complex function based on a pandas DataFrame.

variablelist, numpy array

contains the function variable values

functionlist or numpy array of comp lex numbers

contains the values taken by the complex function

add(structure_to_add, method='zero', interp_kind='cubic', index_name='variable')[source]

Method to add two structures. If the data don’t have the same length, different cases are handled.

structure_to_addComplexData object, int, float or complex.

structure to be added.

methodstr, optional

manage how the addition is done, possibilties are: -common: the common range of the index (variable) from the two

structures is used. The input data are cross-interpolated so that the result data contains the points at all initial points in the common domain.

-extrapolate: extrapolate the value of both ComplexData. -zero: outside of the common range, the missing values are zero. In

the common range, behave as “common” method.

interp_kindstr, optional

interpolation method which is passed to pandas and to scipy.interpolate.interp1d.

index_namestr, optional

name of the dataframe index passed to the method

ComplexData

Contains the sum of the two inputs.

property component_type
initialize_coefficient()[source]

Define the impedance coefficients and the plane of the impedance that are presents in attributes of the class.

multiply(factor)[source]

Multiply a data strucure with a float or an int. If the multiplication is done with something else, throw a warning.

name_and_coefficients_table()[source]

Return a table associating the human readbale names of an impedance component and its associated coefficients and plane.

property power_x
property power_y
class mbtrack2.impedance.wakefield.Impedance(variable=array([- 1.e+15, 1.e+15]), function=array([0, 0]), component_type='long')[source]

Bases: ComplexData

Define an Impedance object based on a ComplexData object.

variablearray-like

Frequency domain structure of the impedance in [Hz].

functionarray-like

Impedance values in [Ohm].

component_typestr, optinal

Type of the impedance: “long”, “xdip”, “xquad”, …

data : DataFrame impedance_type : str

loss_factor(sigma)

Compute the loss factor or the kick factor for a Gaussian bunch.

to_wakefunction()

Return a WakeFunction object from the impedance data.

plot()

Plot the impedance data.

add(structure_to_add, beta_x=1, beta_y=1, method='zero')[source]

Method to add two Impedance objects. The two structures are compared so that the addition is self-consistent. Beta functions can be precised as well.

loss_factor(sigma)[source]

Compute the loss factor or the kick factor for a Gaussian bunch. Formulas from Eq. (2) p239 and Eq.(7) p240 of [1].

sigmafloat

RMS bunch length in [s]

kloss: float

Loss factor in [V/C] or kick factor in [V/C/m] depanding on the impedance type.

[1] : Handbook of accelerator physics and engineering, 3rd printing.

multiply(factor)[source]

Multiply a Impedance object with a float or an int. If the multiplication is done with something else, throw a warning.

plot()[source]

Plot the impedance data.

axclass:matplotlib.axes.Axes

Impedance data.

to_wakefunction(nout=None, trim=False)[source]

Return a WakeFunction object from the impedance data. The impedance data is assumed to be sampled equally.

noutint or float, optional

Length of the transformed axis of the output. If None, it is taken to be 2*(n-1) where n is the length of the input. If nout > n, the input is padded with zeros. If nout < n, the input it cropped. Note that, for any nout value, nout//2+1 input points are required.

trimbool or float, optional

If True, the pseudo wake function is trimmed at time=0 and is forced to zero where time<0. If False, the original result is preserved. If a float is given, the pseudo wake function is trimmed from time <= trim to 0.

class mbtrack2.impedance.wakefield.WakeField(structure_list=None, name=None)[source]

Bases: object

Defines a WakeField which corresponds to a single physical element which produces different types of wakes, represented by their Impedance or WakeFunction objects.

structure_listlist, optional

list of Impedance/WakeFunction objects to add to the WakeField.

name : str, optional

impedance_componentsarray of str

Impedance components present for this element.

wake_componentsarray of str

WakeFunction components present for this element.

componentsarray of str

Impedance or WakeFunction components present for this element.

append_to_model(structure_to_add)

Add Impedance/WakeFunction to WakeField.

list_to_attr(structure_list)

Add list of Impedance/WakeFunction to WakeField.

add_wakefields(wake1, beta1, wake2, beta2)

Add two WakeFields taking into account beta functions.

add_several_wakefields(wakefields, beta)

Add a list of WakeFields taking into account beta functions.

drop(component)

Delete a component or a list of component from the WakeField.

save(file)

Save WakeField element to file.

load(file)

Load WakeField element from file.

static add_several_wakefields(wakefields, beta)[source]

Add a list of WakeFields taking into account beta functions.

wakefieldslist of WakeField

WakeFields to add.

betaarray of shape (len(wakefields), 2)

Beta functions at the WakeField postions.

wake_sumWakeField

WakeField with summed components.

static add_wakefields(wake1, beta1, wake2, beta2)[source]

Add two WakeFields taking into account beta functions.

wake1WakeField

WakeField to add.

beta1array of shape (2,)

Beta functions at wake1 postion.

wake2WakeField

WakeField to add.

beta2array of shape (2,)

Beta functions at wake2 postion.

wake_sumWakeField

WakeField with summed components.

append_to_model(structure_to_add)[source]

Add Impedance/WakeFunction component to WakeField.

structure_to_add : Impedance or WakeFunction object

property components

Return an array of the component names for the element.

drop(component)[source]

Delete a component or a list of component from the WakeField.

componentstr or list of str

Component or list of components to drop. If “Z”, drop all impedance components. If “W””, drop all wake function components.

None.

property impedance_components

Return an array of the impedance component names for the element.

list_to_attr(structure_list)[source]

Add list of Impedance/WakeFunction components to WakeField.

structure_list : list of Impedance or WakeFunction objects.

static load(file)[source]

Load WakeField element from file.

The same pandas version is needed on both saving and loading computer for the pickle to work.

filestr

File where the WakeField element is saved.

wakefieldWakeField

Loaded wakefield.

save(file)[source]

Save WakeField element to file.

The same pandas version is needed on both saving and loading computer for the pickle to work.

filestr

File where the WakeField element is saved.

None.

property wake_components

Return an array of the wake function component names for the element.

class mbtrack2.impedance.wakefield.WakeFunction(variable=array([- 1.e+15, 1.e+15]), function=array([0, 0]), component_type='long')[source]

Bases: ComplexData

Define a WakeFunction object based on a ComplexData object.

variablearray-like

Time domain structure of the wake function in [s].

functionarray-like

Wake function values in [V/C] for “long” and in [V/C/m] for others.

component_typestr, optinal

Type of the wake function: “long”, “xdip”, “xquad”, …

data : DataFrame wake_type : str

to_impedance()

Return an Impedance object from the WakeFunction data.

deconvolution(freq_lim, sigma, mu)

Compute a wake function from wake potential data.

plot()

Plot the wake function data.

loss_factor(sigma)

Compute the loss factor or the kick factor for a Gaussian bunch.

add(structure_to_add, method='zero')[source]

Method to add two WakeFunction objects. The two structures are compared so that the addition is self-consistent.

deconvolution(freq_lim, sigma, mu, nout=None)[source]

Compute a wake function from wake potential data.

The present data loaded into the WakeFunction object is assumed to be an uniformly sampled wake potential from a Gaussian bunch distribution with RMS bunch length sigma and offset mu.

The offset mu depends on the code used to compute the wake potential:
  • for CST, it is the first time sample, so self.data.index[0].

  • for ABCI, it is “-1 * ISIG * SIG / c”.

freq_limfloat

The maximum frequency for calculating the impedance [Hz].

sigmafloat

RMS of the Gaussian distribution in [s].

mufloat

Offset of the Gaussian distribution in [s].

noutint or float, optional

Length of the transformed axis of the output. If None, it is taken to be 2*(n-1) where n is the length of the input. If nout > n, the input is padded with zeros. If nout < n, the input it cropped. Note that, for any nout value, nout//2+1 input points are required. The default is None.

loss_factor(sigma)[source]

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].

sigmafloat

RMS bunch length in [s]

kloss: float

Loss factor in [V/C] or kick factor in [V/C/m] depanding on the impedance type.

[1] : Zotter, Bruno W., and Semyon A. Kheifets. Impedances and wakes in high-energy particle accelerators. World Scientific, 1998.

multiply(factor)[source]

Multiply a WakeFunction object with a float or an int. If the multiplication is done with something else, throw a warning.

plot()[source]

Plot the wake function data.

axclass:matplotlib.axes.Axes

Wake function data.

to_impedance(freq_lim, nout=None, sigma=None, mu=None)[source]

Return an Impedance object from the WakeFunction data. The WakeFunction data is assumed to be sampled equally.

If both sigma and mu are given, the impedance data is divided by the Fourier transform of a Gaussian distribution. It then can be used to go from wake potential data to impedance.

freq_limfloat

The maximum frequency for calculating the impedance [Hz].

noutint or float, optional

Length of the transformed axis of the output. If None, it is taken to be 2*(n-1) where n is the length of the input. If nout > n, the input is padded with zeros. If nout < n, the input it cropped. Note that, for any nout value, nout//2+1 input points are required. The default is None.

sigmafloat

RMS of the Gaussian distribution in [s]. The default is None.

mufloat

Offset of the Gaussian distribution in [s]. The default is None.

Module contents