Generate and return the energy integral (the energy fluence in units of the input break energy) of the Band model for the given distribution parameters from the corresponding photon integral of the distribution (the photon fluence in units of photon counts).
More...
Generate and return the energy integral (the energy fluence in units of the input break energy) of the Band model for the given distribution parameters from the corresponding photon integral of the distribution (the photon fluence in units of photon counts).
See the documentation of pm_distBand for more information on the Band distribution.
This generic interface computes one of the following quantities:
-
Conversion of photon fluence to energy fluence.
\begin{equation}
\large
\sergs = \sphot \frac
{ \int_{\ms{lb}}^{\ms{ub}} E ~ f_{\ms{BAND}}(E | \alpha, \beta, \ebreak) dE }
{ \int_{\ms{lb}}^{\ms{ub}} f_{\ms{BAND}}(E | \alpha, \beta, \ebreak) dE }
~.
\end{equation}
-
Conversion of photon fluence to energy fluence in a different energy range.
\begin{equation}
\large
\sergs = \sphot \frac
{ \int_{\ms{lbnew}}^{\ms{ubnew}} E ~ f_{\ms{BAND}}(E | \alpha, \beta, \ebreak) dE }
{ \int_{\ms{lb}}^{\ms{ub}} f_{\ms{BAND}}(E | \alpha, \beta, \ebreak) dE }
~.
\end{equation}
-
Conversion of energy fluence to energy fluence in a different energy range.
\begin{equation}
\large
\sergs = \sergs \frac
{ \int_{\ms{lbnew}}^{\ms{ubnew}} E ~ f_{\ms{BAND}}(E | \alpha, \beta, \ebreak) dE }
{ \int_{\ms{lb}}^{\ms{ub}} E ~ f_{\ms{BAND}}(E | \alpha, \beta, \ebreak) dE }
~.
\end{equation}
- Warning
- The input arguments
lbnew
, ubnew
, energy
, lb
, ub
, ebreak
must all be unit-less (without physical dimensions) or all have the same physical units (typically, \(\kev\)).
- Note
- The physical units of the input or output arguments can be changed via the facilities of module pm_physUnit.
- Parameters
-
[in,out] | energy | : The input/output positive scalar or array of the same shape as any input array-like argument, of type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128), containing the energy integral of the distribution (energy fluence).
-
If the input argument
photon is present, then energy has intent(out) .
On output, the value of energy represents the energy fluence of the Band model in the original or the newly-specified energy window.
-
If the input argument
photon is missing, then energy has intent(inout) .
On input, the value of energy is used to computed the amplitude of the Band model in the old energy window.
On output, the value of energy represents the energy fluence of the Band model in the new energy window.
|
[in] | photon | : The input positive scalar or array of the same shape as any input array-like argument, of the same type and kind as the input argument photon , representing the energy integral of the Band distribution (photon counts) with the specified input distribution parameters.
(optional. If missing, the original fluence is read from the input value of energy and is assumed to have energy units.) |
[in] | lbnew | : The input positive scalar or array of the same shape as any input array-like argument, of the same type and kind as the input argument photon , representing the new lower bound of the Band distribution.
(optional. It must be present if and only if the input argument ubnew is present and energy is missing.) |
[in] | ubnew | : The input positive scalar or array of the same shape as any input array-like argument, of the same type and kind as the input argument photon , representing the new upper bound of the Band distribution.
(optional. It must be present if and only if the input argument lbnew is present and energy is missing.) |
[in] | lb | : The input positive scalar or array of the same shape as any input array-like argument, of the same type and kind as the input argument photon , representing the lower bound of the Band distribution.
|
[in] | ub | : The input positive scalar or array of the same shape as any input array-like argument, of the same type and kind as the input argument photon , representing the upper bound of the Band distribution.
|
[in] | alpha | : The input scalar or array of the same shape as other array-like arguments of the same type and kind as photon , containing the first shape parameter of the distribution.
|
[in] | beta | : The input scalar or array of the same shape as other array-like arguments of the same type and kind as photon , containing the second shape parameter of the distribution.
|
[in] | ebreak | : The input scalar or array of the same shape as other array-like arguments of the same type and kind as photon , containing the spectral break energy values.
|
[out] | info | : The input scalar of type integer of default kind IK.
On output, it is set to positive the number of iterations taken for the series representation of the Gamma function to converge.
If the algorithm fails to converge, then info is set to the negative of the number of iterations taken by the algorithm or, to the negative of the output error returned by brute force integrator getQuadErr.
An negative output value signifies the lack of convergence and failure to compute the UCDF.
This is likely to happen if the input value for alpha or beta are too extreme.
|
Possible calling interfaces ⛓
call setBandEnergy(energy, photon, lb, ub, alpha, beta, ebreak, info)
call setBandEnergy(energy, lbnew, ubnew, photon, lb, ub, alpha, beta, ebreak, info)
call setBandEnergy(energy, lbnew, ubnew, lb, ub, alpha, beta, ebreak, info)
Generate and return the energy integral (the energy fluence in units of the input break energy) of th...
This module contains procedures and generic interfaces for computing the Band photon distribution wid...
- Warning
- The condition
0 < lb
must hold for the corresponding input arguments.
The condition lb < ub
must hold for the corresponding input arguments.
The condition 0 < lbnew
must hold for the corresponding input arguments.
The condition lbnew < ubnew
must hold for the corresponding input arguments.
The condition 0 < photon
must hold for the corresponding input arguments.
The condition 0 < energy
must hold for the corresponding input arguments.
The condition 0 < lbnew
must hold for the corresponding input arguments.
The condition 0 < ubnew
must hold for the corresponding input arguments.
The condition alpha /= -2
must hold for the corresponding input arguments.
The condition 0 < ebreak
must hold for the corresponding input arguments.
The condition beta < alpha
must hold for the corresponding input arguments.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1
.
-
The
pure
procedure(s) documented herein become impure
when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1
.
By default, these procedures are pure
in release
build and impure
in debug
and testing
builds.
- Note
- The normalization (and the physical units) of the input
energy
is irrelevant as long as the other dimensional input values (e.g., ebreak
) are computed in the same physical dimensions and with the same normalizations.
- See also
- getBandUDF
setBandUCDF
setBandMean
getBandZeta
getBandEpeak
getBandEbreak
setBandPhoton
setBandEnergy
Example usage ⛓
13 type(display_type) :: disp
19 real(RKG) :: energy, photon, lbnew, ubnew, lb, ub, alpha, beta, ebreak
22 call disp%show(
"photon = 1.084876_RKG * ERGS2KEV; lbnew = 50._RKG; ubnew = 300._RKG; lb = 50._RKG; ub = 300._RKG; alpha = -9.469590e-01_RKG; beta = -3.722981_RKG; ebreak = getBandEbreak(alpha, beta, 1.928073e+02_RKG);")
23 photon
= 1.084876_RKG * ERGS2KEV; lbnew
= 50._RKG; ubnew
= 300._RKG; lb
= 50._RKG; ub
= 300._RKG; alpha
= -9.469590e-01_RKG; beta
= -3.722981_RKG; ebreak
= getBandEbreak(alpha, beta,
1.928073e+02_RKG);
24 call disp%show(
"call setBandEnergy(energy, photon, lb, ub, alpha, beta, ebreak, info)")
25 call setBandEnergy(energy, photon, lb, ub, alpha, beta, ebreak, info)
26 call disp%show(
"if (info < 0) error stop")
27 if (info
< 0)
error stop
28 call disp%show(
"energy ! energy fluence 2.044544e-07")
41 integer(IK),
parameter :: NP
= 1000_IK
42 real(RKG) :: energy(
4), epeak(NP), alpha(
4), beta(
4)
43 integer :: fileUnit, i
44 integer(IK) :: info(
4)
46 alpha
= [.
5_RKG,
1.5_RKG,
-.
5_RKG,
-1.1_RKG]
47 beta
= -[.
5_RKG,
1._RKG,
2._RKG,
3._RKG]
48 call setLogSpace(epeak,
log(
1._RKG),
log(
10000._RKG))
49 open(newunit
= fileUnit, file
= "setBandEnergy.RK.txt")
51 call setBandEnergy(energy,
0.01_RKG,
20000._RKG,
1._RKG,
50._RKG,
300._RKG, alpha, beta,
getBandEbreak(alpha, beta, epeak(i)), info)
52 if (
any(info
< 0))
error stop
53 write(fileUnit,
"(*(g0,:,' '))") epeak(i), energy
Return the logSpace output argument with size(logSpace) elements of logarithmically-evenly-spaced val...
Generate and return the spectral break energy parameter of the Band spectral model/distribution from ...
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
This module contains procedures and generic interfaces for generating arrays with linear or logarithm...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter RKD
The double precision real kind in Fortran mode. On most platforms, this is an 64-bit real kind.
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
integer, parameter RKH
The scalar integer constant of intrinsic default kind, representing the highest-precision real kind t...
This module contains relevant physical constants.
real(RKB), parameter ERGS2KEV
The scalar constant of type real of kind RKB representing one ergs of energy in kilo-electronvolts.
real(RKB), parameter KEV2ERGS
The scalar constant of type real of kind RKB representing one kilo-electronvolts of energy in ergs.
Generate and return an object of type display_type.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example output ⛓
2photon
= 1.084876_RKG * ERGS2KEV; lbnew
= 50._RKG; ubnew
= 300._RKG; lb
= 50._RKG; ub
= 300._RKG; alpha
= -9.469590e-01_RKG; beta
= -3.722981_RKG; ebreak
= getBandEbreak(alpha, beta,
1.928073e+02_RKG);
3call setBandEnergy(energy, photon, lb, ub, alpha, beta, ebreak, info)
4if (info
< 0)
error stop
Postprocessing of the example output ⛓
3import matplotlib.pyplot
as plt
12label = [
r"$\alpha, \beta = +0.5, -0.5, x_b = 0.5$"
13 ,
r"$\alpha, \beta = +1.5, -1.0, x_b = 1.5$"
14 ,
r"$\alpha, \beta = -0.5, -2.0, x_b = 2.0$"
15 ,
r"$\alpha, \beta = -1.1, -3.0, x_b = 5.0$"
18pattern =
"*." + kind +
".txt"
19fileList = glob.glob(pattern)
22 df = pd.read_csv(fileList[0], delimiter =
" ")
24 fig = plt.figure(figsize = 1.25 * np.array([6.4, 4.8]), dpi = 200)
27 for i
in range(1,len(df.values[0,:]+1)):
29 plt.plot( df.values[:, 0]
34 plt.xticks(fontsize = fontsize - 2)
35 plt.yticks(fontsize = fontsize - 2)
36 ax.set_xlabel(
"Epeak [ keV ]", fontsize = fontsize)
37 ax.set_ylabel(
"Photon count in 50-300 keV range", fontsize = fontsize)
41 plt.grid(visible =
True, which =
"both", axis =
"both", color =
"0.85", linestyle =
"-")
42 ax.tick_params(axis =
"y", which =
"minor")
43 ax.tick_params(axis =
"x", which =
"minor")
51 plt.savefig(fileList[0].replace(
".txt",
".png"))
55 sys.exit(
"Ambiguous file list exists.")
Visualization of the example output ⛓
- Test:
- test_pm_distBand
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
-
If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
-
If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
- Copyright
- Computational Data Science Lab
- Author:
- Amir Shahmoradi, Oct 16, 2009, 11:14 AM, Michigan
Definition at line 1605 of file pm_distBand.F90.