_split_and_integrate#
- sunkit_spex.emission._split_and_integrate(*, model, photon_energies, maxfcn, rerr, eelow, eebrk, eehigh, p, q, z, efd, integrator=None)[source]#
Split and integrate the continuous parts of the electron spectrum.
This is used for thin-target calculation from a double power-law electron density distribution To integrate a function via the method of Gaussian quadrature. Repeatedly doubles the number of points evaluated until convergence, specified by the input rerr, is obtained, or the maximum number of points, specified by the input maxfcn, is reached. If integral convergence is not achieved, this function raises a ValueError when either the maximum number of function evaluations is performed or the number of Gaussian points to be evaluated exceeds maxfcn. Maxfcn should be less than or equal to 2^nlim, or 4096 with nlim = 12. This function splits the numerical integration into up to three parts and returns the sum of the parts. This avoids numerical problems with discontinuities in the electron distribution function at eelow and eebrk.
- Parameters:
model (
str
) – Electron model eitherthick-target
orthin-target
photon_energies (
numpy.array
) – Array containing lower integration limitsmaxfcn (
int
) – Maximum number of points used in Gaussian quadrature integrationrerr (
float
) – Desired relative error for integral evaluationeelow (
float
) – Low energy electron cutoffeebrk (
float
) – Break energyeehigh (
float
) – High energy electron cutoffp (
float
) – Slope below the break energyq (
float
) – Slope above the break energyz (
float
) – Mean atomic number of plasmaefd (
bool
) – True - electron flux density distribution, False - electron density distribution. This input is not used in the main routine, but is passed to Brm_Fthin()
- Returns:
(DmlinO, irer) Array of integral evaluation and array of error flags
- Return type:
References
Initial version modified from SSW Brm2_DmlinO and Brm2_Dmlin.