# Gallery of plots and scripts 1. Synchrotron sources¶

## Synchrotron sources¶

The images below are produced by \tests\raycing\test_sources.py and by \examples\withRaycing\01_SynchrotronSources\synchrotronSources.py.

### Bending magnet¶

On a transversal screen the image is unlimited horizontally (practically limited by the front end). The energy distribution is red-shifted for off-plane photons. The polarization is primarily horizontal. The off-plane radiation has non-zero projection to the vertical polarization plane.

The off-plane radiation is in fact left and right polarized:

source circular polarization rate
using WS
internal xrt

The horizontal phase space projected to a transversal plane at the origin is parabolic:

zero electron beam size σx = 49 µm

### Multipole wiggler¶

The horizontal image size is determined by the parameter K. The energy distribution is red-shifted for off-plane photons. The polarization is primarily horizontal. The off-plane radiation has non-zero projection to the vertical polarization plane.

The horizontal longitudinal cross-section reveals a sinusoidal shape of the source. The horizontal phase space projected to the transversal plane at the origin has individual branches for each pole.

### Undulator¶

The module test_sources has functions for visualization of the angular and energy distributions of the implemented sources in 2D and 3D. This is especially useful for undulators because they have sharp peaks, which requires a proper selection of angular and energy meshes.

The ray traced images of an undulator source (produced by \examples\withRaycing\01_SynchrotronSources\synchrotronSources.py) are feature-rich. The polarization is primarily horizontal. The off-plane radiation has non-zero projection to the vertical polarization plane.

### Elliptical undulator¶

An elliptical undulator gives circular images with a higher circular polarization rate in the inner rings:

source deg. of pol. circular polarization rate
using Urgent
internal xrt

### Custom field undulator¶

A custom magnetic field can be specified by an Excel file or a column text file. The example below is based on a table supplied by Hamed Tarawneh [Tarawneh]. The idea of introducing quasi-periodicity is to shift the n-th harmonics down in energy relative to the exact n-fold multiple of the 1st harmonic energy. This trick eliminates higher monochromator harmonics that are situated at the exact n-fold energies, which is a safer solution compared to a gas absorption filter.

Compare the harmonic energies (half-maximum position at the higher energy side) of the 3rd harmonic with the triple energy of the 1st harmonic.

 [Tarawneh] Quasi-periodic undulator field for ARPES beamline at MAX IV 1.5 GeV ring, (2016) unpublished.

Note

The definition of xyz coordinate system differs for the tabulated field and for xrt screens: z is along the beam direction in the tabulation and as a vertical axis in xrt.

For validation, our calculations are compared here with those by Spectra for a particular case — quasi-periodic undulator defined by the same tabulated field, the 3rd harmonic, at E=20.5 eV. Notice again that Spectra provides either a spectrum or a transverse image while xrt can combine both by using colors and brightness. Notice also that on the following pictures the p-polarized flux is only ~3% of the total flux.