.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/power_density.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_power_density.py: 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. .. GENERATED FROM PYTHON SOURCE LINES 10-12 Import modules required for simulations and for comparison with the theoretical distribution of dipole radiation. .. GENERATED FROM PYTHON SOURCE LINES 12-15 .. code-block:: Python import pysrw as srw .. GENERATED FROM PYTHON SOURCE LINES 16-18 We take as example the parameters of a typical bending magnet of a third-generation light source (ALBA-Spain) .. GENERATED FROM PYTHON SOURCE LINES 18-24 .. code-block:: Python energy = 3.0 # GeV rho = 7.047 # m length = 1.384 # m gap = 36e-3 # m .. GENERATED FROM PYTHON SOURCE LINES 25-27 The magnet is created with the default SRW model for dipoles and embedded in a magnet container .. GENERATED FROM PYTHON SOURCE LINES 27-32 .. code-block:: Python dipole = srw.magnets.Dipole(energy=energy, bendingR=rho, coreL=length, edgeL=gap) mag_container = srw.magnets.MagnetsContainer([dipole]) .. GENERATED FROM PYTHON SOURCE LINES 33-36 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 .. GENERATED FROM PYTHON SOURCE LINES 36-38 .. code-block:: Python beam = srw.emitters.ParticleBeam(energy, xPos=0, yPos=0, zPos=0) .. GENERATED FROM PYTHON SOURCE LINES 39-41 Create a 5 mm x 5 mm observation mesh, with a resolution that matches the horizontal symmetry of dipole radiation .. GENERATED FROM PYTHON SOURCE LINES 41-47 .. code-block:: Python observer = srw.wavefronts.Observer(centerCoord=[0, 0, 5], obsXextension=5e-3, obsYextension=5e-3, obsXres=200e-6, obsYres=20e-6) .. GENERATED FROM PYTHON SOURCE LINES 48-49 We can finally simulate and plot the power density radiated by the beam .. GENERATED FROM PYTHON SOURCE LINES 49-52 .. code-block:: Python pwrDensity = srw.computeSrPowerDensity(particleBeam=beam, magnetsContainer=mag_container, observer=observer, relPrec=10.) srw.plotPwrDensity(pwrDensity) .. image-sg:: /examples/images/sphx_glr_power_density_001.png :alt: power density :srcset: /examples/images/sphx_glr_power_density_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Warning: Electron Beam Emittance was not taken into account. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 19.151 seconds) **Estimated memory usage:** 28 MB .. _sphx_glr_download_examples_power_density.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: power_density.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: power_density.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_