{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Synchrotron Radiation power density\n\nBasic example of computation of the power density of the radiation emitted \nby an electron beam deflected by the :doc:`simple_dipole` magnet.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Import modules required for simulations and for comparison with the \ntheoretical distribution of dipole radiation.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import pysrw as srw" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We take as example the parameters of a typical bending magnet of a \nthird-generation light source (ALBA-Spain)\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "energy = 3.0 # GeV\nrho = 7.047 # m\nlength = 1.384 # m\ngap = 36e-3 # m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The magnet is created with the default SRW model for dipoles and embedded in \na magnet container\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "dipole = srw.magnets.Dipole(energy=energy, bendingR=rho, \n coreL=length, edgeL=gap)\n\nmag_container = srw.magnets.MagnetsContainer([dipole])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The last input for the simulation is the emitter, instance of \n:py:func:`~pysrw.emitters.ParticleBeam`. Note that we leave the default \nbeam intensity of 1 A\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "beam = srw.emitters.ParticleBeam(energy, xPos=0, yPos=0, zPos=0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create a 5 mm x 5 mm observation mesh, with a resolution that\nmatches the horizontal symmetry of dipole radiation\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "observer = srw.wavefronts.Observer(centerCoord=[0, 0, 5],\n obsXextension=5e-3, \n obsYextension=5e-3,\n obsXres=200e-6,\n obsYres=20e-6)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can finally simulate and plot the power density radiated by the beam\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "pwrDensity = srw.computeSrPowerDensity(particleBeam=beam, \n magnetsContainer=mag_container,\n observer=observer, relPrec=10.)\nsrw.plotPwrDensity(pwrDensity)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.2" } }, "nbformat": 4, "nbformat_minor": 0 }