desc.integrals.Bounce1D.integrate
- Bounce1D.integrate(integrand, pitch_inv, data=None, names=None, points=None, *, num_well=None, method='cubic', quad=None, check=False, plot=False, **kwargs)Source
Bounce integrate ∫ f(ρ,α,λ,ℓ) dℓ.
Computes the bounce integral ∫ f(ρ,α,λ,ℓ) dℓ for every field line and pitch.
Warning
Make sure to replace √(1−λB) with √|1−λB| or clip the radicand to some value near machine precision when defining
integrandto account for imperfect computation of bounce points.- Parameters:
integrand (callable or list[callable]) – The composition operator on the set of functions in
datathat determinesfin ∫ f(ρ,α,λ,ℓ) dℓ. It should accept a dictionary which stores the interpolated data and the argumentsBandpitch.pitch_inv (jnp.ndarray) – Shape (num ρ, num pitch). 1/λ values to compute the bounce integrals. 1/λ(ρ) is specified by
pitch_inv[ρ]where in the latter the labels are interpreted as the indices that correspond to that field line.data (dict[str, jnp.ndarray]) – Shape (num ρ, num α, num ζ). Real scalar-valued functions evaluated on the
gridsupplied to construct this object. Use the methodBounce1D.reshapeto reshape the data into the expected shape.names (str or list[str]) – Names in
datato interpolate. Default is all keys indata.points (tuple[jnp.ndarray]) – Shape (num ρ, num α, num pitch, num well). Optional, output of method
self.points. Tuple of length two (z1, z2) that stores ζ coordinates of bounce points. The points are ordered and grouped such that the straight line path betweenz1andz2resides in the epigraph of B.num_well (int or None) – See
self.pointsfor the description of this parameter.method (str) – Method of interpolation. See https://interpax.readthedocs.io/en/latest/_api/interpax.interp1d.html. Default is cubic C1 local spline.
quad (tuple[jnp.ndarray]) – Optional quadrature points and weights. If given this overrides the quadrature chosen when this object was made.
check (bool) – Flag for debugging. Must be false for JAX transformations.
plot (bool) – Whether to plot the quantities in the integrand interpolated to the quadrature points of each integral. Ignored if
checkis false.
- Returns:
result (jnp.ndarray or list[jnp.ndarray]) – Shape (num ρ, num α, num pitch, num well). Last axis enumerates the bounce integrals for a given field line and pitch value.