""" Synchrotron Radiation power density =================================== Basic example of computation of the power density of the radiation emitted by an electron beam deflected by the :doc:`simple_dipole` magnet. """ # %% # Import modules required for simulations and for comparison with the # theoretical distribution of dipole radiation. import pysrw as srw # %% # We take as example the parameters of a typical bending magnet of a # third-generation light source (ALBA-Spain) energy = 3.0 # GeV rho = 7.047 # m length = 1.384 # m gap = 36e-3 # m # %% # The magnet is created with the default SRW model for dipoles and embedded in # a magnet container dipole = srw.magnets.Dipole(energy=energy, bendingR=rho, coreL=length, edgeL=gap) mag_container = srw.magnets.MagnetsContainer([dipole]) # %% # The last input for the simulation is the emitter, instance of # :py:func:`~pysrw.emitters.ParticleBeam`. Note that we leave the default # beam intensity of 1 A beam = srw.emitters.ParticleBeam(energy, xPos=0, yPos=0, zPos=0) # %% # Create a 5 mm x 5 mm observation mesh, with a resolution that # matches the horizontal symmetry of dipole radiation observer = srw.wavefronts.Observer(centerCoord=[0, 0, 5], obsXextension=5e-3, obsYextension=5e-3, obsXres=200e-6, obsYres=20e-6) # %% # We can finally simulate and plot the power density radiated by the beam pwrDensity = srw.computeSrPowerDensity(particleBeam=beam, magnetsContainer=mag_container, observer=observer, relPrec=10.) srw.plotPwrDensity(pwrDensity)