Harmonic radiation and derivativesΒΆ
from syncmoments.stokes import stokes_harmonic
from syncmoments.derivatives import derivative_spectra
I, Q, V = stokes_harmonic(10, 5.0, 0.785, 1.047, B=5e-6)
value, gradient, hessian = derivative_spectra(10, 5.0, 0.785, 1.047, B=5e-6)
B is in Gauss; harmonic power is per source time in erg/s/sr. The reference is
vacuum radiation from a prescribed helical orbit, not a plasma-corrected or
self-consistent particle trajectory. Without B, the API preserves its legacy
dimensionless normalization. Differentiating that normalized response is a
different operation: physical fixed-B energy derivatives must include the
Lorentz-factor dependence of the gyrofrequency. These are fixed-harmonic
quantities. Fixed-frequency predictions also need the moving harmonic line
positions and a declared frequency/channel response.
The natural basis uses Q=parallel-perpendicular to the projected magnetic
field and V=-2 Im(E_parallel E_perpendicular*). A fixed sky azimuth phi gives
Q_sky=Q*cos(2phi), U_sky=Q*sin(2phi). The recurrence implementation includes
the viewing-axis limit. Isotropic pitch angles alone do not force V to vanish.
Integer Bessel J uses a periodic integral with a contour shift to resolve
exponentially small values. A concrete harmonic sets its static resolution;
for traced orders the default is 2048 nodes. bessel_jn(..., n_nodes=...)
exposes that static choice. bessel_jn returns NaN instead of an aliased
answer for unresolved n+abs(x)>n_nodes/2, and for negative or non-integral
n. bessel_jn_neighbours(n, x) returns J_{n-1}, J_{n+1} and J_n'
from one quadrature on the order-n contour. It needs J_{n+1}, so it
returns NaN for n+1+abs(x)>n_nodes/2, for n<1 and for non-integral n
(at n_nodes=128, n=10, x=53.5 it gives NaN while bessel_jn is
finite). Automatic derivatives through these quadratures lose accuracy at
abs(x) << n: the third x-derivative of J_0 from
bessel_jn_neighbours(1, x) at x=1e-6 (128 nodes) is -83.2 against the
true 3.75e-7 (see the bessel_jn_neighbours docstring).
HarmonicKernel differentiates the Bessel triple by the order recurrence
instead. These guards are not accuracy
certificates: validate resolution and derivatives over the actual domain. Modified K and continuum
F/G use continuous hyperbolic integrals. Their public tail-bound helpers bound
only the finite integral tail, excluding quadrature and roundoff. F(0)=G(0)=0;
the continuum slopes diverge there, so derivative tests concern positive x.
sed.power_law_emissivity_abs(..., theta=...) gives directional ordered-field
continuum emissivity. Its theta=None default additionally averages viewing
angles/random field axes with the normalized sin(theta)/2 measure. Isotropic
electron pitch angles alone do not perform that viewing-direction average.