Generate and return the unnormalized Comoving Star Formation Rate (SFR) density for a given redshift \(z\) based on the estimates of Hopkins and Beacom et al. (2006), assuming a piecewise power-law fit.
More...
Generate and return the unnormalized Comoving Star Formation Rate (SFR) density for a given redshift \(z\) based on the estimates of Hopkins and Beacom et al. (2006), assuming a piecewise power-law fit.
- Parameters
-
[in] | logzplus1 | : The input non-negative scalar, or array of arbitrary rank, of type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128) representing the natural logarithm of the cosmological redshift plus one, \(\log(z+1)\), at which the formation rate density must be computed. |
- Returns
logRateDensity
: The output of the same type and kind as the input argument logzplus1
containing the natural logarithm of the cosmic formation rate density of stars at the requested redshift.
Possible calling interfaces ⛓
Generate and return the unnormalized Comoving Star Formation Rate (SFR) density for a given redshift ...
This module contains procedures and generic interfaces for computing the cosmic rates of celestial ph...
- Warning
- 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.
- See also
- getLogRateDensityL08
getLogRateDensityM14
getLogRateDensityM17
getLogRateDensityF18
getLogRateDensityB10
getLogRateDensityP15
Example usage ⛓
10 type(display_type) :: disp
11 real(RKG) :: redshift
= 5.5_RKG
15 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
16 call disp%show(
"!Compute the log(RateDensity) according to the H06 LGRB rate density parameters for the Hopkins and Beacom (2006) SFR model.")
17 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
23 call disp%show(
"getLogRateDensityH06(log(redshift + 1))")
31 integer(IK) :: fileUnit, i
32 real(RKG) :: maxRateFormLGRB, maxRateDensityFormLGRB
33 real(RKG),
allocatable :: zplus1(:), logzplus1(:), rateFormLGRB(:), rateDensityFormLGRB(:)
34 logzplus1
= getLinSpace(
0.01_RKG,
log(
13._RKG),
500_IK)
35 zplus1
= exp(logzplus1)
37 rateFormLGRB
= rateDensityFormLGRB
* getVolComDiffNormed(zplus1, reltol
= sqrt(
epsilon(
0._RKG)))
38 maxRateDensityFormLGRB
= maxval(rateDensityFormLGRB)
39 maxRateFormLGRB
= maxval(rateFormLGRB)
40 open(newunit
= fileUnit, file
= "getLogRateDensityH06.csv")
41 write(fileUnit,
"(*(g0,:,','))")
"redshift, rateFormLGRB, rateDensityFormLGRB"
42 do i
= 1,
size(zplus1)
43 write(fileUnit,
"(*(g0,:,','))") zplus1(i)
- 1, rateFormLGRB(i)
/ maxRateFormLGRB, rateDensityFormLGRB(i)
/ maxRateDensityFormLGRB
53 type(paradram_type) :: sampler
55 sampler
%outputFileName
= "./zdistH06"
56 sampler
%outputStatus
= "retry"
57 sampler
%domainAxisName
= [
"redshift"]
58 sampler
%domainCubeLimitLower
= [
0._RKG]
59 sampler
%outputSampleSize
= 2500
60 sampler
%outputChainSize
= 5000
61 sampler
%proposalStart
= [
3]
63 if (err
%occurred)
error stop err
%msg
68 recursive function getLogFunc(redshift)
result(logRateDensity)
70 real(RKG),
intent(in),
contiguous :: redshift(:)
71 real(RKG) :: logRateDensity
73 zplus1
= redshift(
1)
+ 1
Generate count evenly spaced points over the interval [x1, x2] if x1 < x2, or [x2,...
Generate and return the cosmological Comoving Volume Element per unit solid angle of the sky (i....
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.
Generate and return .true. if the procedure fails to fully accomplish the task of Monte Carlo samplin...
This module contains procedures and generic interfaces for generating arrays with linear or logarithm...
This module contains procedures and generic interfaces and constants for cosmological calculations.
This module contains classes and procedures for reporting and handling errors.
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...
This module contains procedures and generic interfaces for the ParaMonte library sampler routines.
This is the derived type for generating objects to gracefully and verbosely handle runtime unexpected...
Generate and return an object of type display_type.
This is a derived type for constructing objects containing the optional simulation properties of the ...
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 ⛓
Postprocessing of the example output ⛓
5examname = os.path.basename(os.getcwd())
6modelName = examname[-3:]
10import matplotlib.pyplot
as plt
16df = pd.read_csv(examname +
".csv", delimiter =
",")
18fig = plt.figure(figsize = 1.25 * np.array([6.4, 4.8]), dpi = 200)
21for colname
in df.columns[1:]:
22 plt.plot( df.values[:, 0]
29for colname
in list(df.columns[1:]): labels.append(modelName +
": " + colname)
36ax.set_xlabel(df.columns[0], fontsize = fontsize)
37ax.set_ylabel(
"Unnormalized Density", fontsize = fontsize)
39plt.grid(visible =
True, which =
"both", axis =
"both", color =
"0.85", linestyle =
"-")
40ax.tick_params(axis =
"y", which =
"minor")
41ax.tick_params(axis =
"x", which =
"minor")
42plt.xticks(fontsize = fontsize)
43plt.yticks(fontsize = fontsize)
46plt.savefig(examname +
".z.png")
55files = glob.glob(
"./*_sample.txt")
60 df = pd.read_csv(file, delimiter =
",")
61 if "_chain.txt" in file:
63 elif "_sample.txt" in file:
66 sys.exit(
"Unrecognized simulation output file: " + file)
70 for histname
in [
"z",
"logzplus1"]:
72 fig = plt.figure(figsize = (8, 6))
73 ax = plt.subplot(1,1,1)
75 ax.hist(df.values[:, sindex:])
76 elif histname ==
"logzplus1":
77 ax.hist(np.log(df.values[:, sindex:]))
79 sys.exit(
"Unrecognized histogram name: " + histname)
82 ax.set_ylabel(
"Count", fontsize = 17)
83 ax.set_xlabel(
"log( z + 1 )", fontsize = 17)
84 ax.tick_params(axis =
"x", which =
"minor")
85 ax.tick_params(axis =
"y", which =
"minor")
86 plt.grid(visible =
True, which =
"both", axis =
"both", color =
"0.85", linestyle =
"-")
87 plt.title(
"Histogram of the simulated redshifts from\nthe rate density model of " + modelName)
89 plt.savefig(examname +
"." + histname +
".sample.png")
Visualization of the example output ⛓
- Test:
- test_pm_cosmicRate
- Todo:
- Very Low Priority: This generic interface can be extended to higher-rank input arrays.
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, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin
Definition at line 115 of file pm_cosmicRate.F90.