mbtrack2.tracking.feedback module

This module defines both exponential and FIR based bunch by bunch damper feedback for tracking.

class TransverseExponentialDamper(ring: Synchrotron, damping_time: ndarray[tuple[int, ...], dtype[_ScalarType_co]], phase_diff: ndarray[tuple[int, ...], dtype[_ScalarType_co]], local_beta: ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None = None)[source]

Bases: Element

Simple bunch by bunch damper feedback system based on exponential damping.

Parameters

ringSynchrotron object

Synchrotron to use.

damping_timefloat array of shape (2,)

Damping time in [turn]. If 0, the damper is not used in the considered plane.

phase_difffloat array of shape (2,)
Phase setting of the feedback in [deg]:
  • 90 corresponds to a pure resistive damper

  • 0 corresponds to a pure reactive damper.

local_betafloat array of shape (2,), optional

Beta function at the bpm/kicker location in [m]. The default is ring.optics.local_beta.

__init__(ring: Synchrotron, damping_time: ndarray[tuple[int, ...], dtype[_ScalarType_co]], phase_diff: ndarray[tuple[int, ...], dtype[_ScalarType_co]], local_beta: ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None = None)[source]
track(bunch: Bunch | Beam)[source]

Tracking method for the feedback system No bunch to bunch interaction, so written for Bunch object and @Element.parallel is used to handle Beam object.

Parameters

bunch : Bunch or Beam object

_abc_impl = <_abc._abc_data object>
class LongitudinalExponentialDamper(ring: Synchrotron, damping_time: float, phase_diff: float, long_tune: float)[source]

Bases: Element

Simple bunch by bunch damper feedback system based on exponential damping.

Parameters

ringSynchrotron object

Synchrotron to use.

damping_timefloat

Damping time in [turn]. If 0, the damper is not used.

phase_difffloat
Phase setting of the feedback in [deg]:
  • 90 corresponds to a pure resistive damper

  • 0 corresponds to a pure reactive damper.

long_tunefloat,

Longitudinal (synchrotron) tune of the ring.

In the presence of multi-harmonic RF systems, this tune should be computed from the complete RF configuration (voltages and phases).

The recommended way to obtain this value is via ring.get_longitudinal_twiss(…).

For a single-RF system, the synchrotron tune provided by ring.synchrotron_tune(Vrf) may be used.

__init__(ring: Synchrotron, damping_time: float, phase_diff: float, long_tune: float)[source]
track(bunch: Bunch | Beam)[source]

Tracking method for the feedback system No bunch to bunch interaction, so written for Bunch object and @Element.parallel is used to handle Beam object.

Parameters

bunch : Bunch or Beam object

_abc_impl = <_abc._abc_data object>
class FIRDamper(ring: Synchrotron, plane: str, turn_delay: int, tune: float, tap_number: int, gain: float, phase: float, local_beta: ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None = None, bpm_error: float | None = None, max_kick: float | None = None)[source]

Bases: Element

Bunch by bunch damper feedback system based on FIR filters.

FIR computation is based on [1].

Parameters

ringSynchrotron object

Synchrotron to use.

plane{“x”,”y”,”s”}

Allow to choose on which plane the damper is active.

tunefloat

Reference (betatron or synchrotron) tune for which the damper system is set.

turn_delayint

Number of turn delay before the kick is applied.

tap_numberint

Number of tap for the FIR filter.

gainfloat

Gain of the FIR filter.

phasefloat

Phase of the FIR filter in [degree].

local_betafloat, optional

Beta function at the bpm/kicker location in [m]. The default is ring.optics.local_beta of the considered plane.

bpm_errorfloat, optional

RMS measurement error applied to the computed mean position. Unit is [m] if the plane is “x” or “y” and [s] if the plane is “s”. The default is None.

max_kickfloat, optional

Maximum kick strength limitation. Unit is [rad] if the plane is “x” or “y” and no unit (delta) if the plane is “s”. The default is None.

Attributes

posarray

Stored beam postions.

kickarray

Stored damper kicks.

coefarray

Coefficients of the FIR filter.

Methods

get_fir(tap_number, tune, phase, turn_delay, gain)

Initialize the FIR filter and return an array containing the FIR coefficients.

plot_fir()

Plot the gain and the phase of the FIR filter.

track(beam_or_bunch)

Tracking method.

get_damping_time()

Return damping time in [turn].

get_tune_shift()

Return tune shit (in tune units).

References

[1] T.Nakamura, S.Daté, K. Kobayashi, T. Ohshima. Proceedings of EPAC 2004. Transverse bunch by bunch feedback system for the Spring-8 storage ring.

__init__(ring: Synchrotron, plane: str, turn_delay: int, tune: float, tap_number: int, gain: float, phase: float, local_beta: ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None = None, bpm_error: float | None = None, max_kick: float | None = None)[source]
_set_plane_indices(plane: str) tuple[str, int, int][source]
get_damping_time() float[source]

Return damping time in [turn].

get_tune_shift() float[source]

Return tune shit (in tune units).

get_fir(tap_number: int, tune: float, phase: float, turn_delay: int, gain: float) list[float][source]

Compute the FIR coefficients.

FIR computation is based on [1].

Parameters

tap_numberint

Number of tap for the FIR filter.

tunefloat

Reference (betatron or synchrotron) tune for which the damper system is set.

phasefloat

Phase of the FIR filter in [degree].

turn_delayint

Number of turn delay before the kick is applied.

gainfloat

Gain of the FIR filter.

Returns

FIR_coefarray

Array containing the FIR coefficients.

_abc_impl = <_abc._abc_data object>
plot_fir(axs: list[Axes] | None = None) list[Axes][source]

Plot the gain and the phase of the FIR filter.

Parameters

axslist of 2 axes, optional

Axes for gain and phase plots.

Returns

axeslist of 2 axes.

Axes for gain and phase plots.

track(beam_or_bunch: Beam | Bunch)[source]

Tracking method.

Parameters

beam_or_bunchBeam or Bunch

Data to track.

_init_beam_no_mpi(beam: Beam)[source]

Change array sizes if Beam is used without mpi.

Parameters

beamBeam

Beam to track.

_track_sb(bunch: Bunch, bunch_number: int = 0)[source]

Core of the tracking method.

Parameters

bunchBunch

Bunch to track.

bunch_numberint, optional

Number of bunch in beam.not_empty. The default is 0.