
==============================  Wiggler   ====================================

 Wiggler calculates the spectrum of a Wiggler Synchrotron Radiation source.

 The Flux and Spectral Power values calculated with Wiggler
 either i) fully integrated over vertical and horizontal emission angles,
 and ii) integrated over a defined rectangular slit.

MAGNETIC FIELD three possibilities:
  Sinusoidal or standard wiggler
  Asymmetric wiggler with magnetic field profile (for a single period)
    from a two columns file (y[meters], B[Tesla])
  Asymmetric wiggler with magnetic field calculated in function of a
    supplied file containing the harmonic expansion of the magnetic field
    profile. The file contains two columns: (# of harmonic, Bmax [T])



The algorithm is based on the following ideas:

1) calculate the electron transversal velocity from the integral of the magnetic field
   versus the s coordinate (along the ring).
   This velocity gives the horizontal divergence of the emission generated
   at that particular s point.

2) Calculate at each s point the local critical energy Ec (proportional to magnetic
   field).

3) Calculate the emission intensity for each s value and photon energy Ephoton, which
   is proportional to srfunc.sync_g1(Ephoton/Ec).

4) Check that the condition for betax (direction) to pass through the slit is satisfied.
   If not, set intensity to zero. 

Note that the storage ring emittance is not used. It is supposed that its effect is negligible
  as compared with the wiggler emission.

The calculation is done in srfunc.wiggler_spectrum_on_aperture.

Reference: http://dx.doi.org/10.18429/JACOW-MEDSI2020-WEPB17

