:mod:`ocelot.rad` ================= .. py:module:: ocelot.rad Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 bmrad/index.rst fel/index.rst fel_estimator/index.rst optics_elements/index.rst optics_line/index.rst propagation/index.rst radiation_py/index.rst screen/index.rst spline_py/index.rst transfer_function/index.rst undulator_params/index.rst Package Contents ---------------- Classes ~~~~~~~ .. autoapisummary:: ocelot.rad.Screen Functions ~~~~~~~~~ .. autoapisummary:: ocelot.rad.sigma_gamma_quat ocelot.rad.calculate_radiation ocelot.rad.coherent_radiation ocelot.rad.lambda2eV ocelot.rad.eV2lambda ocelot.rad.Ephoton2K ocelot.rad.K2Ephoton ocelot.rad.K2Lambda ocelot.rad.field2K ocelot.rad.K2field ocelot.rad.field2Ephoton ocelot.rad.Ephoton2field ocelot.rad.lambda2Ebeam ocelot.rad.print_rad_props .. py:class:: 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 .. method:: update(self) .. method:: 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. :param x0: initial the electron coordinate :param y0: initial the electron coordinate :param z0: initial the electron coordinate :return: .. method:: screen_to_emscreen(self, screen) .. method:: create_empty_emclass(self) .. method:: nullify(self) .. method:: create_like(self, em_screen) .. method:: screenPy2C(self, lperiod, nperiods, status) .. method:: screenC2Py(self, c_screen) .. method:: 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)) :param gamma: :param current: in A :return: .. method:: 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() :return: .. method:: zerosArray(self) .. method:: screen2dict(self) .. method:: dict2screen(self, dictionaty) .. 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:: 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:: lambda2eV(Lambda) .. function:: eV2lambda(Ephoton) .. function:: Ephoton2K(Eph, lu=0.04, Eeb=14) .. function:: K2Ephoton(K, lu=0.04, E=14) .. function:: K2Lambda(K, lu=0.04, E=14) .. function:: 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 .. function:: K2field(K, lu=0.04) .. function:: field2Ephoton(field, lu=0.04, E=14) .. function:: Ephoton2field(energy, lu=0.04, Eeb=14) .. function:: lambda2Ebeam(Lambda=1.04e-08, lu=0.0272, K=1.2392) .. function:: print_rad_props(beam, K, lu, L, distance) Simple function to estimate radiation properties and print them :param beam: Beam :param K: undulator deflection parameter :param lu: undulator period in [m] :param L: undulator length in [m] :param distance: distance to the screen im [m] :return: