:mod:`ocelot.rad.radiation_py` ============================== .. py:module:: ocelot.rad.radiation_py Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: ocelot.rad.radiation_py.Motion ocelot.rad.radiation_py.BeamTraject Functions ~~~~~~~~~ .. autoapisummary:: ocelot.rad.radiation_py.bspline ocelot.rad.radiation_py.integ_beta2 ocelot.rad.radiation_py.x2xgaus ocelot.rad.radiation_py.traj2motion ocelot.rad.radiation_py.und_field_py ocelot.rad.radiation_py.energy_loss_und ocelot.rad.radiation_py.sigma_gamma_quat ocelot.rad.radiation_py.quantum_diffusion ocelot.rad.radiation_py.field_map2field_func ocelot.rad.radiation_py.gintegrator ocelot.rad.radiation_py.gintegrator_over_traj_py ocelot.rad.radiation_py.wrap_gintegrator ocelot.rad.radiation_py.radiation_py ocelot.rad.radiation_py.calculate_radiation ocelot.rad.radiation_py.coherent_radiation ocelot.rad.radiation_py.track4rad_beam .. data:: __author__ :annotation: = Sergey Tomin can read different types of files. By default, mag_file is in [mm] . for python version, only vertical component of magnetic field (By) is taken into account. In order to overcome this limitation, someone have to change function radiation_py.field_map2field_func(z, By). Sergey Tomin 04.11.2016. .. data:: _logger .. data:: nb_flag :annotation: = True .. py:class:: Motion .. py:class:: BeamTraject(beam_trajectories) A class for storing and retrieving the coordinates of the n-th particle from the table with all trajectories. method: x(n=0) - array, horizontal coordinates of the n-th particle method: y(n=0) - array, vertical coordinates of the n-th particle method: xp(n=0) - array, x' = dx/dz coordinates of the n-th particle method: yp(n=0) - array, y' = dy/dz coordinates of the n-th particle method: z(n=0) - array, longitudinal coordinates in Cartesian coordinate system of the n-th particle method: s(n=0) - array, longitudinal coordinates in moving coordinate system of the n-th particle .. method:: n(self) .. method:: check(self, n) .. method:: x(self, n=0) .. method:: y(self, n=0) .. method:: z(self, n=0) .. method:: xp(self, n=0) .. method:: yp(self, n=0) .. method:: p(self, n=0) .. method:: s(self, n=0) .. method:: p_array_end(self, p_array) .. function:: bspline(x, y, x_new) .. function:: integ_beta2(x, y) .. function:: x2xgaus(X) transform coordinates for gauss integration | | | | -> | x x x . x x x . x x x | | - coordinate x - new coordinate . - removed coordinate | :param X: array :return: new array .. function:: traj2motion(traj) .. function:: und_field_py(x, y, z, lperiod, Kx, nperiods=None) .. data:: und_field .. function:: energy_loss_und(energy, Kx, lperiod, L, energy_loss=False) .. function:: sigma_gamma_quat(energy, Kx, lperiod, L) rate of energy diffusion :param energy: electron beam energy :param Kx: undulator parameter :param lperiod: undulator period :param L: length :return: sigma_gamma/gamma .. function:: quantum_diffusion(energy, Kx, lperiod, L, quantum_diff=False) .. function:: field_map2field_func(z, By) .. function:: gintegrator(Xscr, Yscr, Erad, motion, screen, n, n_end, gamma, half_step) :param Xscr: :param Yscr: :param Erad: :param motion: :param screen: :param n: :param n_end: :param gamma: :param half_step: :return: .. function:: gintegrator_over_traj_py(Nmotion, Xscr, Yscr, Erad, n_end, gamma, half_step, Distance, x, y, z, bx, by, XbetaI2, YbetaI2, Bx, By, arReEx, arImEx, arReEy, arImEy, arPhase) .. data:: gintegrator_over_traj .. function:: wrap_gintegrator(Nmotion, Xscr, Yscr, Erad, motion, screen, n_end, gamma, half_step) .. function:: radiation_py(gamma, traj, screen) screen format screen->ReEx[ypoint*xpoint*je + xpoint*jy + jx] += EreX; .. function:: calculate_radiation(lat, screen, beam, energy_loss=False, quantum_diff=False, accuracy=1, end_poles=False) Function to calculate radation from the electron beam. :param lat: MagneticLattice should include element Undulator :param screen: Screen class :param beam: Beam class, the radiation is calculated from one electron :param energy_loss: False, if True includes energy loss after each period :param quantum_diff: False, if True introduces random energy kick :param accuracy: 1, scale for trajectory points number :param end_poles: False, if True includes end poles with 1/4, -3/4, 1, ... :return: .. function:: 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. :param lat: MagneticLattice should include element Undulator :param screen: Screen class :param p_array: ParticleArray - the radiation is calculated for the each particles in the ParticleArray and field components is summing up afterwards. :param energy_loss: False, if True includes energy loss after each period :param quantum_diff: False, if True introduces random energy kick :param accuracy: 1, scale for trajectory points number :param verbose: True, print progress :return: .. function:: track4rad_beam(p_array, lat, energy_loss=False, quantum_diff=False, accuracy=1, end_poles=False) Function calculates the electron trajectory :param beam: Beam class :param lat: MagneticLattice class :param energy_loss: False, flag to calculate energy loss :param quantum_diff: False, flag to calculate quantum diffusion :param accuracy: 1, accuracy :return: U, E; U - list of u, u is 9xN array (6 coordinats and 3 mag field), E - list of energies .. data:: x