Skip to content
Snippets Groups Projects
Commit ad30d3bd authored by Teresia Olsson's avatar Teresia Olsson Committed by Alexis GAMELIN
Browse files

Adds a SynchrotronRadiation.qexcitation optional parameter to turn off quantum excitation.

parent e792f648
No related branches found
No related tags found
2 merge requests!280.8.0,!20Turn off quantum excitation
...@@ -144,12 +144,22 @@ class SynchrotronRadiation(Element): ...@@ -144,12 +144,22 @@ class SynchrotronRadiation(Element):
---------- ----------
ring : Synchrotron object ring : Synchrotron object
switch : bool array of shape (3,), optional switch : bool array of shape (3,), optional
allow to choose on which plane the synchrotron radiation is active If False in one plane (long, x, y), the synchrotron radiation is turned
off.
The default is True, in all three planes.
qexcitation : bool, optional
If False, the quantum excitation is turned off.
The default is True.
""" """
def __init__(self, ring, switch=np.ones((3, ), dtype=bool)): def __init__(self,
ring,
switch=np.ones((3, ), dtype=bool),
qexcitation=True):
self.ring = ring self.ring = ring
self.switch = switch self.switch = switch
self.qexcitation = qexcitation
@Element.parallel @Element.parallel
def track(self, bunch): def track(self, bunch):
...@@ -163,23 +173,37 @@ class SynchrotronRadiation(Element): ...@@ -163,23 +173,37 @@ class SynchrotronRadiation(Element):
bunch : Bunch or Beam object bunch : Bunch or Beam object
""" """
N = len(bunch) N = len(bunch)
if self.switch[0] == True:
rand = np.random.standard_normal(size=N) excitation = 0
bunch["delta"] = (1 - 2 * self.ring.T0 / self.ring.tau[2]) * bunch[ if self.switch[0]:
"delta"] + 2 * self.ring.sigma_delta * (
if self.qexcitation:
rand = np.random.standard_normal(size=N)
excitation = 2 * self.ring.sigma_delta * (
self.ring.T0 / self.ring.tau[2])**0.5 * rand self.ring.T0 / self.ring.tau[2])**0.5 * rand
if self.switch[1] == True: bunch["delta"] = (1 - 2 * self.ring.T0 /
rand = np.random.standard_normal(size=N) self.ring.tau[2]) * bunch["delta"] + excitation
bunch["xp"] = (1 - 2 * self.ring.T0 / self.ring.tau[0]
) * bunch["xp"] + 2 * self.ring.sigma()[1] * ( if self.switch[1]:
self.ring.T0 / self.ring.tau[0])**0.5 * rand
if self.qexcitation:
if self.switch[2] == True: rand = np.random.standard_normal(size=N)
rand = np.random.standard_normal(size=N) excitation = 2 * self.ring.sigma()[1] * (
bunch["yp"] = (1 - 2 * self.ring.T0 / self.ring.tau[1] self.ring.T0 / self.ring.tau[0])**0.5 * rand
) * bunch["yp"] + 2 * self.ring.sigma()[3] * (
self.ring.T0 / self.ring.tau[1])**0.5 * rand bunch["xp"] = (1 - 2 * self.ring.T0 /
self.ring.tau[0]) * bunch["xp"] + excitation
if self.switch[2]:
if self.qexcitation:
rand = np.random.standard_normal(size=N)
excitation = 2 * self.ring.sigma()[3] * (
self.ring.T0 / self.ring.tau[1])**0.5 * rand
bunch["yp"] = (1 - 2 * self.ring.T0 /
self.ring.tau[1]) * bunch["yp"] + excitation
class SkewQuadrupole: class SkewQuadrupole:
......
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