Chapter 8: The free-electron laser

Below is a set of python codes associated with Chapter 8 of Daniele Pelliccia and David M. Paganin, “Synchrotron Light: A Physics Journey from Laboratory to Cosmos” (Oxford University Press, 2025).

In order to run any of these python codes, you will need to include the following header.

Spatial modes

See Fig. 8.1.

Planck’s law

See Fig. 8.2.

Ponderomotive phase

See Fig. 8.7.

Numerical solution of the pendulum equation

See Fig. 8.8.

Phase-space trajectories

See Fig. 8.9.

Plot of the gain function

See Fig. 8.10.

Gain and line width: Madey’s theorem

See Fig. 8.11.

Relativistic length contraction of electric field lines

See Fig. 8.12.

First we define a function to calculate electric field components along two Cartesian coordinates.

Figure 8.12(b) can be generated using the code below. To generate Fig. 8.12(a), set the value of \gamma to 1.

High-gain simulations

The code to generate the high-gain simulation results in Figs. 8.14, 8.15, and 8.19 is longer than what it would fit in a single snippet. The entire Python script can be downloaded here.

 

Beam emittance

The following code generates the distribution in Fig. 8.18(b).

The following code generates the distribution in Fig. 8.18(c).

Bakers’ transformation

Figure 8.21 is generated using this Python script.

 

Separatrix

See Fig. 8.22.

Solution of eqn (8.57)

See Fig. 8.24.

Laminar filamentation

See Fig. 8.23. The constants required in this code block are defined in the previous block.

Stochastic layer

See Fig. 8.25.

Turbulent chaotic evolution

See Fig. 8.26. The function “pendulum_perturbation” using in this block, has been defined in the previous block of code.