xoppylib.sources.urgentpy_spectrum

urgent_spectrum.py — URGENT Fortran faithful Python translation Walker & Diviacco, Rev. Sci. Instrum. 63, 392 (1992).

Two modes, matching the two Fortran paths:

zero_emittance=True → SUB4/ICALC=3 : RAD0 = F3 · |An|² · SINC at slit grid zero_emittance=False → SUB2/ICALC=1 : infinite-N envelope + sinc² convolution

Grid convention (both modes):

np.outer(x_mm, np.ones(NYP)) → shape (NXP, NYP), axis-0 = X = Fortran IB-loop np.outer(np.ones(NXP), y_mm) → shape (NXP, NYP), axis-1 = Y = Fortran IC-loop W2d = np.outer(Wx, Wy) with the same (NXP, NYP) layout.

Convolution (emittance mode):

Fortran: F(I) = sum_{J=1}^{NW} G(I + NE1 - J) * H(J) * DW (1-indexed) Python: F[i] = sum_{j=0}^{NW-1} G[i + NE1_py - j] * H[j] * DW (0-indexed) where NE1_py = NOMEGA//2 (= Fortran NE1 - 1).

Functions

calc1d_urgentpy(bl[, photonEnergyMin, ...])

Undulator spectral flux [ph/s/0.1%bw] through a rectangular slit.

harmonic_energy(n, K, period_m, gamma)