Cython Helper Functions
In addition to the below functions, the lapack, blas, special libraries from Scipy are available, as well as the libc library as math.
- starlord.cy_tools.uniform_lpdf(double x, double xmin, double xmax) double
- starlord.cy_tools.uniform_ppf(double x, double xmin, double xmax) double
- starlord.cy_tools.normal_lpdf(double x, double mean, double sigma) double
- starlord.cy_tools.normal_ppf(double p, double mean, double sigma) double
- starlord.cy_tools.normal_cdf(double x, double mean, double sigma) double
- starlord.cy_tools.beta_lpdf(double x, double alpha, double beta) double
- starlord.cy_tools.beta_ppf(double p, double alpha, double beta) double
- starlord.cy_tools.gamma_lpdf(double x, double alpha, double lamb) double
- starlord.cy_tools.gamma_ppf(double p, double alpha, double lamb) double
- starlord.cy_tools.exponential_lpdf(double x, double rate) double
- starlord.cy_tools.exponential_ppf(double p, double rate) double
- starlord.cy_tools.exponential_cdf(double x, double rate) double
- starlord.cy_tools.trunc_power_lpdf(double x, double k, double a, double b) double
- starlord.cy_tools.trunc_power_ppf(double p, double k, double a, double b) double
- starlord.cy_tools.trunc_normal_lpdf(double x, double mean, double sigma, double a, double b) double
- starlord.cy_tools.trunc_normal_ppf(double p, double mean, double sigma, double a, double b) double
- starlord.cy_tools.trunc_exponential_lpdf(double x, double rate, double a, double b) double
- starlord.cy_tools.trunc_exponential_ppf(double p, double rate, double a, double b) double
- starlord.cy_tools.chabrier_lpdf(double log_mass, double log_m_switch, double mean, double sigma, double rate) double
Initial mass function priors of the form from Chabrier (2002) table 2, as a log PDFs.
That paper lists the following constant values for different groups of stars:
Case
log_m_switch
mean
sigma
power
rate
Disk and Young Clusters
0.0
-1.10237
0.69
1.3
5.295945
Globular Clusters
-0.04575749
-0.48148
0.34
1.3
5.295945
Spheroid
-0.15490195
-0.65757
0.33
1.3
5.295945
In order to turn this into a prior on log_mass, the power-law distribution had to be transformed into an exponential distribution, hence the use of “rate” rather than “power”. The conversion is
rate = (1+power)*ln(10).
- starlord.cy_tools.chabrier_ppf(double p, double log_m_switch, double mean, double sigma, double rate) double
Initial mass function priors of the form from Chabrier (2002) table 2, as PPFs.
See
starlord.cy_tools.chabrier_lpdf()for more information.