Skip to content

Commit 8a41c14

Browse files
committed
Merge branch 'master' of https://github.com/like2000/PyHEADTAIL into losses
2 parents c0521ae + cae2153 commit 8a41c14

File tree

8 files changed

+650
-12
lines changed

8 files changed

+650
-12
lines changed

_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "1.0.4"
1+
__version__ = "1.0.8"
22

feedback/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .. import __version__

feedback/transverse_damper.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
'''
2+
@author Kevin Li
3+
@date 20/06/2014
4+
@copyright CERN
5+
'''
6+
from __future__ import division
7+
8+
9+
import numpy as np
10+
from scipy.special import k0
11+
from scipy.constants import c, e
12+
import pylab as plt
13+
14+
15+
class TransverseDamper(object):
16+
17+
def __init__(self, dampingrate_x, dampingrate_y):
18+
self.gain_x = 2/dampingrate_x
19+
self.gain_y = 2/dampingrate_y
20+
21+
if dampingrate_x and not dampingrate_y:
22+
self.track = self.track_horizontal
23+
elif not dampingrate_x and dampingrate_y:
24+
self.track = self.track_vertical
25+
else:
26+
self.track = self.track_all
27+
28+
def track_horizontal(self, beam):
29+
beam.xp -= self.gain_x * beam.mean_xp()
30+
31+
def track_vertical(self, beam):
32+
beam.yp -= self.gain_y * beam.mean_yp()
33+
34+
def track_all(self, beam):
35+
beam.xp -= self.gain_x * beam.mean_xp()
36+
beam.yp -= self.gain_y * beam.mean_yp()
37+
38+
@classmethod
39+
def horizontal(cls, dampingrate_x):
40+
return cls(dampingrate_x, 0)
41+
42+
@classmethod
43+
def vertical(cls, dampingrate_y):
44+
return cls(0, dampingrate_y)

0 commit comments

Comments
 (0)