ocelot.rad

Package Contents

Classes

Screen

Class to store radiation field and to provide information about screen parameters where radiation will be observed.

Functions

sigma_gamma_quat(energy, Kx, lperiod, L)

rate of energy diffusion

calculate_radiation(lat, screen, beam, energy_loss=False, quantum_diff=False, accuracy=1, end_poles=False)

Function to calculate radation from the electron beam.

coherent_radiation(lat, screen, p_array, energy_loss=False, quantum_diff=False, accuracy=1, end_poles=False, verbose=True)

Function to calculate radiation from the electron beam.

lambda2eV(Lambda)

eV2lambda(Ephoton)

Ephoton2K(Eph, lu=0.04, Eeb=14)

K2Ephoton(K, lu=0.04, E=14)

K2Lambda(K, lu=0.04, E=14)

field2K(field, lu=0.04)

function to translate magnetic field in [T] to K parameter

K2field(K, lu=0.04)

field2Ephoton(field, lu=0.04, E=14)

Ephoton2field(energy, lu=0.04, Eeb=14)

lambda2Ebeam(Lambda=1.04e-08, lu=0.0272, K=1.2392)

print_rad_props(beam, K, lu, L, distance)

Simple function to estimate radiation properties and print them

class ocelot.rad.Screen

Class to store radiation field and to provide information about screen parameters where radiation will be observed. Format for electric fields in arrays (arReEx, arImEx, …) is following: ReEx[ny*nx*je + nx*jy + jx]

self.z: 100.0 [m], distance from the beginning of the lattice to the screen self.size_x: 1 [m], half of screen size in horizontal plane self.size_y: 1 [m], half of screen size in vertical self.nx: 1, number of points in horizontal plane self.ny: 1, number of points in vertical plane self.start_energy: 100.0 [eV], starting photon energy self.end_energy: 10000.0 [eV], ending photon energy self.num_energy: 1000, number of energy points self.arReEx = [], Real part of horizontal component of the electric field self.arImEx = [], Imaginary part of horizontal component of the electric field self.arReEy = [], Real part of the vertical component of the electric field self.arImEy = [], Imaginary part of the vertical component of the electric field self.arPhase = [], phase between Re and Im components

update(self)
rebuild_efields(self, x0=0, y0=0, z0=0)

the method recalculates the field phase and electrical fields to obtain the correct values that can be used to propagate the wave front.

Parameters
  • x0 – initial the electron coordinate

  • y0 – initial the electron coordinate

  • z0 – initial the electron coordinate

Returns

screen_to_emscreen(self, screen)
create_empty_emclass(self)
nullify(self)
create_like(self, em_screen)
screenPy2C(self, lperiod, nperiods, status)
screenC2Py(self, c_screen)
distPhoton(self, gamma, current)

On the area ds during 1 sec falls dN photons in spectral width (dlambda/lambda) dN = ds/Distance**2 * (dlambda/lambda) * (I/qe) * 3*alpha*gamma**2/(4*pi**2) * |Eul(lambda, Xscreen)|**2 Eul(lambda, Xscreen) is unitless electric field: Eul(lambda, Xscreen) = - (c/qe) * D/(sqrt(3)*gamma**2) * (E(lambda, Xscreen))

Parameters
  • gamma

  • current – in A

Returns

coherent_photon_dist(self)

On the area ds during 1 sec falls dN photons in spectral width (dlambda/lambda) dN = ds/Distance**2 * (dlambda/lambda) * (I/qe) * 3*alpha*gamma**2/(4*pi**2) * |Eul(lambda, Xscreen)|**2 Eul(lambda, Xscreen) is unitless electric field: Eul(lambda, Xscreen) = - (c/qe) * D/(sqrt(3)*gamma**2) * (E(lambda, Xscreen))

For coherent radiation calculation: I = qe dN = ds/Distance**2 * (dlambda/lambda) * 3*alpha/(4*pi**2) * |Eul(lambda, Xscreen) * gamma * n_e|**2 |Eul(lambda, Xscreen) * gamma * n_e| is calculated in function coherent_radiation()

Returns

zerosArray(self)
screen2dict(self)
dict2screen(self, dictionaty)
ocelot.rad.sigma_gamma_quat(energy, Kx, lperiod, L)

rate of energy diffusion

Parameters
  • energy – electron beam energy

  • Kx – undulator parameter

  • lperiod – undulator period

  • L – length

Returns

sigma_gamma/gamma

ocelot.rad.calculate_radiation(lat, screen, beam, energy_loss=False, quantum_diff=False, accuracy=1, end_poles=False)

Function to calculate radation from the electron beam.

Parameters
  • lat – MagneticLattice should include element Undulator

  • screen – Screen class

  • beam – Beam class, the radiation is calculated from one electron

  • energy_loss – False, if True includes energy loss after each period

  • quantum_diff – False, if True introduces random energy kick

  • accuracy – 1, scale for trajectory points number

  • end_poles – False, if True includes end poles with 1/4, -3/4, 1, …

Returns

ocelot.rad.coherent_radiation(lat, screen, p_array, energy_loss=False, quantum_diff=False, accuracy=1, end_poles=False, verbose=True)

Function to calculate radiation from the electron beam.

Parameters
  • lat – MagneticLattice should include element Undulator

  • screen – Screen class

  • p_array – ParticleArray - the radiation is calculated for the each particles in the ParticleArray and field components is summing up afterwards.

  • energy_loss – False, if True includes energy loss after each period

  • quantum_diff – False, if True introduces random energy kick

  • accuracy – 1, scale for trajectory points number

  • verbose – True, print progress

Returns

ocelot.rad.lambda2eV(Lambda)
ocelot.rad.eV2lambda(Ephoton)
ocelot.rad.Ephoton2K(Eph, lu=0.04, Eeb=14)
ocelot.rad.K2Ephoton(K, lu=0.04, E=14)
ocelot.rad.K2Lambda(K, lu=0.04, E=14)
ocelot.rad.field2K(field, lu=0.04)

function to translate magnetic field in [T] to K parameter :param field: in [T] :param lu: undulator period in [m] :return: K

ocelot.rad.K2field(K, lu=0.04)
ocelot.rad.field2Ephoton(field, lu=0.04, E=14)
ocelot.rad.Ephoton2field(energy, lu=0.04, Eeb=14)
ocelot.rad.lambda2Ebeam(Lambda=1.04e-08, lu=0.0272, K=1.2392)
ocelot.rad.print_rad_props(beam, K, lu, L, distance)

Simple function to estimate radiation properties and print them

Parameters
  • beam – Beam

  • K – undulator deflection parameter

  • lu – undulator period in [m]

  • L – undulator length in [m]

  • distance – distance to the screen im [m]

Returns