_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 either thick-target or thin-target

  • photon_energies (numpy.array) – Array containing lower integration limits

  • maxfcn (int) – Maximum number of points used in Gaussian quadrature integration

  • rerr (float) – Desired relative error for integral evaluation

  • eelow (float) – Low energy electron cutoff

  • eebrk (float) – Break energy

  • eehigh (float) – High energy electron cutoff

  • p (float) – Slope below the break energy

  • q (float) – Slope above the break energy

  • z (float) – Mean atomic number of plasma

  • efd (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:

tuple

References

Initial version modified from SSW Brm2_DmlinO and Brm2_Dmlin.