astromodels.functions.priors module
- class astromodels.functions.priors.Beta(**kwargs)[source]
Bases:
Function1D
description :
A beta distribution function
latex : $ f(x, a, b)=frac{Gamma(a+b) x^{a-1}(1-x)^{b-1}}{Gamma(a) Gamma(b)}$
parameters :
a :
desc : first shape parameter initial value : 0.5 min: 0.
b :
desc : second shape parameter initial value : 0.5 min: 0.
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.priors.Cauchy(**kwargs)[source]
Bases:
Function1D
description :
The Cauchy distribution
latex : $ K frac{1}{ gamma pi} left[ frac{gamma^2}{(x-x_0)^2 + gamma^2} right] $
parameters :
K :
desc : Integral between -inf and +inf. Fix this to 1 to obtain a Cauchy distribution initial value : 1
x0 :
desc : Central value initial value : 0.0
gamma :
desc : standard deviation initial value : 1.0 min : 1e-12
- tests :
{ x : 0.0, function value: 0.3989422804014327, tolerance: 1e-10}
{ x : -1.0, function value: 0.24197072451914337, tolerance: 1e-9}
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.priors.Cosine_Prior(**kwargs)[source]
Bases:
Function1D
description :
A function which is constant on the interval angular interval of cosine
latex : $cos(x)$
parameters :
lower_bound :
desc : Lower bound for the interval initial value : -90 min : -np.inf max : np.inf
upper_bound :
desc : Upper bound for the interval initial value : 90 min : -np.inf max : np.inf
value :
desc : Value in the interval initial value : 1.0
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- has_fixed_units()[source]
Returns True if this function cannot change units, which is the case only for very specific functions (like models from foreign libraries like Xspec)
- Returns:
True or False
- static info()
- class astromodels.functions.priors.Exponential(**kwargs)[source]
Bases:
Function1D
description :
An exponential distribution function
latex : $ f(x, alpha) = alphaexp(-alpha x)$
parameters :
alpha :
desc : first shape parameter initial value : 1 min: 0.
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.priors.Gamma(**kwargs)[source]
Bases:
Function1D
description :
A gamma distribution function
latex : $ f(x, alpha, beta)=frac{beta^alpha x^{alpha-1} e^{-beta x}}{Gamma(alpha)}$
parameters :
alpha :
desc : first shape parameter initial value : 0.5 min: 0.
beta :
desc : second shape parameter initial value : 1. min: 0.
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.priors.Gaussian(**kwargs)[source]
Bases:
Function1D
description :
A Gaussian function
latex : $ K frac{1}{sigma sqrt{2 pi}}exp{frac{(x-mu)^2}{2~(sigma)^2}} $
parameters :
F :
desc : Integral between -inf and +inf. Fix this to 1 to obtain a Normal distribution initial value : 1
mu :
desc : Central value initial value : 0.0
sigma :
desc : standard deviation initial value : 1.0 min : 1e-12
- tests :
{ x : 0.0, function value: 0.3989422804014327, tolerance: 1e-10}
{ x : -1.0, function value: 0.24197072451914337, tolerance: 1e-9}
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.priors.Log_normal(**kwargs)[source]
Bases:
Function1D
description :
A log normal function
latex : $ K frac{1}{ x sigma sqrt{2 pi}}exp{frac{(log x/piv - mu/piv)^2}{2~(sigma)^2}} $
parameters :
- F :
desc : Integral between 0and +inf. Fix this to 1 to obtain a log Normal distribution initial value : 1
mu :
desc : Central value initial value : 0.0
sigma :
desc : standard deviation initial value : 1.0 min : 1e-12
- piv :
desc : pivot. Leave this to 1 for a proper log normal distribution initial value : 1.0 fix : yes
- tests :
{ x : 0.0, function value: 0.3989422804014327, tolerance: 1e-10}
{ x : -1.0, function value: 0.24197072451914337, tolerance: 1e-9}
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.priors.Log_uniform_prior(**kwargs)[source]
Bases:
Function1D
description :
A function which is K/x on the interval lower_bound - upper_bound and 0 outside the interval. The extremes of the interval are NOT counted as part of the interval. Lower_bound must be >= 0.
latex : $ f(x)=K~begin{cases}0 & x le text{lower_bound} \frac{1}{x} & text{lower_bound} < x < text{upper_bound} \ 0 & x ge text{upper_bound} end{cases}$
parameters :
lower_bound :
desc : Lower bound for the interval initial value : 1e-20 min : 1e-30 max : np.inf
upper_bound :
desc : Upper bound for the interval initial value : 100 min : 1e-30 max : np.inf
K :
desc : Normalization initial value : 1 fix : yes
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.priors.Powerlaw_Prior(**kwargs)[source]
Bases:
Function1D
description :
An power law distribution function between a-b
latex : $ f(x, alpha) = alpha x^{alpha-1)$
parameters :
alpha :
desc : slope parameter initial value : 1 min: 0.
- a :
desc: lower bound of distribution initial value : 0. min: 0.
- b:
desc: upper bound of distribution initial value: 1 min: 0.
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.priors.Truncated_gaussian(**kwargs)[source]
Bases:
Function1D
description :
A truncated Gaussian function defined on the interval between the lower_bound (a) and upper_bound (b)
latex : $begin{split}f(x;mu,sigma,a,b)=frac{frac{1}{sigma} phileft( frac{x-mu}{sigma} right)}{Phileft( frac{b-mu}{sigma} right) - Phileft( frac{a-mu}{sigma} right)}\phileft(zright)=frac{1}{sqrt{2 pi}}expleft(-frac{1}{2}z^2right)\Phileft(zright)=frac{1}{2}left(1+erfleft(frac{z}{sqrt(2)}right)right)end{split}$
parameters :
F :
desc : Integral between -inf and +inf. Fix this to 1 to obtain a Normal distribution initial value : 1
mu :
desc : Central value initial value : 0.0
sigma :
desc : standard deviation initial value : 1.0 min : 1e-12
lower_bound :
desc: lower bound of gaussian, setting to -np.inf results in half normal distribution initial value : -1.
upper_bound :
desc: upper bound of gaussian setting to np.inf results in half normal distribution initial value : 1.
- tests :
{ x : 0.0, function value: 0.3989422804014327, tolerance: 1e-10}
{ x : -1.0, function value: 0.24197072451914337, tolerance: 1e-9}
- static info()
- class astromodels.functions.priors.Uniform_prior(**kwargs)[source]
Bases:
Function1D
description :
A function which is constant on the interval lower_bound - upper_bound and 0 outside the interval. The extremes of the interval are counted as part of the interval.
latex : $ f(x)=begin{cases}0 & x < text{lower_bound} \text{value} & text{lower_bound} le x le text{upper_bound} \ 0 & x > text{upper_bound} end{cases}$
parameters :
lower_bound :
desc : Lower bound for the interval initial value : 0 min : -np.inf max : np.inf
upper_bound :
desc : Upper bound for the interval initial value : 1 min : -np.inf max : np.inf
value :
desc : Value in the interval initial value : 1.0
- tests :
{ x : 0.5, function value: 1.0, tolerance: 1e-20}
{ x : -0.5, function value: 0, tolerance: 1e-20}
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()